Re: Missing Group Key in grouped aggregate - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Missing Group Key in grouped aggregate
Date
Msg-id 185735.1708444438@sss.pgh.pa.us
Whole thread Raw
In response to Missing Group Key in grouped aggregate  (Erik Nordström <erik@timescale.com>)
Responses Re: Missing Group Key in grouped aggregate
List pgsql-hackers
=?UTF-8?Q?Erik_Nordstr=C3=B6m?= <erik@timescale.com> writes:
> I noticed that, beginning with PG16, grouped aggregates are missing the
> "Group Key" in the EXPLAIN output.

> It seems the Agg node has numCols (number of grouping cols) set to zero in
> queries like

> SELECT foo, count(*) FROM bar WHERE foo=1 GROUP BY foo;

> In PG15, the "Group Key" is shown and the Agg node has numCols set as
> expected.

Looks sane to me: the planner now notices that there can only
be one group so it doesn't tell the GroupAgg node to worry about
making groups.  If it were missing in a case where there could be
multiple output groups, yes that'd be a bug.

If you want to run it to ground you could bisect to see where the
behavior changed, but you'd probably just find it was intentional.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Change the bool member of the Query structure to bits
Next
From: Bertrand Drouvot
Date:
Subject: Re: Injection points: some tools to wait and wake