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