Re: Eagerly scan all-visible pages to amortize aggressive vacuum - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Eagerly scan all-visible pages to amortize aggressive vacuum
Date
Msg-id pw6co7aggdmqam3jnf7ng4g7xik6illq2fyq7bnej4ywbajzbh@dbrexmawd5ih
Whole thread Raw
In response to Re: Eagerly scan all-visible pages to amortize aggressive vacuum  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Hi,

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.

Greetings,

Andres Freund


PS: planning to respond to cleanup lock stuff downthread, after a bit of
exercise or tomorrow morning



pgsql-hackers by date:

Previous
From: Peter Smith
Date:
Subject: Re: Enhance 'pg_createsubscriber' to retrieve databases automatically when no database is provided.
Next
From: Jeff Davis
Date:
Subject: Re: Statistics Import and Export