public inbox for [email protected]
help / color / mirror / Atom feedFrom: Andres Freund <[email protected]>
To: Peter Geoghegan <[email protected]>
Cc: Tomas Vondra <[email protected]>
Cc: Alexandre Felipe <[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: Sat, 4 Apr 2026 01:33:32 -0400
Message-ID: <e6avgxqkonquofdstnvt5zq72x6zmolz5vojshk2b3ptsksdmw@2mf4bmp4pank> (raw)
In-Reply-To: <s25f6opuqwmz7oad467twvgxc36zmgzguhph43z4sbfkflsjnq@r6cuj7cl36lg>
References: <t6mtqbv2mbfhjni4bvwdgoecppjmxvbyfwl6utovzv76xc2672@k3o5ryevaeqv>
<CAH2-Wz=D4Lru9BkvqaRnFRPDaZbfTOdWcxw13zyG6GVFTtz_vw@mail.gmail.com>
<CAH2-Wz=Vxsgas35ZzOJJW1ceqp9TJ2DFhKmXULwUAcVpfD73xA@mail.gmail.com>
<CAH2-Wz=kMg3PNay96cHMT0LFwtxP-cQSRZTZzh1Cixxf8G=zrw@mail.gmail.com>
<CAH2-WzkFRoTjD9T8ykYDzOMxzGiWFqcAkbK8B=HjfpoMdM4E8A@mail.gmail.com>
<chsvntdxvsiyigxq4nng36gne4natvxwvsqnkvbjlpaw6bu7co@a6togdo4wbrj>
<CAH2-Wz=nz-zr=gaXL1od_F7dcr=7d+3jEEveqY-bgcAKF6wZJQ@mail.gmail.com>
<CAH2-Wz=t3G53xKGYEWqm_QV35ExRgT2k=qhw_VHe5oGjdFRwtA@mail.gmail.com>
<CAH2-WzkiCK=wELiXPgriN4r7cJzGb3Xg48E9YHrFEyEPTkynOw@mail.gmail.com>
<s25f6opuqwmz7oad467twvgxc36zmgzguhph43z4sbfkflsjnq@r6cuj7cl36lg>
Hi,
On 2026-04-04 01:21:53 -0400, Andres Freund wrote:
> > +StaticAssertDecl(INDEX_SCAN_MAX_BATCHES <= PG_UINT8_MAX + 1,
> > + "INDEX_SCAN_MAX_BATCHES must fit in uint8 ring buffer indexes");
>
> I'd just use a < without the + 1 on the other side :)
Actually, I think there are actual issues around this. Once you set
INDEX_SCAN_MAX_BATCHES to 256, there are a lot of, justified looking,
warnings.
[1/1 1 100%] Compiling C object src/backend/postgres_lib.a.p/access_heap_heapam_handler.c.o
In file included from ../../../../../home/andres/src/postgresql/src/include/access/heapam.h:19,
from ../../../../../home/andres/src/postgresql/src/backend/access/heap/heapam_handler.c:23:
../../../../../home/andres/src/postgresql/src/include/access/relscan.h: In function 'index_scan_batch_full':
../../../../../home/andres/src/postgresql/src/include/access/relscan.h:488:45: warning: comparison is always false due to limited range of data type [-Wtype-limits]
488 | return index_scan_batch_count(scan) == INDEX_SCAN_MAX_BATCHES;
| ^~
I'm also not sure this is actually quite right
/*
* Do we already have a batch loaded at 'idx' offset in scan's ring buffer?
*
* NOTE: a stale batch idx can alias a currently-loaded range after uint8
* overflow, producing a false positive. False negatives are not possible.
*/
static inline bool
index_scan_batch_loaded(IndexScanDescData *scan, uint8 idx)
{
return (int8) (idx - scan->batchringbuf.headBatch) >= 0 &&
(int8) (idx - scan->batchringbuf.nextBatch) < 0;
}
once the differences between the values don't fit into an int8 anymore. But
I'm tired.
Greetings,
Andres Freund
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: <e6avgxqkonquofdstnvt5zq72x6zmolz5vojshk2b3ptsksdmw@2mf4bmp4pank>
* 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