From: Joao Rito <joaovictor.rito@gmail.com>
To: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Cc: shihao zhong <zhong950419@gmail.com>
Cc: Nazir Bilal Yavuz <byavuz81@gmail.com>
Cc: Melanie Plageman <melanieplageman@gmail.com>
Cc: Thomas Munro <thomas.munro@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Fix ReadStream handling when heap rescan strategy changes
Date: Sat, 14 Nov 2026 18:34:40 -0300
Message-ID: <20261114213440.96-1-joaovictor.rito@gmail.com> (raw)
In-Reply-To: <CAGRkXqR3ZZBpLvXBOi+N2nXMtqYJJ3WCi4sHZYreZszD4dtbDQ@mail.gmail.com>
References: <CAGRkXqR3ZZBpLvXBOi+N2nXMtqYJJ3WCi4sHZYreZszD4dtbDQ@mail.gmail.com>
Hi Bertrand,
Thank you for the patch. I tested v1 (0001 and 0002) and it looks good to
me.
What I did:
- Applied both patches to current master (165af118c5). They apply cleanly
and build without warnings (--enable-cassert --enable-debug
--enable-tap-tests).
- make check passes (243 tests). The whole src/test/modules/test_misc
suite passes with the patch (16 files, 169 tests), including the new
t/016_heap_rescan_strategy.pl.
- I also ran the new test against unpatched master. It fails there on
"a rescanned sequential scan uses its newly selected bulk-read strategy"
(got 0, expected > 0). So the test does catch the bug, which I think
helps with the question of whether it is worth its setup cost.
- I ran the query from the test by hand (shared_buffers = 1MB,
max_parallel_workers_per_gather = 0) and looked at
pg_stat_get_backend_io() for the bulkread context:
- master: 0 reads, 0 hits in bulkread, with io_method = worker and
io_method = sync.
- patched: 468 reads, 104 hits in bulkread, with both io_method values.
The query returns the same 11997 rows in both builds, and there were no
assertion failures or errors in the server log.
One small thing: the commit message of 0001 has an empty "Reviewed-by:"
and "Discussion: https://postgr.es/m/"; without the message-id. I guess you
will fill those in later.
I only tested the case where the rescan starts using a strategy. I did not
exercise the other direction (the strategy is disabled on rescan, the
extension case you described), and I did not test parallel, bitmap or TID
range scans, io_uring, the back branches, or a meson build.
Thanks again,
Joao Rito
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: joaovictor.rito@gmail.com, bertranddrouvot.pg@gmail.com, zhong950419@gmail.com, byavuz81@gmail.com, melanieplageman@gmail.com, thomas.munro@gmail.com
Subject: Re: Fix ReadStream handling when heap rescan strategy changes
In-Reply-To: <20261114213440.96-1-joaovictor.rito@gmail.com>
References: <CAGRkXqR3ZZBpLvXBOi+N2nXMtqYJJ3WCi4sHZYreZszD4dtbDQ@mail.gmail.com> <20261114213440.96-1-joaovictor.rito@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 DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox