Re: Redundant Unique plan node for table with a unique index

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Damir Belyalov <dam(dot)bel07(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, a(dot)lepikhov(at)postgrespro(dot)ru
Subject: Re: Redundant Unique plan node for table with a unique index
Date: 2023-09-13 13:28:18
Message-ID: 84395D19-2160-4EF7-8D49-708468085F7B@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 13 Sep 2023, at 15:22, Damir Belyalov <dam(dot)bel07(at)gmail(dot)com> wrote:

> There is a table with a unique index on it and we have a query that searching DISTINCT values on this table on columns of unique index.

> We can see that Unique node is redundant for this case. So I implemented a simple patch that removes Unique node from the plan.

Is this query pattern common enough to warrant spending time on in the planner
(are there perhaps ORMs that generate such)? Have you measured the overhead of
this?

--
Daniel Gustafsson

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2023-09-13 13:48:50 Re: [ psql - review request ] review request for \d+ tablename, \d+ indexname indenting
Previous Message Damir Belyalov 2023-09-13 13:22:00 Redundant Unique plan node for table with a unique index