I look on a Postgres query plan and I noticed that the upper step start time is not overlap with the lower step end time, so I wonder where the gap time is spent?
fields name were edited for this query.
As you can see below the query executer has 2 steps. The lower step 'Index Scan' end at 5730.776 (actual time), but the root step begin on 19199.316 (actual time). My question is what was happened between 5730.776 to 19199.316 ?
postgres 9.1
explain analyze select a_id,b_id,c_id,d_id,e_id,mydate, f,sum(used) used
from report A where mydate >= '2013-05-01' and mydate <= '2013-08-30'
group by a_id,b_id,c_id,d_id,e_id,date,f;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
HashAggregate (cost=412378.59..418074.28 rows=569569 width=70) (actual time=**19199.316**..25518.672 rows=4935988 loops=1)
-> Index Scan using report_dateonly_idx on report a (cost=0.00..298464.83 rows=5695688 width=70) (actual time=0.033..**5730.776** rows=5816028 loops=1)
Index Cond: ((date >= '2013-05-01 00:00:00'::timestamp without time zone) AND (date <= '2013-08-30 00:00:00'::timestamp without time zone))
Total runtime: 29148.500 ms