pgsql: Add memory/disk usage for Function Scan nodes in EXPLAIN

From: David Rowley <drowley(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add memory/disk usage for Function Scan nodes in EXPLAIN
Date: 2026-11-10 04:29:58
Message-ID: E1xQdUc-000000008f8-36rI@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add memory/disk usage for Function Scan nodes in EXPLAIN

Commit 1eff8279d added the infrastructure to report the maximum tuplestore
memory or disk usage with EXPLAIN ANALYZE. 95d6e9af0 and 40708acd6
extended that to WindowAgg, CTE Scan, Table Function Scan and Recursive
Union nodes.

Here we add the same reporting for the Function Scan node.

Function Scans can have multiple tuplestores: one for each function
being scanned. We report the sum of the space used by all, and report
the maximum of that sum over all rescans, and report that the disk was
used if any tuplestore ever spills.

Author: Tatsuya Kawata <kawatatatsuya0913(at)gmail(dot)com>
Reviewed-by: Shashishekar Hullahally Anantharamu <shashi(dot)h(dot)ananth(at)gmail(dot)com>
Reviewed-by: David Rowley <dgrowleyml(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAHza6qdpZTTjGJdzUmBkWbDPGB=gsz-vZWm5dO-oim_NrjAXCQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/edbb1d2dcb18d0706e644d3048a21e4475debd95

Modified Files
--------------
src/backend/commands/explain.c | 72 +++++++++++++
src/backend/executor/execParallel.c | 19 ++++
src/backend/executor/nodeFunctionscan.c | 163 +++++++++++++++++++++++++++---
src/include/executor/instrument_node.h | 21 ++++
src/include/executor/nodeFunctionscan.h | 8 ++
src/include/nodes/execnodes.h | 25 ++++-
src/test/regress/expected/explain.out | 43 +++++++-
src/test/regress/expected/planner_est.out | 3 +
src/test/regress/sql/explain.sql | 8 ++
src/test/regress/sql/planner_est.sql | 3 +
src/tools/pgindent/typedefs.list | 2 +
11 files changed, 345 insertions(+), 22 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2026-11-10 04:55:29 Re: pgsql: Make GetSnapshotData() more resilient on out-of-memory errors
Previous Message Nathan Bossart 2026-11-09 20:45:28 pgsql: doc: Rearrange the logical operator truth tables.