Re: Incorrect result of bitmap heap scan.

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: "Core Studios Inc." <corestudiosinc@gmail.com>, Matthias van de Meent <boekewurm+postgres@gmail.com>, Peter Geoghegan <pg@bowt.ie>, Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andrew Dunstan <andrew@dunslane.net>, Melanie Plageman <melanieplageman@gmail.com>, Thomas Munro <thomas.munro@gmail.com>, Konstantin Knizhnik <knizhnik@garret.ru>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>, Alexander Kuzmenkov <akuzmenkov@timescale.com>
Date: 2025-09-16T12:25:42Z
Lists: pgsql-hackers
Hi, 

On September 16, 2025 7:57:54 AM EDT, "Core Studios Inc." <corestudiosinc@gmail.com> wrote:
>Hello,
>
>We noticed a sustained increased in IO Wait of read queries after upgrading from 13.13 to 13.21. Eventually, we narrowed it down to a spike in index_blocks_read of a certain table where Bitmap Heap Scans do happen.
>
>Do you think that this change (i.e. removing the optimization) could be what caused this regression?

You're not providing enough details for us to answer that question. We'd need an explain verbose for the query.

Greetings, 

Andres
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.



Commits

  1. Add test for HeapBitmapScan's broken skip_fetch optimization

  2. Remove HeapBitmapScan's skip_fetch optimization

  3. Allow bitmap scans to operate as index-only scans when possible.