explain.depesz.com

PostgreSQL's explain analyze made readable

Result: SdSy : Optimization for: Optimization for: Optimization for: Optimization for: plan #LaHU; plan #IaEQ; plan #ewLA; plan #ZqOR

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.092 989.937 ↑ 29.6 72 1

Sort (cost=177,771.97..177,777.30 rows=2,134 width=220) (actual time=989.931..989.937 rows=72 loops=1)

  • Sort Key: (sum(b.cost)) DESC
  • Sort Method: quicksort Memory: 62kB
2. 0.219 989.845 ↑ 29.6 72 1

Hash Join (cost=177,516.21..177,653.96 rows=2,134 width=220) (actual time=989.642..989.845 rows=72 loops=1)

  • Hash Cond: (widgets.imb_id = b.imb_id)
3. 330.355 959.675 ↑ 3.9 176 1

HashAggregate (cost=171,875.79..171,882.63 rows=684 width=20) (actual time=959.649..959.675 rows=176 loops=1)

  • Group Key: widgets.imb_id
4. 629.320 629.320 ↓ 1.3 1,772,282 1

Index Scan using widgets_date_idx on widgets (cost=0.44..161,768.38 rows=1,347,655 width=12) (actual time=0.012..629.320 rows=1,772,282 loops=1)

  • Index Cond: ((date >= '2019-04-28'::date) AND (date <= '2019-05-10'::date))
  • Filter: (source_id = 12)
  • Rows Removed by Filter: 9099
5. 0.042 29.951 ↑ 7.8 80 1

Hash (cost=5,632.62..5,632.62 rows=624 width=163) (actual time=29.951..29.951 rows=80 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 25kB
6. 0.046 29.909 ↑ 7.8 80 1

Hash Left Join (cost=4,200.21..5,632.62 rows=624 width=163) (actual time=27.845..29.909 rows=80 loops=1)

  • Hash Cond: (b.imb_id = names.imb_id)
7. 0.080 29.287 ↑ 7.8 80 1

Hash Right Join (cost=4,153.77..5,577.61 rows=624 width=124) (actual time=27.248..29.287 rows=80 loops=1)

  • Hash Cond: (d1.imb_id = b.imb_id)
8. 0.000 26.234 ↓ 4.5 580 1

Nested Loop (cost=3,152.06..4,564.80 rows=128 width=28) (actual time=24.228..26.234 rows=580 loops=1)

9. 15.357 24.343 ↓ 1.1 978 1

HashAggregate (cost=3,151.77..3,161.07 rows=930 width=8) (actual time=24.217..24.343 rows=978 loops=1)

  • Group Key: campaigns.imb_id
10. 8.986 8.986 ↑ 1.0 94,318 1

Seq Scan on campaigns (cost=0.00..2,680.18 rows=94,318 width=8) (actual time=0.017..8.986 rows=94,318 loops=1)

11. 1.956 1.956 ↑ 1.0 1 978

Index Scan using boosts_pkey on campaigns d1 (cost=0.29..1.49 rows=1 width=32) (actual time=0.002..0.002 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.031 2.973 ↑ 7.8 80 1

Hash (cost=993.91..993.91 rows=624 width=100) (actual time=2.973..2.973 rows=80 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 19kB
13. 0.571 2.942 ↑ 7.8 80 1

HashAggregate (cost=954.91..987.67 rows=624 width=100) (actual time=2.854..2.942 rows=80 loops=1)

  • Group Key: b.imb_id
  • Filter: (sum(b.ts_clicks) > 0)
  • Rows Removed by Filter: 4
14. 2.371 2.371 ↑ 1.6 640 1

Index Scan using boosts_pkey on campaigns b (cost=0.29..900.89 rows=1,029 width=36) (actual time=0.243..2.371 rows=640 loops=1)

  • Index Cond: ((date >= '2019-04-28'::date) AND (date <= '2019-05-10'::date))
  • Filter: ((ts_id IS NOT NULL) AND (cost > '0'::double precision))
  • Rows Removed by Filter: 2135
15. 0.314 0.576 ↑ 1.0 1,486 1

Hash (cost=27.86..27.86 rows=1,486 width=43) (actual time=0.576..0.576 rows=1,486 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 114kB
16. 0.262 0.262 ↑ 1.0 1,486 1

Seq Scan on campaign_names_groups names (cost=0.00..27.86 rows=1,486 width=43) (actual time=0.018..0.262 rows=1,486 loops=1)

Planning time : 0.757 ms
Execution time : 990.528 ms