From: | David Rowley <dgrowleyml(at)gmail(dot)com> |
---|---|
To: | jian he <jian(dot)universality(at)gmail(dot)com> |
Cc: | Andrei Lepikhov <lepihov(at)gmail(dot)com>, 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-11-29 09:20:09 |
Message-ID: | CAApHDvot=SgDX5euFs-GwS+mBF-N_HES0LXyip=FxgqBaAaWWg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, 29 Nov 2024 at 20:04, jian he <jian(dot)universality(at)gmail(dot)com> wrote:
> I found that unique expression index can also be used for groupby
> column removal.
> so I implemented it, aslo added two tests on it.
> what do you think?
I think it's likely just not common enough to be worthwhile, plus,
unfortunately, I don't think this optimisation is possible with what
we have today. Also, if it were possible you'd need to check the GROUP
BY expressions match the indexed expressions. You've not done that.
The reason I don't think is possible is that we have no infrastructure
that allows us to tag functions or operators so that non-null input(s)
mean non-null outputs. We only have strict, which means null input
means null output. That's the opposite of what we'd need. It might
only be possible with a NULLS NOT DISTINCT index.
David
From | Date | Subject | |
---|---|---|---|
Next Message | Andrey M. Borodin | 2024-11-29 09:41:56 | Re: [PATCH] Add sortsupport for range types and btree_gist |
Previous Message | Guillaume Lelarge | 2024-11-29 08:43:21 | Re: Logging parallel worker draught |