Re: slow count in window query

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: slow count in window query
Дата
Msg-id 4A6059B30200002500028918@gw.wicourts.gov
обсуждение исходный текст
Ответ на Re: slow count in window query  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: slow count in window query  (Hitoshi Harada <umi.tanuki@gmail.com>)
Список pgsql-hackers
Pavel Stehule <pavel.stehule@gmail.com> wrote:
> table was filled with random numbers and analyzed - you can simple
> check it - look on begin of the thread. This table wasn't updated.
Confirmed.  The ORDER BY consistently speeds up the query.  Odd....
Sort speed varied based on random sequence generated, but typical
plan and timings:
test=# explain analyze select count(*) over () from x;WindowAgg  (cost=0.00..229.00 rows=10000 width=0) (actual
time=32.435..97.448 rows=10000 loops=1)  ->  Seq Scan on x  (cost=0.00..104.00 rows=10000 width=0) (actual
time=0.007..14.818 rows=10000 loops=1)Total runtime: 112.526 ms

test=# explain analyze select count(*) over (order by a) from x;WindowAgg  (cost=768.39..943.39 rows=10000 width=4)
(actual
time=34.982..87.803 rows=10000 loops=1)  ->  Sort  (cost=768.39..793.39 rows=10000 width=4) (actual
time=34.962..49.533 rows=10000 loops=1)        Sort Key: a        Sort Method:  quicksort  Memory: 491kB        ->  Seq
Scanon x  (cost=0.00..104.00 rows=10000 width=4)
 
(actual time=0.006..14.682 rows=10000 loops=1)Total runtime: 102.023 ms
-Kevin


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

Предыдущее
От: Fernando Ike
Дата:
Сообщение: Re: [PATCH] Psql List Languages
Следующее
От: "Dickson S. Guedes"
Дата:
Сообщение: Re: Duplicate key value error