From: | David Rowley <dgrowleyml(at)gmail(dot)com> |
---|---|
To: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
Cc: | Zhang Mingli <zmlpostgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Remove useless GROUP BY columns considering unique index |
Date: | 2024-09-18 07:50:15 |
Message-ID: | CAApHDvouQQmCqTgSH=a1MqemC6pGGD0b7XZ35pozEN0-m7yPyA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2024-09-18 07:53:11 | Re: Remove shadowed declaration warnings |
Previous Message | Anthonin Bonnefoy | 2024-09-18 07:42:43 | Re: [PATCH] Add additional extended protocol commands to psql: \parse and \bind |