pgsql: Change tuplestore_get_stats() API

From: David Rowley <drowley(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Change tuplestore_get_stats() API
Date: 2026-10-12 09:42:53
Message-ID: E1xGCYX-00000001ItG-1xCw@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Change tuplestore_get_stats() API

Previously, this returned a pointer to the string constant "Disk" or
"Memory" depending on whether the tuplestore spilled to disk or not. An
upcoming patch adds additional EXPLAIN ANALYZE output for Material nodes
for parallel workers. The API pointing to the string constant is not
great when we must transfer the storage method to the parallel leader, as
we cannot simply point to the string constant in the other process.
That's going to be mapped to a different memory address.

Here we adjust the tuplestore_get_stats() API to set "*used_disk" to
true when the tuplestore spilled to disk. This allows us to avoid a
pretty horrible: if (strcmp(..., "Disk") == 0) in the code to transfer
the information to the parallel leader.

Author: David Rowley <dgrowleyml(at)gmail(dot)com>
Reviewed-by: Tatsuya Kawata <kawatatatsuya0913(at)gmail(dot)com>
Reviewed-by: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAApHDvoUWCms-b27MpDKd5_RUFtAnVrxPgN9u3QoQbBihk+S6g@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/commands/explain.c | 45 +++++++++++++++++++------------------
src/backend/utils/sort/tuplestore.c | 9 ++------
src/include/utils/tuplestore.h | 2 +-
3 files changed, 26 insertions(+), 30 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Daniel Gustafsson 2026-10-12 10:06:04 pgsql: doc: Consistently use double quotes for attrs in ulinks
Previous Message Matthias van de Meent 2026-10-12 08:57:32 Re: pgsql: Add nbtree README note on index-only scans in recovery.