Re: BUG #11803: avoid "distinct" logic if "limit 1" specified

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: socketpair(at)gmail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #11803: avoid "distinct" logic if "limit 1" specified
Date: 2014-10-28 19:27:23
Message-ID: 30634.1414524443@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

socketpair(at)gmail(dot)com writes:
> query:
> select * from tablename order by id limit 1

> and query:
> select distinct * from tablename order by id limit 1

> should be planned exactly (as if distinct was not specified)

Seems like a waste of planning cycles to check for this.
The uniquification step isn't going to take enough time to be
an issue, if only one input row arrives. On the other hand,
the added planning logic would contribute some small overhead
to *every* query using DISTINCT.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2014-10-28 19:46:37 Re: BUG #11804: The delete rule problem
Previous Message piuschan 2014-10-28 18:25:29 Re: BUG #11811: Server segfault with many subpartitions when using nestloop