Re: relfilenode statistics

Поиск
Список
Период
Сортировка
От Bertrand Drouvot
Тема Re: relfilenode statistics
Дата
Msg-id aNutZbziBycskOYR@ip-10-97-1-34.eu-west-3.compute.internal
обсуждение исходный текст
Ответ на Re: relfilenode statistics  (Michael Paquier <michael@paquier.xyz>)
Ответы Re: relfilenode statistics
Список pgsql-hackers
Hi,

On Tue, Sep 16, 2025 at 03:44:25PM +0900, Michael Paquier wrote:
> On Thu, Mar 13, 2025 at 02:00:52PM +0500, Kirill Reshke wrote:
> > Hmm. While it is true that catalog lookups cannot be performed during
> > crash recovery, is it really necessary to save and retrieve statistics
> > after a crash?
> 
> Yes, losing stats on crash is a *very* annoying thing.  Having no
> stats for a relation means that autovacuum gives up entirely on
> relations it has no stats of, skipping it entirely until they have
> rebuilt and bloat would accumulate.  Being able to recover these stats 
> from crash recovery is a cheap design, that would improve reliability
> by a large degree.

+1.

> The startup process is not connected to a database and has no access
> to pg_class: the only thing we can know about are the on-disk files,
> not their in-catalog OIDs.  FWIW, I think that this patch would be a
> huge step forward a more reliable stats system.
> 
> True that the patch needs a rebase.  Bertrand has also mentioned that
> some points needed more work.

Right. I'll come back with a rebase, and a POC proposal on some stats so that
we could agree on the design. Also, it looks like that we have a consensus on 
"sometimes I don't know the relation OID so I want to use the relfilenumber instead,
without changing the user experience" (see [1)).

As far Michael's concern about adding a new field in the hash key, as 8 bytes
is allocated for the object ID, then we can go with:

dboid (linked to RelFileLocator's dbOid)
objoid (linked to RelFileLocator's spcOid and to the RelFileLocator's relNumber)

and avoid adding a new field in the key.

[1]: https://www.postgresql.org/message-id/CA%2BTgmoZ0u6ek_xxYJaGVBk0uEvH5txoYsCwbvxKWe-2xn_G_qg%40mail.gmail.com

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com



В списке pgsql-hackers по дате отправления: