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

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: BUG #19372: Scan operator maybe output unnecessary columns to the upper-layer operators
Дата
Msg-id CAApHDvqaxvdvwe1ZZrTjRZsrkpzEtKq8QyPAmLH24rCP887ToQ@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #19372: Scan operator maybe output unnecessary columns to the upper-layer operators  (PG Bug reporting form <noreply@postgresql.org>)
Список pgsql-bugs
On Wed, 7 Jan 2026 at 21:49, PG Bug reporting form
<noreply@postgresql.org> wrote:
> 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?

It's working as intended. This is useful for HeapAm as TupleTableSlots
can carry a pointer to the tuple on the page and deform only up to the
last column that's required.  If you want the Seq Scan to only have
the columns required at the scan level, then that requires a
projection operation at the scan level. In your query, only columns 1
and 2 will be deformed from the tuple and that'll happen during the
HashAggregate. No tuple deformation is required before that in your
query.

Where this behaviour isn't ideal is for table AMs such as column
stores. Ideally, we'd leave this up to the table AM to state if it's
useful or not, but we currently don't have that ability. I'm surprised
nobody has asked for that yet.

David



В списке pgsql-bugs по дате отправления: