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

Поиск
Список
Период
Сортировка
От Dave Dutcher
Тема Re: select max() much slower than select min()
Дата
Msg-id 61EE390C385F40A599EF08D89A4D2BC5@tridecap.com
обсуждение исходный текст
Ответ на select max() much slower than select min()  (Brian Cox <brian.cox@ca.com>)
Список pgsql-performance
> -----Original Message-----
> From: Brian Cox
> Subject: [PERFORM] select max() much slower than select min()
>

> seems like max() shouldn't take any longer than min() and
> certainly not 10 times as long. Any ideas on how to determine
> the max more quickly?


That is odd.  It seems like max should actually have to scan fewer rows than
min should.  It might still be bloat in the table, because unless you did
VACUUM FULL there could still be dead rows.  A vacuum verbose would show if
there is bloat or not.  Also maybe you could try a two column index like
this:

create index test_index on ts_stats_transet_user_interval
(ts_interval_start_time, ts_id);


Dave



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

Предыдущее
От: Kenneth Marshall
Дата:
Сообщение: Re: 8.4 COPY performance regression on Solaris
Следующее
От: Tom Lane
Дата:
Сообщение: Re: select max() much slower than select min()