BUG #19372: Scan operator maybe output unnecessary columns to the upper-layer operators - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #19372: Scan operator maybe output unnecessary columns to the upper-layer operators
Date
Msg-id 19372-4692c7e7044c10ef@postgresql.org
Whole thread Raw
Responses Re: BUG #19372: Scan operator maybe output unnecessary columns to the upper-layer operators
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      19372
Logged by:          yao jia
Email address:      yaojia_0809@163.com
PostgreSQL version: 18.0
Operating system:   linux  centos
Description:

The scan operator maybe output unnecessary columns to the upper-layer
operators. This seems like redundant work because the upper-layer operators
don't need these column data at all. This undoubtedly increases execution
overhead.
Is this behavior intentionally designed this way, or is it an unintended
side effect? Should the unnecessary column output be eliminated?

Here is a specific example:columns [jname, c, d, e] are useless for group
and final output, but they are in seqscan's output
postgres=# create table hash_hash_jade22 (hjid int,rjid int,jname varchar, c
varchar, d varchar, e varchar);
CREATE TABLE
postgres=# explain verbose select min(hjid) from hash_hash_jade22 group by
rjid;
                                   QUERY PLAN
--------------------------------------------------------------------------------
 HashAggregate  (cost=17.35..19.35 rows=200 width=8)
   Output: min(hjid), rjid
   Group Key: hash_hash_jade22.rjid
   ->  Seq Scan on public.hash_hash_jade22  (cost=0.00..14.90 rows=490
width=8)
         Output: hjid, rjid, jname, c, d, e


pgsql-bugs by date:

Previous
From: Andres Freund
Date:
Subject: Re: BUG #19370: PG18 returns incorrect array slice results when slice bounds depend on another array expression
Next
From: David Rowley
Date:
Subject: Re: BUG #19372: Scan operator maybe output unnecessary columns to the upper-layer operators