postgresql/contrib/postgres_fdw
Andres Freund 5a79e78501 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
2026-04-05 19:04:24 -04:00
..
expected postgres_fdw: Inherit the local transaction's access/deferrable modes. 2026-04-05 18:55:00 +09:00
specs postgres_fdw: Add more test coverage for EvalPlanQual testing. 2025-11-06 12:15:00 +09:00
sql postgres_fdw: Inherit the local transaction's access/deferrable modes. 2026-04-05 18:55:00 +09:00
t ALTER SUBSCRIPTION ... SERVER test. 2026-03-18 10:15:51 -07:00
.gitignore Fix EvalPlanQual handling of foreign/custom joins in ExecScanFetch. 2025-10-15 17:15:00 +09:00
connection.c postgres_fdw: Inherit the local transaction's access/deferrable modes. 2026-04-05 18:55:00 +09:00
deparse.c Remove bits* typedefs. 2026-03-30 16:12:08 -05:00
Makefile CREATE SUBSCRIPTION ... SERVER. 2026-03-06 08:27:56 -08:00
meson.build CREATE SUBSCRIPTION ... SERVER. 2026-03-06 08:27:56 -08:00
option.c Update copyright for 2026 2026-01-01 13:24:10 -05:00
postgres_fdw--1.0--1.1.sql postgres_fdw: Add functions to discard cached connections. 2021-01-26 15:35:54 +09:00
postgres_fdw--1.0.sql Add postgres_fdw contrib module. 2013-02-21 05:27:16 -05:00
postgres_fdw--1.1--1.2.sql postgres_fdw: Extend postgres_fdw_get_connections to return remote backend PID. 2025-03-03 08:51:30 +09:00
postgres_fdw--1.2--1.3.sql CREATE SUBSCRIPTION ... SERVER. 2026-03-06 08:27:56 -08:00
postgres_fdw.c instrumentation: Separate per-node logic from other uses 2026-04-05 19:04:24 -04:00
postgres_fdw.control CREATE SUBSCRIPTION ... SERVER. 2026-03-06 08:27:56 -08:00
postgres_fdw.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
shippable.c Switch SysCacheIdentifier to a typedef enum 2026-02-18 09:58:38 +09:00