explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 65ft

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.043 67,386.073 ↑ 120.4 24 1

Sort (cost=1,359,241.39..1,359,248.61 rows=2,889 width=220) (actual time=67,386.069..67,386.073 rows=24 loops=1)

  • Sort Key: (sum(b.cost)) DESC
  • Sort Method: quicksort Memory: 37kB
2. 0.130 67,386.030 ↑ 120.4 24 1

Hash Join (cost=1,358,890.76..1,359,075.32 rows=2,889 width=220) (actual time=67,385.927..67,386.030 rows=24 loops=1)

  • Hash Cond: (widgets.imb_id = b.imb_id)
3. 323.847 67,111.278 ↑ 6.6 123 1

HashAggregate (cost=1,352,086.88..1,352,095.03 rows=815 width=20) (actual time=67,111.247..67,111.278 rows=123 loops=1)

  • Group Key: widgets.imb_id
4. 66,787.431 66,787.431 ↑ 4.6 583,661 1

Index Scan using widgets_pkey on widgets (cost=0.57..1,331,919.62 rows=2,688,968 width=12) (actual time=0.600..66,787.431 rows=583,661 loops=1)

  • Index Cond: ((date >= '2019-05-28'::date) AND (date <= '2019-06-10'::date))
  • Filter: (source_id = 12)
  • Rows Removed by Filter: 2759024
5. 0.073 274.622 ↑ 13.4 53 1

Hash (cost=6,795.02..6,795.02 rows=709 width=163) (actual time=274.622..274.622 rows=53 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 19kB
6. 0.108 274.549 ↑ 13.4 53 1

Hash Left Join (cost=4,892.07..6,795.02 rows=709 width=163) (actual time=200.673..274.549 rows=53 loops=1)

  • Hash Cond: (b.imb_id = names.imb_id)
7. 0.343 272.391 ↑ 13.4 53 1

Hash Right Join (cost=4,805.20..6,698.40 rows=709 width=124) (actual time=198.603..272.391 rows=53 loops=1)

  • Hash Cond: (d1.imb_id = b.imb_id)
8. 0.661 156.322 ↓ 4.4 580 1

Nested Loop (cost=3,559.68..5,439.88 rows=132 width=28) (actual time=80.054..156.322 rows=580 loops=1)

9. 33.440 80.355 ↑ 1.0 978 1

HashAggregate (cost=3,559.26..3,569.04 rows=978 width=8) (actual time=79.699..80.355 rows=978 loops=1)

  • Group Key: campaigns.imb_id
10. 46.915 46.915 ↓ 1.0 97,542 1

Seq Scan on campaigns (cost=0.00..3,072.84 rows=97,284 width=8) (actual time=0.281..46.915 rows=97,542 loops=1)

11. 75.306 75.306 ↑ 1.0 1 978

Index Scan using boosts_pkey on campaigns d1 (cost=0.42..1.89 rows=1 width=32) (actual time=0.077..0.077 rows=1 loops=978)

  • Index Cond: ((date = (max(campaigns.date))) AND (imb_id = campaigns.imb_id))
  • Filter: (bid IS NOT NULL)
  • Rows Removed by Filter: 0
12. 0.029 115.726 ↑ 13.4 53 1

Hash (cost=1,236.66..1,236.66 rows=709 width=100) (actual time=115.726..115.726 rows=53 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 16kB
13. 0.679 115.697 ↑ 13.4 53 1

HashAggregate (cost=1,192.34..1,229.57 rows=709 width=100) (actual time=115.634..115.697 rows=53 loops=1)

  • Group Key: b.imb_id
  • Filter: (sum(b.ts_clicks) > 0)
  • Rows Removed by Filter: 2
14. 115.018 115.018 ↑ 2.5 509 1

Index Scan using boosts_pkey on campaigns b (cost=0.42..1,126.56 rows=1,253 width=36) (actual time=3.752..115.018 rows=509 loops=1)

  • Index Cond: ((date >= '2019-05-28'::date) AND (date <= '2019-06-10'::date))
  • Filter: ((ts_id IS NOT NULL) AND (cost > '0'::double precision))
  • Rows Removed by Filter: 3005
15. 0.360 2.050 ↑ 1.0 1,550 1

Hash (cost=67.50..67.50 rows=1,550 width=43) (actual time=2.050..2.050 rows=1,550 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 118kB
16. 1.690 1.690 ↑ 1.0 1,550 1

Seq Scan on campaign_names_groups names (cost=0.00..67.50 rows=1,550 width=43) (actual time=0.013..1.690 rows=1,550 loops=1)

Planning time : 3.102 ms
Execution time : 67,386.309 ms