Re: select max() much slower than select min()

Поиск
Список
Период
Сортировка
От David Rees
Тема Re: select max() much slower than select min()
Дата
Msg-id 72dbd3150906191341s74629514w12e201740088dfe8@mail.gmail.com
обсуждение исходный текст
Ответ на Re: select max() much slower than select min()  (Brian Cox <brian.cox@ca.com>)
Список pgsql-performance
On Fri, Jun 19, 2009 at 1:05 PM, Brian Cox<brian.cox@ca.com> wrote:
> Thanks to all for the analysis and suggestions. Since the number of rows in
> an hour < ~500,000, brute force looks to be a fast solution:
>
> select ts_id from ... where ts_interval_start_time >= ... and ...
>
> This query runs very fast as does a single pass through the ids to find the
> min and max.

Along those lines, couldn't you just have the DB do the work?

select max(ts_id), min(ts_id) from ... where ts_interval_start_time >=
... and ...

Then you don't have to transfer 500k ids across the network...

-Dave

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

Предыдущее
От: Brian Cox
Дата:
Сообщение: Re: select max() much slower than select min()
Следующее
От: Brian Cox
Дата:
Сообщение: Re: select max() much slower than select min()