Re: Improving scalability of Parallel Bitmap Heap/Index Scan

From: David Geier <geidav(dot)pg(at)gmail(dot)com>
To: John Naylor <johncnaylorls(at)gmail(dot)com>
Cc: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Improving scalability of Parallel Bitmap Heap/Index Scan
Date: 2026-10-15 08:29:17
Message-ID: 929e318b-e676-4c93-ba22-74a46af875cd@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Last but not least, I realized that parallel BIS needs parallel
> instrumentation support for EXPLAIN ANALYZE. I'll work on that next and
> provide an updated patch the next days.
It turned out that this is not the case and parallel instrumentation for
BIS seems to be all there already. I got on the wrong track because e.g.
Parallel Index (Only) Scan and many other plan nodes estimate in two parts:

1. memory needed for parallel-aware execution state and
2. memory needed for instrumentation when under a Gather node. This is
also needed when the plan is ran by a parallel worker but the node
itself not parallal-aware.

For example IndexOnlyScanState:

if (planstate->plan->parallel_aware)
ExecIndexOnlyScanEstimate((IndexOnlyScanState *)ps, e->pcxt);

/* even when not parallel-aware, for EXPLAIN ANALYZE */
ExecIndexOnlyScanInstrumentEstimate((IndexOnlyScanState *)ps, e->pcxt);

While for parallel BIS/BHS scan we do:

ExecBitmapHeapInstrumentEstimate((BitmapHeapScanState *)ps, e->pcxt);
and
ExecBitmapIndexScanEstimate((BitmapIndexScanState *)ps, e->pcxt);

It turned out that the BIS / BHS functions do both inside a single
function, while other nodes have two functions for it. I think it would
be good to make this consistent across all nodes. This would include
renaming the functions that don't allocate any execution state but only
instrumentation state, e.g. rename

ExecAggEstimate() -> ExecAggInstrumentEstimate().

Obviously, as a separate patch.

--
David Geier

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2026-10-15 08:43:31 Re: [PATCH] Discard aborted updaters when expanding a multixact
Previous Message Takeshi Ideriha 2026-10-15 08:27:06 Re: Fix doc: explanation of how postgres works when OOM killer is invoked