Re: optimize query with a maximum(date) extraction

Поиск
Список
Период
Сортировка
От Gregory Stark
Тема Re: optimize query with a maximum(date) extraction
Дата
Msg-id 87tzq9p4x0.fsf@oxford.xeocode.com
обсуждение исходный текст
Ответ на Re: optimize query with a maximum(date) extraction  ("Peter Childs" <peterachilds@gmail.com>)
Список pgsql-performance
"Peter Childs" <peterachilds@gmail.com> writes:

> My personal reaction is why are you using distinct at all?
>
> why not
>
> select id,
>        min(the_date) as min_date,
>        max(the_date) as max_date
>   from my_table group by id;
>
> Since 8.0 or was it earlier this will use an index should a reasonable one
> exist.

That's not true for this query. In fact that was precisely the original query
he as looking to optimize.


--
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com

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

Предыдущее
От: Gregory Stark
Дата:
Сообщение: Re: optimize query with a maximum(date) extraction
Следующее
От: Gregory Stark
Дата:
Сообщение: Re: optimize query with a maximum(date) extraction