Re: SELECT DISTINCT

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: SELECT DISTINCT
Дата
Msg-id 21678.1358470964@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: SELECT DISTINCT  ("Kevin Grittner" <kgrittn@mail.com>)
Ответы Re: SELECT DISTINCT  (salah jubeh <s_jubeh@yahoo.com>)
Список pgsql-general
"Kevin Grittner" <kgrittn@mail.com> writes:
> salah jubeh wrote:
>> I think any query that returns a unique column (primary key,
>> unique) which is not duplicated in some way (join) can use this
>> optimisation technique.

> I agree that if the planner searched for that, there would be cases
> where the DISTINCT keyword could be determined to be a noise word.
> The problem with that is that such searching in the planner would
> not be free -- doing it accurately would increase planning cost for
> every query which was legitimately using the feature.

There is actually infrastructure in the planner that could be used for
this, at least for the case where the query selects from just one base
table.  I tend to agree though that adding such a check to every
DISTINCT query would be slowing everybody down to benefit only dubious
queries.  It would be easier to swallow the overhead if there were a
solid case that reasonably-written queries might sometimes need the
optimization.

            regards, tom lane


В списке pgsql-general по дате отправления:

Предыдущее
От: "Kevin Grittner"
Дата:
Сообщение: Re: SELECT DISTINCT
Следующее
От: Bartosz Dmytrak
Дата:
Сообщение: Functions not visible in pg_stat_user_functions view