EXPLAIN and HashAggregate

Поиск
Список
Период
Сортировка
От Stefan Kaltenbrunner
Тема EXPLAIN and HashAggregate
Дата
Msg-id 4409EC5D.7060307@kaltenbrunner.cc
обсуждение исходный текст
Ответы Re: EXPLAIN and HashAggregate  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
While playing around with large work_mem(or in that case a bit insane)
and maintenance_work_mem settings I noticed that EXPLAIN behaves quite
weird:

foo=# set work_mem to 200000;
SET
Time: 0.187 ms
foo=# explain select count(*) from testtable2 group by a;                                   QUERY PLAN


--------------------------------------------------------------------------------
---GroupAggregate  (cost=8845616.04..9731787.89 rows=37349188 width=4)  ->  Sort  (cost=8845616.04..8985385.04
rows=55907600width=4)        Sort Key: a        ->  Seq Scan on testtable2  (cost=0.00..1088488.00
 
rows=55907600 width=
4)
(4 rows)

Time: 0.364 ms
foo=# set work_mem to 2500000;
SET
Time: 0.195 ms
foo=# explain select count(*) from testtable2 group by a;                                QUERY PLAN

-----------------------------------------------------------------------------HashAggregate
(cost=1368026.00..1834890.85rows=37349188 width=4)  ->  Seq Scan on testtable2  (cost=0.00..1088488.00 rows=55907600
width=4)
(2 rows)

Time: 615.108 ms


it looks like that postgresql is actually allocating the memory for thehashtable of the HashAggregate which is a bit
unexpectedfor a plain
 
EXPLAIN.


Stefan


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

Предыдущее
От: Hannu Krosing
Дата:
Сообщение: Re: Constraint Exclusion and Partition Locking
Следующее
От: Tom Lane
Дата:
Сообщение: Re: problem with large maintenance_work_mem settings and