public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tomas Vondra <[email protected]>
To: Siddharth Kothari <[email protected]>
To: [email protected]
Cc: Vaibhav Jain <[email protected]>
Cc: Madhukar <[email protected]>
Cc: Melanie Plageman <[email protected]>
Subject: Re: [PATCH] Add RetrieveInstrumentation hook for CustomScan providers
Date: Wed, 8 Jul 2026 20:40:48 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAGCUe0JRZP-=rOefQz0AYLPpeg=EN=a=TcD9=ZSDup1Mn+Sanw@mail.gmail.com>
References: <CAGCUe0Kp7kTUWFjHhiE-xjZ4=UDe2fUdDVajKcjV+BT+T5d21A@mail.gmail.com>
<CAGCUe0LUtEDyy1U-KLzax3KGz6zA8T75d4VxN+3vu_9EmLMeLQ@mail.gmail.com>
<CAGCUe0+DV0Tkd19rX7HrQikyuWTF0uQS-OeikeMOye+CzSvxgQ@mail.gmail.com>
<CAGCUe0JRZP-=rOefQz0AYLPpeg=EN=a=TcD9=ZSDup1Mn+Sanw@mail.gmail.com>
Hi Siddharth,
On 7/8/26 18:52, Siddharth Kothari wrote:
> Hi hackers,
>
> Adding Melanie and Tomas to this thread. I noticed you both recently
> committed similar changes to handle shared memory instrumentation
> separation and retrieval for IndexScan/IndexOnlyScan (dd78e69cfc
> <https://github.com/postgres/postgres/commit/
> dd78e69cfc337f93cfc0303ddf660262d7f1237e>) and SeqScan (3b1117d6e2
> <https://github.com/postgres/postgres/
> commit/3b1117d6e2e47d86cdbd978b79434c630cb0ef52>).
>
> My patch implements the exact same pattern for CustomScan states. It
> adds an optional RetrieveInstrumentationCustomScan hook so that
> extensions can aggregate their worker metrics before the DSM gets
> unlinked, bringing custom scans to parity with the recent core scan
> instrumentation improvements.
>
> Could you please help review?
>
> The CommitFest entry is also updated here: https://
> commitfest.postgresql.org/patch/6524/ <https://
> commitfest.postgresql.org/patch/6524/>
>
Thanks for the patch, and sorry for not responding earlier. The last
couple months were incredibly busy, both because of the last commitfest
and personal reasons.
I think the patch looks generally OK, except for two things:
1) It needs to add the new callback to doc/src/sgml/custom-scan.sgml,
with similar documentation as for the other callbacks.
2) While looking at execParallel.c it occurred to me the CustomScan may
have the same issue as described in [1] (and a couple messages after
that). The scan may in the parallel part of a plan, but not necessarily
parallel-aware. But a lot of the initialization is gated by
if (planstate->plan->parallel_aware)
...
All the other scans initialize some of the instrumentation always, in
blocks like this:
/* even when not parallel-aware, for EXPLAIN ANALYZE */
And BHS had this issue until 9c18b47e610, but we didn't do the same
thing for CustomScan. I guess we should.
Of course, it's not the fault of this patch, it's just something I
noticed while looking at the code. OTOH it probably also makes sense for
CustomScan to handle the instrumentation just like the other scans, i.e.
by allocating a separate DSM for the instrumentation. AFAICS that'll
require a couple more optional callbacks in CustomExecMethods:
ExecCustomScanInstrumentEstimate
ExecCustomScanInstrumentInitDSM
ExecCustomScanInstrumentInitWorker
But I think that's OK.
[1]
https://www.postgresql.org/message-id/3bdbc70d-ad44-494a-8aab-868b5066fe8b%40vondra.me
regards
--
Tomas Vondra
view thread (8+ messages) latest in thread
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: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: [PATCH] Add RetrieveInstrumentation hook for CustomScan providers
In-Reply-To: <[email protected]>
* 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