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

From: Andres Freund <andres(at)anarazel(dot)de>
To: Melanie Plageman <melanieplageman(at)gmail(dot)com>
Cc: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Robert Treat <rob(at)xzilla(dot)net>, Marcos Pegoraro <marcos(at)f10(dot)com(dot)br>, Alena Rybakina <a(dot)rybakina(at)postgrespro(dot)ru>, Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Peter Geoghegan <pg(at)bowt(dot)ie>
Subject: Re: Eagerly scan all-visible pages to amortize aggressive vacuum
Date: 2025-02-11 01:06:12
Message-ID: pw6co7aggdmqam3jnf7ng4g7xik6illq2fyq7bnej4ywbajzbh@dbrexmawd5ih
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)anarazel(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2025-02-11 01:21:39 Re: Statistics Import and Export
Previous Message Peter Smith 2025-02-11 01:00:07 Re: Enhance 'pg_createsubscriber' to retrieve databases automatically when no database is provided.