Re: Showing primitive index scan count in EXPLAIN ANALYZE (for skip scan and SAOP scans)

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Showing primitive index scan count in EXPLAIN ANALYZE (for skip scan and SAOP scans)
Date: 2025-03-07 17:18:10
Message-ID: CAH2-Wzk+cXBD1tnhQ-oagHuY9Fw5uArJE+LxfAP2VjZmDawbeQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Mar 6, 2025 at 2:12 PM Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> Maybe show_sort_info() has some useful
> precedent, since that's also a bit of node-specific instrumentation,
> and it seems to know what to do about workers.

What do you think of the attached WIP patch, which does things this
way? Does this seem like the right general direction to you?

Unfortunately, my new approach seems to require quite a bit more code,
including adding new parallel query functions for bitmap index scans
(which previously didn't require anything like this at all). I can
probably simplify it some more, but likely not by much.

I now put a pointer to an instrumentation struct in IndexScanDescData.
The pointer always points to local memory: specifically, it points to
a dedicated field in each of the 3 supported executor node planstate
structs. Each of the workers copy their local instrumentation struct
into a dedicated space in shared memory, at the point that
ExecIndexScanRetrieveInstrumentation/ExecIndexOnlyScanRetrieveInstrumentation/ExecBitmapIndexScanRetrieveInstrumentation
is called (though only when running during EXPLAIN ANALYZE). Once we
get to explain.c, we take more or less the same approach already used
for things like sort nodes and hash join nodes.

Obviously, this revised version of the patch passes all tests when the
tests are run with debug_parallel_query=regress.

--
Peter Geoghegan

Attachment Content-Type Size
v1oftake2-0001-Show-index-search-count-in-EXPLAIN-ANALYZE.patch application/octet-stream 96.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-03-07 17:19:15 Re: Add column name to error description
Previous Message Alexander Korotkov 2025-03-07 17:15:23 Re: pg_atomic_compare_exchange_*() and memory barriers