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

Started by Марк Коренбергover 11 years ago2 messagesbugs
Jump to latest
#1Марк Коренберг
socketpair@gmail.com

The following bug has been logged on the website:

Bug reference: 11803
Logged by: Korenberg Mark
Email address: socketpair@gmail.com
PostgreSQL version: 9.3.1
Operating system: Linux
Description:

In other words,

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)
-----------------------
https://github.com/ponyorm/pony/issues/90
http://doc.ponyorm.com/queries.html#comment-1654734639

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Марк Коренберг (#1)
Re: BUG #11803: avoid "distinct" logic if "limit 1" specified

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

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs