EXPLAIN ANALYZE SELECT s.slug, s.name FROM reports_report AS r INNER JOIN reports_aspect AS a ON r.aspect_id = a.id INNER JOIN reports_site AS s ON s.id=r.site_id WHERE a.slug = 'txpower' GROUP BY s.slug, s.name; QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------- HashAggregate (cost=13272.45..13272.45 rows=33 width=25) (actual time=1556.508..1556.559 rows=33 loops=1) -> Hash Join (cost=2.60..13155.87 rows=23316 width=25) (actual time=0.499..1278.358 rows=35003 loops=1) Hash Cond: ("outer".site_id = "inner".id) -> Hash Join (cost=1.19..12746.42 rows=23316 width=4) (actual time=0.270..1130.558 rows=35003 loops=1) Hash Cond: ("outer".aspect_id = "inner".id) -> Seq Scan on reports_report (cost=0.00..10763.38 rows=349738 width=8) (actual time=0.060..805.790 rows=349738 loops=1) -> Hash (cost=1.19..1.19 rows=1 width=4) (actual time=0.113..0.113 rows=0 loops=1) -> Seq Scan on reports_aspect reports_report__aspect (cost=0.00..1.19 rows=1 width=4) (actual time=0.099..0.105 rows=1 loops=1) Filter: ((slug)::text = 'txpower'::text) -> Hash (cost=1.33..1.33 rows=33 width=29) (actual time=0.205..0.205 rows=0 loops=1) -> Seq Scan on reports_site (cost=0.00..1.33 rows=33 width=29) (actual time=0.098..0.163 rows=33 loops=1) Total runtime: 1556.768 ms (12 rows)