Skip to content

Instantly share code, notes, and snippets.

@bcambel
Created November 22, 2015 18:59
Show Gist options
  • Select an option

  • Save bcambel/1845dc2a582338d97a50 to your computer and use it in GitHub Desktop.

Select an option

Save bcambel/1845dc2a582338d97a50 to your computer and use it in GitHub Desktop.
explain analyse
select count(id), country
FROM events where (ts between '2015-09-01' and '2015-10-01') and evt_name='pv'
GROUP BY country
ORDER BY count(id) desc;
Sort (cost=2667410.55..2667410.69 rows=55 width=66) (actual time=148570.492..148570.504 rows=216 loops=1)
Sort Key: (count(id)) DESC
Sort Method: quicksort Memory: 38kB
-> HashAggregate (cost=2667408.41..2667408.96 rows=55 width=66) (actual time=148570.353..148570.416 rows=216 loops=1)
Group Key: country
-> Seq Scan on events (cost=0.00..2512525.94 rows=30976495 width=66) (actual time=0.010..125063.189 rows=30797168 loops=1)
Filter: ((ts >= '2015-09-01 00:00:00'::timestamp without time zone) AND (ts <= '2015-10-01 00:00:00'::timestamp without time zone) AND ((evt_name)::text = 'pv'::text))
Rows Removed by Filter: 8422201
Planning time: 0.194 ms
Execution time: 148570.578 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment