Re: Help with unpredictable use of indexes on large tables...

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Help with unpredictable use of indexes on large tables...
Дата
Msg-id 26090.1146338614@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Help with unpredictable use of indexes on large tables...  ("John D. Burger" <john@mitre.org>)
Список pgsql-general
"John D. Burger" <john@mitre.org> writes:
> Tom Lane wrote:
>> Also I'd suggest trying
>> select year from [table] group by year
>> which is capable of using a hash aggregation approach; that will likely
>> beat either of these plans.

> Just out of curiosity, why doesn't the planner consider the same plan
> for the OP's original query:
>    select distinct year from [table]
> Aren't these equivalent (except for the order)?

Mainly just that the DISTINCT code hasn't been rewritten to consider the
possibility.  The current implementation of DISTINCT is pretty tightly
intertwined with ORDER BY; I think it would take some serious hacking to
disentangle the two, and no one's got round to it.

            regards, tom lane

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

Предыдущее
От: Terry Lee Tucker
Дата:
Сообщение: Re: file I/O in plpgsql
Следующее
От: "Dan Black"
Дата:
Сообщение: how can i view deleted records?