Re: Eagerly scan all-visible pages to amortize aggressive vacuum

Melanie Plageman <melanieplageman@gmail.com>

From: Melanie Plageman <melanieplageman@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>, Robert Haas <robertmhaas@gmail.com>, Robert Treat <rob@xzilla.net>, Marcos Pegoraro <marcos@f10.com.br>, Alena Rybakina <a.rybakina@postgrespro.ru>, Nazir Bilal Yavuz <byavuz81@gmail.com>, Pg Hackers <pgsql-hackers@postgresql.org>, Peter Geoghegan <pg@bowt.ie>
Date: 2025-02-11T15:35:07Z
Lists: pgsql-hackers

Attachments

On Mon, Feb 10, 2025 at 8:06 PM Andres Freund <andres@anarazel.de> wrote:
>
> On 2025-02-04 12:44:22 -0500, Melanie Plageman wrote:
> > On Mon, Feb 3, 2025 at 9:09 PM Andres Freund <andres@anarazel.de> wrote:
> > > > +     /*
> > > > +      * Now calculate the eager scan start block. Start at a random spot
> > > > +      * somewhere within the first eager scan region. This avoids eager
> > > > +      * scanning and failing to freeze the exact same blocks each vacuum of the
> > > > +      * relation.
> > > > +      */
> > >
> > > If I understand correctly, we're not really choosing a spot inside the first
> > > eager scan region, we determine the bounds of the first region?
> >
> > I'm not sure I understand how those are different, but I updated the
> > comment a bit. Maybe you can elaborate what you mean?
>
> Let's assume that we use regions of 512 pages. Without randomness we'd do:
>
> [0 .. 512) [512 .. 1024) ...
>
>
> IMO, if we were to choose a spot inside the first region, we'd do:
>
> [random(0, 512) .. 512) [512 .. 1024)
>
>
> If we choose the bounds of the first region we'd do:
>
> [0, random(0, 512)) [$prior bound .. $prior_bound + 512)
>
> or something like that.

Ah, that's true. I guess I meant the start block of the second region.
Anyway, I've updated the comment to be more correct I think.

- Melanie

Commits

  1. pg_stat_statements: Add counters for generic and custom plans

  2. Remove leftover mentions of XLOG_HEAP2_FREEZE_PAGE records

  3. Rename LVRelState->frozen_pages