agora inbox for pgsql-committers@postgresql.org
help / color / mirror / Atom feedFrom: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: instrumentation: Separate per-node logic from other uses
Date: Sun, 05 Apr 2026 23:11:55 +0000
Message-ID: <E1w9WdG-00391c-2k@gemulon.postgresql.org> (raw)
instrumentation: Separate per-node logic from other uses
Previously, different places (e.g. query "total time") were repurposing the
Instrumentation struct initially introduced for capturing per-node statistics
during execution. This overuse of the same struct is confusing, e.g. by
cluttering calls of InstrStartNode/InstrStopNode in unrelated code paths, and
prevents future refactorings.
Instead, simplify the Instrumentation struct to only track time and WAL/buffer
usage. Similarly, drop the use of InstrEndLoop outside of per-node
instrumentation - these calls were added without any apparent benefit since
the relevant fields were never read.
Introduce the NodeInstrumentation struct to carry forward the per-node
instrumentation information. WorkerInstrumentation is renamed to
WorkerNodeInstrumentation for clarity.
In passing, clarify that InstrAggNode is expected to only run after
InstrEndLoop (as it does in practice), and drop unused code.
This also fixes a consequence-less bug: Previously ->async_mode was only set
when a non-zero instrument_option was passed. That turns out to be harmless
right now, as ->async_mode only affects a timing related field.
Author: Lukas Fittl <lukas@fittl.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/CAP53PkzdBK8VJ1fS4AZ481LgMN8f9mJiC39ZRHqkFUSYq6KWmg@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/5a79e78501f46bd3ac7fbd0ff84cf1e20dbafd19
Modified Files
--------------
contrib/auto_explain/auto_explain.c | 8 +-
contrib/pg_stat_statements/pg_stat_statements.c | 8 +-
contrib/postgres_fdw/postgres_fdw.c | 2 +-
src/backend/commands/explain.c | 30 +++--
src/backend/executor/execMain.c | 8 +-
src/backend/executor/execParallel.c | 24 ++--
src/backend/executor/execProcnode.c | 4 +-
src/backend/executor/instrument.c | 149 +++++++++++++++---------
src/include/executor/instrument.h | 60 +++++++---
src/include/nodes/execnodes.h | 9 +-
src/tools/pgindent/typedefs.list | 3 +-
11 files changed, 178 insertions(+), 127 deletions(-)
Message-ID: <E1w9WdG-00391c-2k@gemulon.postgresql.org>
Permalink: ../E1w9WdG-00391c-2k@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1w9WdG-00391c-2k@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: andres@anarazel.de, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: instrumentation: Separate per-node logic from other uses
In-Reply-To: <E1w9WdG-00391c-2k@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