public inbox for [email protected]  
help / color / mirror / Atom feed
From: Alexandre Felipe <[email protected]>
To: Tomas Vondra <[email protected]>
Cc: Peter Geoghegan <[email protected]>
Cc: Andres Freund <[email protected]>
Cc: Thomas Munro <[email protected]>
Cc: Nazir Bilal Yavuz <[email protected]>
Cc: Robert Haas <[email protected]>
Cc: Melanie Plageman <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Cc: Georgios <[email protected]>
Cc: Konstantin Knizhnik <[email protected]>
Cc: Dilip Kumar <[email protected]>
Subject: Re: index prefetching
Date: Thu, 12 Mar 2026 18:32:23 +0000
Message-ID: <CAE8JnxOygarzQpBbBHV+_QZ2A=K01de_iFcn08+D6hNGS3kHPg@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CAE8JnxN_EwnTLLMWGhvgwaomYZ0ysm7NeogA-BqBd=Rs3S7Oqw@mail.gmail.com>
	<64a2re223ajj4popowsyu4xekbuvvyfwkrihn5yzyrkwsmsuvp@2lls3tpww5dl>
	<a67mvhyi2q45eg4eimhpwdg6l3s3dmpahti2svffvmvzwmss27@r4nohusvndbq>
	<[email protected]>
	<il7jtfowpatrlg33qb5plj7v7pferes4ogerq5fdczszi4kokh@sbwvb2ukfgos>
	<[email protected]>
	<ws47e3wly6skt36b23zy5qfvcxzueo6od3uicunuodsqnxl7os@7v2qi7qkxzbz>
	<CAH2-Wzk-89uCvdJ1Q6NsM6LvDvUEt6Qy66T6A60J=D_voWxZDg@mail.gmail.com>
	<64mfcfv7iihc4pmqlxarii4esnmqry52ckz5m7lmwylnfnuxuz@oxh4ioxkjtep>
	<CAH2-Wzmy7NMba9k8m_VZ-XNDZJEUQBU8TeLEeL960-rAKb-+tQ@mail.gmail.com>
	<d2d4qofb5ajg2ftvm6h56oi4utdwpzkqfjd7z2y4vod5qaub4h@ixyotvfut3mg>
	<CAH2-Wz=g=JTSyDB4UtB5su2ZcvsS7VbP+ZMvvaG6ABoCb+s8Lw@mail.gmail.com>
	<[email protected]>

1) v12-0001-Use-simple-hash-for-PrivateRefCount.patch
>
> - seems like a (mostly) mechanical switch for a different hashtable







But Andres slapped me with a question: "Did you try on a real query?"
When I tried on a real query it was a bit slower on the that Andres gave as
an
example:
SELECT sum(balance) INTO s FROM uncorrelated WHERE id > 1000 and id <
500000;

It is marginal but consistently slower, I guess it is just the presence of
more code
patched: 120.36 - 124.98
master: 116.19 - 118.09
Passing -falign-functionns=64
patched: 117.82 - 118.88
master: 115.40 - 119.91

Maybe just the presence of more the code, because we don't touch the hash.
I tried with SH_SCOPE `static` or `static pg_noinline` but that doesn't
help either.
Assuming one ReadBuffer/ReleaseBuffer per row, we can infer infer that it
was
~3ms / 5e5 = 6ns slower.

On micro benchmarking it cuts the gap by half when holding 100 to 1000
buffers.

[image: image.png]

If we can accept one more pointer dereference, by having a pointer instead
of a static
array we can reduce by the ramp by 80% (and no, that is not achieved by
placing
the bottom of the ramp half way up hehe)


Regards,
Alexandre


Attachments:

  [image/png] image.png (55.2K, 3-image.png)
  download | view image

view thread (367+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: index prefetching
  In-Reply-To: <CAE8JnxOygarzQpBbBHV+_QZ2A=K01de_iFcn08+D6hNGS3kHPg@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox