Re: remove_useless_groupby_columns is too enthusiastic

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: remove_useless_groupby_columns is too enthusiastic
Date: 2022-07-13 04:06:51
Message-ID: CAApHDvozVPAYSL6h50YQ9_k3K3-0axYEgBVdr9TAKdRiM0k5hQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 13 Jul 2022 at 05:31, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I tried the attached quick-hack patch that just prevents
> remove_useless_groupby_columns from removing anything that
> appears in ORDER BY. That successfully fixes the complained-of
> case, and it doesn't change any existing regression test results.
> I'm not sure whether there are any cases that it makes significantly
> worse.

In addition to this, we also do a pre-verification step to see if the
ORDER BY has anything in it that the GROUP BY does not?

I don't think there's any harm in removing the GROUP BY item if the
pre-check finds something extra in ORDER BY since
preprocess_groupclause() is going to fail in that case anyway.

David

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2022-07-13 04:13:58 Re: PG15 beta1 sort performance regression due to Generation context change
Previous Message Dilip Kumar 2022-07-13 04:05:54 Re: making relfilenodes 56 bits