Re: BUG #11803: avoid "distinct" logic if "limit 1" specified - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #11803: avoid "distinct" logic if "limit 1" specified
Date
Msg-id 30634.1414524443@sss.pgh.pa.us
Whole thread Raw
In response to BUG #11803: avoid "distinct" logic if "limit 1" specified  (socketpair@gmail.com)
List pgsql-bugs
socketpair@gmail.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

pgsql-bugs by date:

Previous
From: djlu126@126.com
Date:
Subject: BUG #11804: The delete rule problem
Next
From: Tom Lane
Date:
Subject: Re: BUG #11804: The delete rule problem