agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix BitmapHeapScan non-parallel-aware EXPLAIN ANALYZE
Date: Tue, 07 Apr 2026 11:05:57 +0000
Message-ID: <E1wA4Fo-003NnM-1F@gemulon.postgresql.org> (raw)

Fix BitmapHeapScan non-parallel-aware EXPLAIN ANALYZE

Allocates shared bitmap table scan instrumentation for all parallel
scans. Previously, the instrumentation was only allocated for
parallel-aware scans, other bitmap heap scans in the parallel query had
no shared instrumentation and EXPLAIN didn't report exact/lossy pages.
This affected cases like scans on the outside of a parallel join or
queries run with debug_parallel_query=regress.

Fixed by allocating a separate DSM chunk for shared instrumentation and
doing so regardless of parallel-awareness. The instrumentation is
allocated in its own DSM chunk, separate from ParallelBitmapHeapState.

Report an initial patch by me. The approach with a separate DSM was
proposed and implemented by Melanie.

Not backpatched. The issue affects Postgres 18 (since 5a1e6df3b84c), but
having multiple DSM chunks is possible only since dd78e69cfc33. If we
decide to fix this in backbranches too, it will need to be done in a
less invasive way.

Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Tomas Vondra <tomas@vondra.me>
Reviewed-by: Lukas Fittl <lukas@fittl.com>
Discussion: https://postgr.es/m/flat/a177a6dd-240b-455a-8f25-aca0b1c08c6e%40vondra.me

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9c18b47e61071cf1395620f182b07a7ab9aac263

Modified Files
--------------
src/backend/commands/explain.c            |   2 +-
src/backend/executor/execParallel.c       |   9 +++
src/backend/executor/nodeBitmapHeapscan.c | 111 ++++++++++++++++++------------
src/include/executor/nodeBitmapHeapscan.h |   6 ++
4 files changed, 83 insertions(+), 45 deletions(-)



Message-ID: <E1wA4Fo-003NnM-1F@gemulon.postgresql.org>
Permalink:  ../E1wA4Fo-003NnM-1F@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wA4Fo-003NnM-1F@gemulon.postgresql.org

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: pgsql-committers@postgresql.org
  Cc: tomas.vondra@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix BitmapHeapScan non-parallel-aware EXPLAIN ANALYZE
  In-Reply-To: <E1wA4Fo-003NnM-1F@gemulon.postgresql.org>

* 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