Re: Removing useless DISTINCT clauses - Mailing list pgsql-hackers

From Laurenz Albe
Subject Re: Removing useless DISTINCT clauses
Date
Msg-id 1521706612.2459.27.camel@cybertec.at
Whole thread Raw
In response to Re: Removing useless DISTINCT clauses  (Melanie Plageman <melanieplageman@gmail.com>)
Responses Re: Removing useless DISTINCT clauses  (David Rowley <david.rowley@2ndquadrant.com>)
List pgsql-hackers
Melanie Plageman wrote:
> Contents & Purpose
> ==================
> 
> This patch removes any additional columns in the DISTINCT clause when the
> table's primary key columns are entirely present in the DISTINCT clause. This
> optimization works because the PK columns functionally determine the other
> columns in the relation. The patch includes regression test cases.

Would it be very difficult to extend that to "if any unique constraints are
contained in the DISTINCT clause"?

Yours,
Laurenz Albe


pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: [HACKERS] MERGE SQL Statement for PG11
Next
From: Jaime Soler
Date:
Subject: Re: Hash join in SELECT target list expression keeps consuming memory