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

From: Tomas Vondra <tomas(at)vondra(dot)me>
To: Melanie Plageman <melanieplageman(at)gmail(dot)com>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, Masahiro(dot)Ikeda(at)nttdata(dot)com, lena(dot)ribackina(at)yandex(dot)ru, donghanglin(at)gmail(dot)com, geidav(dot)pg(at)gmail(dot)com, tomas(dot)vondra(at)enterprisedb(dot)com, dilipbalaut(at)gmail(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org, hlinnaka(at)iki(dot)fi
Subject: Re: Parallel Bitmap Heap Scan reports per-worker stats in EXPLAIN ANALYZE
Date: 2026-04-05 19:40:48
Message-ID: 7b8ba18a-548c-4a2f-962c-e50a3f902607@vondra.me
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 4/5/26 20:27, Melanie Plageman wrote:
> On Fri, Apr 3, 2026 at 3:20 PM Tomas Vondra <tomas(at)vondra(dot)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 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.
>

Indeed.

> I reviewed your approach and suggest we aim for even lower impact by
> always allocating the ParallelBitmapHeapState. That means the DSM
> layout won't differ such that pcxt->toc has to point to the
> instrumentation in the parallel-oblivious case and the pstate in the
> parallel-aware case. Attached is a patch that does this.
>

I like this approach - it's much simpler / less invasive. It did not
occur to me to use the parallel_aware in BitmapTableScanSetup.

regards

--
Tomas Vondra

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2026-04-05 19:44:48 Re: tid_blockno() and tid_offset() accessor functions
Previous Message Lukas Fittl 2026-04-05 19:38:58 Re: Stack-based tracking of per-node WAL/buffer usage