Re: Questions about "Output" in EXPLAIN ANALYZE VERBOSE

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeff Janes <jeff.janes@gmail.com>
Cc: Jerry Brenner <jbrenner@guidewire.com>, pgsql-performance@lists.postgresql.org
Date: 2024-01-02T19:23:36Z
Lists: pgsql-performance
Jeff Janes <jeff.janes@gmail.com> writes:
> On Tue, Jan 2, 2024 at 1:29 PM Jerry Brenner <jbrenner@guidewire.com> wrote:
>> - It looks like "Output" includes more than just the columns with
>> predicates and/or being accessed or returned in other nodes.

> Not in my hands. For SELECTs it just lists the columns that are needed.

It depends.  The planner may choose to tell a non-top-level scan node
to return all columns, in hopes of saving a tuple projection step at
runtime.  That's heuristic and depends on a number of factors, so you
shouldn't count on it happening or not happening.

			regards, tom lane