Обсуждение: BUG #11803: avoid "distinct" logic if "limit 1" specified

Поиск
Список
Период
Сортировка

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

От
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

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

От
Tom Lane
Дата:
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