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

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: yaojia_0809(at)163(dot)com
Subject: BUG #19372: Scan operator maybe output unnecessary columns to the upper-layer operators
Date: 2026-01-07 08:11:02
Message-ID: 19372-4692c7e7044c10ef@postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 19372
Logged by: yao jia
Email address: yaojia_0809(at)163(dot)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

Responses

Browse pgsql-bugs by date

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