pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Rowley <drowley@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Change tuplestore_get_stats() API
Date: Mon, 12 Oct 2026 09:42:53 +0000
Message-ID: <E1xGCYX-00000001ItG-1xCw@gemulon.postgresql.org> (raw)

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@gmail.com>
Reviewed-by: Tatsuya Kawata <kawatatatsuya0913@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.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(-)



Message-ID: <E1xGCYX-00000001ItG-1xCw@gemulon.postgresql.org>
Permalink:  ../E1xGCYX-00000001ItG-1xCw@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xGCYX-00000001ItG-1xCw@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: drowley@postgresql.org
  Subject: Re: pgsql: Change tuplestore_get_stats() API
  In-Reply-To: <E1xGCYX-00000001ItG-1xCw@gemulon.postgresql.org>
  References: <E1xGCYX-00000001ItG-1xCw@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 DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox