Re: Remove useless GROUP BY columns considering unique index

From: Zhang Mingli <zmlpostgres(at)gmail(dot)com>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>, David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Remove useless GROUP BY columns considering unique index
Date: 2024-09-23 15:13:57
Message-ID: 1f16fc31-0946-4b9d-8d21-f7d23155872c@Spark
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, all

I haven't paid attention to this topic in a long time, thanks all for the advices, I will study them then update.

Thanks again.

Zhang Mingli
www.hashdata.xyz
On Sep 18, 2024 at 15:50 +0800, David Rowley <dgrowleyml(at)gmail(dot)com>, wrote:
> On Wed, 18 Sept 2024 at 19:28, Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
> >
> > On 12.09.24 03:43, David Rowley wrote:
> > > (Likely it could just look at pg_attribute.attnotnull instead)
> >
> > That won't work because you can't record dependencies on that. (This is
> > one of the reasons for cataloging not-null constraints as real constraints.)
>
> I'm not seeing any need to record constraint dependencies for this
> optimisation. It would be different for detecting functional
> dependencies in a view using a unique constraint+not null constraints
> for ungrouped columns, but that's not what this is. This is just a
> planner optimisation. The plan can be invalidated by a relcache
> invalidation, which will happen if someone does ALTER TABLE DROP NOT
> NULL.
>
> For reference, see 5b736e9cf.
>
> David

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2024-09-23 15:14:15 Re: Proposal to Enable/Disable Index using ALTER INDEX
Previous Message Vladlen Popolitov 2024-09-23 14:47:52 Re: Increase of maintenance_work_mem limit in 64-bit Windows