Re: Remove useless GROUP BY columns considering unique index

David Rowley <dgrowleyml@gmail.com>

From: David Rowley <dgrowleyml@gmail.com>
To: jian he <jian.universality@gmail.com>
Cc: Zhang Mingli <zmlpostgres@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-11-29T02:39:03Z
Lists: pgsql-hackers

Attachments

On Fri, 29 Nov 2024 at 15:02, David Rowley <dgrowleyml@gmail.com> wrote:
> I've attached an updated patch that gets rid of the
> get_unique_not_null_attnos() function completely and uses the
> RelOptInfo.indexlist and RelOptInfo.notnullattnums.

I forgot to do a local commit before sending v8. Fixed in the attached v9.

David

Commits

  1. Detect redundant GROUP BY columns using UNIQUE indexes

  2. Defer remove_useless_groupby_columns() work until query_planner()