Re: Add memory/disk usage for WindowAgg nodes in EXPLAIN - Mailing list pgsql-hackers

From David Rowley
Subject Re: Add memory/disk usage for WindowAgg nodes in EXPLAIN
Date
Msg-id CAApHDvpKUooQQ6UoyvUPdwXL+Zzb8ML=gG1Yscdprpz2EC-znQ@mail.gmail.com
Whole thread Raw
In response to Re: Add memory/disk usage for WindowAgg nodes in EXPLAIN  (Tatsuo Ishii <ishii@postgresql.org>)
Responses Re: Add memory/disk usage for WindowAgg nodes in EXPLAIN
List pgsql-hackers
On Thu, 19 Sept 2024 at 16:21, Tatsuo Ishii <ishii@postgresql.org> wrote:
> Thanks. Attached is a patch for CTE scan, table function scan and
> recursive union scan nodes.

1. It's probably a minor detail, but in show_recursive_union_info(), I
don't think the tuplestores can ever be NULL.

+ if (working_table != NULL)
+ tuplestore_get_stats(working_table, &tempStorageType, &tempSpaceUsed);
+
+ if (intermediate_table != NULL)
+ tuplestore_get_stats(intermediate_table, &maxStorageType, &maxSpaceUsed);

I added the NULL tests for the Materialize case as the tuplestore is
created in ExecMaterial() rather than ExecInitMaterial(). For the two
tuplestorestates above, they're both created in
ExecInitRecursiveUnion().

2. I imagined you'd always do maxSpaceUsed += tempSpaceUsed; or
maxSpaceUsedKB = BYTES_TO_KILOBYTES(maxSpaceUsed + tempSpaceUsed);

+ if (tempSpaceUsed > maxSpaceUsed)
+ {
+ maxStorageType = tempStorageType;
+ maxSpaceUsed = tempSpaceUsed;
+ }

Why do you think the the space used by the smaller tuplestore should
be ignored in the storage size output?

David



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Add contrib/pg_logicalsnapinspect
Next
From: Amit Kapila
Date:
Subject: Re: Allow logical failover slots to wait on synchronous replication