Re: Removing useless DISTINCT clauses

From: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
To: "Finnerty, Jim" <jfinnert(at)amazon(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Removing useless DISTINCT clauses
Date: 2018-08-23 22:38:47
Message-ID: CAKJS1f83wb3WYHsnqFnv-BXXKDSAJ2SDVXTEWDXRffV2LaoeyA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 24 August 2018 at 03:29, Finnerty, Jim <jfinnert(at)amazon(dot)com> wrote:
> Thank you Álvaro. Here's the distinct_opt_v7 patch.

Determining if there's just 1 base relation by checking the length the
rtable is not a good way. If you want to see why, try creating a
primary key on a partitioned table.

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.

--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2018-08-23 23:34:31 Re: Removing useless DISTINCT clauses
Previous Message David Rowley 2018-08-23 22:22:33 Re: Make executor's Range Table an array instead of a List