Re: Parallel Bitmap Heap Scan reports per-worker stats in EXPLAIN ANALYZE

David Geier <geidav.pg@gmail.com>

From: David Geier <geidav.pg@gmail.com>
To: Melanie Plageman <melanieplageman@gmail.com>, Tomas Vondra <tomas@vondra.me>
Cc: David Rowley <dgrowleyml@gmail.com>, Masahiro.Ikeda@nttdata.com, lena.ribackina@yandex.ru, donghanglin@gmail.com, tomas.vondra@enterprisedb.com, dilipbalaut@gmail.com, pgsql-hackers@lists.postgresql.org, hlinnaka@iki.fi
Date: 2026-04-16T06:49:58Z
Lists: pgsql-hackers
Hi Tomas!

On 05.04.2026 20:27, Melanie Plageman wrote:
> On Fri, Apr 3, 2026 at 3:20 PM Tomas Vondra <tomas@vondra.me> wrote:
>>
>> I'm working on adding information about prefetching for scans [1], which
>> includes BitmapHeapScan. I realized the instrumentation added by this
>> thread may not be quite right, resulting in missing instrumentation for
>> non-parallel-aware scans in a parallel query.
>>
>> A better description / explanation of the issue is posted here [2]. I've
>> posted a proposed fix in the following message [3], in a patch:
>>
>>   v8-0002-Show-Bitmap-Heap-Scan-stats-for-non-parallel-awar.patch

I haven't spent a lot of time looking through the code and your patch
but I'm wondering why we're not rather missing a
ExecBitmapIndexScanInstrumentEstimate(), rather than calling
ExecBitmapIndexScanEstimate() also in the !parallel_aware case. All
other scans do it this way, so why do it differently for Bitmap Index Scan?

>> I wonder if someone from this thread could review my analysis, and
>> confirm this is not intentional. I don't see it discussed in the thread,
>> so I assume no one noticed this behavior. I'd also appreciate a review
>> of the proposed fix, or suggestions for alternative fixes.
> 
> I can't imagine this was intentional.

Agreed.

--
David Geier



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Show Parallel Bitmap Heap Scan worker stats in EXPLAIN ANALYZE

  2. Widen lossy and exact page counters for Bitmap Heap Scan

  3. Remove redundant snapshot copying from parallel leader to workers