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

From Stephen Frost
Subject Re: Removing useless DISTINCT clauses
Date
Msg-id 20180823233430.GG3326@tamriel.snowman.net
Whole thread Raw
In response to Re: Removing useless DISTINCT clauses  (David Rowley <david.rowley@2ndquadrant.com>)
Responses Re: Removing useless DISTINCT clauses
List pgsql-hackers
Greetings,

* David Rowley (david.rowley@2ndquadrant.com) wrote:
> My personal opinion of only being able to completely remove the
> DISTINCT when there's a single item in the rtable (or a single base
> table) is that it's just too poor to bother with.  I think such a
> solution is best left to another patch and it should be much more
> complete and be able to track the unique properties through joins.

Doesn't that move the goalposts for this pretty far off?  Is there
some reason that doing this for the single-item case will make it
difficult to implement the additional improvements you're suggesting
later?

Given the cost of a DISTINCT and that we know pretty easily if one
exists or not, trying to eliminate it, even in the single-item case,
seems pretty worthwhile to me.  If it makes it difficult to improve on
this later then I could see pushing back on it, but this patch doesn't
seem like its doing that.

Thanks!

Stephen

Attachment

pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Removing useless DISTINCT clauses
Next
From: David Rowley
Date:
Subject: Re: Removing useless DISTINCT clauses