QUERY PLAN ---------------------------------------------------------------------------------------------------- HashAggregate (cost=9058.48..17448.32 rows=108256 width=66) Group By: id Rows out: 100000 rows with 460 ms to first row, 1014 ms to end, start offset by 0.120 ms. Executor memory: 110093K bytes. -> Seq Scan on test_group (cost=0.00..1480.56 rows=108256 width=66) Rows out: 100000 rows with 0.019 ms to first row, 52 ms to end, start offset by 0.554 ms. Slice statistics: (slice0) Executor memory: 110271K bytes. Settings: enable_groupagg=off; enable_hashagg=on; enable_seqscan=off; work_mem=320000kB Total runtime: 1038.209 ms (10 rows)