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

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
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 15:35:07
Message-ID: CAAKRu_bcRfueYVoW_K07we3HHSBai51-R8eiDpBmZ7wRDD3h8g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Feb 10, 2025 at 8:06 PM Andres Freund <andres(at)anarazel(dot)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(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.

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

Attachment Content-Type Size
v17-0001-Eagerly-scan-all-visible-pages-to-amortize-aggre.patch text/x-patch 43.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2025-02-11 15:36:55 Re: RFC: Allow EXPLAIN to Output Page Fault Information
Previous Message Alena Rybakina 2025-02-11 15:31:33 Re: Removing unneeded self joins