Re: Aggregate leads to superfluous projection from the scan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ibrar Ahmed <ibrar(dot)ahmad(at)gmail(dot)com>
Cc: Zhihong Yu <zyu(at)yugabyte(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Aggregate leads to superfluous projection from the scan
Date: 2022-07-08 19:30:30
Message-ID: 3479243.1657308630@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ibrar Ahmed <ibrar(dot)ahmad(at)gmail(dot)com> writes:
> I give a quick look and I think in case whenever data is extracted from the
> heap it shows all the columns. Therefore when columns are extracted from
> the index only it shows the indexed column only.

This is operating as designed, and I don't think that the proposed
patch is an improvement. The point of use_physical_tlist() is that
returning all the columns is cheaper because it avoids a projection
step. That's true for any case where we have to fetch the heap
tuple, so IndexScan is included though IndexOnlyScan is not.

Now, that's something that was true a decade or more ago.
There's been considerable discussion recently about cases where
it's not true anymore, for example with columnar storage or FDWs,
and so we ought to invent a way to prevent createplan.c from
doing it when it would be counterproductive. But just summarily
turning it off is not an improvement.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2022-07-08 19:32:56 Re: System catalog documentation chapter
Previous Message Alexander Korotkov 2022-07-08 19:01:24 Re: Add red-black tree missing comparison searches