Re: Remove useless GROUP BY columns considering unique index
jian he <jian.universality@gmail.com>
From: jian he <jian.universality@gmail.com>
To: Andrei Lepikhov <lepihov@gmail.com>
Cc: David Rowley <dgrowleyml@gmail.com>, Zhang Mingli <zmlpostgres@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-11-29T07:04:16Z
Lists: pgsql-hackers
Attachments
- v10-0001-remove-useless-group-by-columns-via-unique-not-n.patch (text/x-patch) patch v10-0001
On Fri, Nov 29, 2024 at 2:36 PM Andrei Lepikhov <lepihov@gmail.com> wrote:
>
> > I forgot to do a local commit before sending v8. Fixed in the attached v9.
> 1. Thread reference in the patch comment doesn't work.
fixed.
I found that unique expression index can also be used for groupby
column removal.
so I implemented it, aslo added two tests on it.
now remove_useless_groupby_columns like:
if (index->indexprs == NIL)
{
--handle unique index
}
else
{
--handle unique expression index
}
what do you think?
Commits
-
Detect redundant GROUP BY columns using UNIQUE indexes
- bd10ec529796 18.0 landed
-
Defer remove_useless_groupby_columns() work until query_planner()
- 430a5952deb3 18.0 landed