explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.025 25,337.865 ↑ 103.7 15 1

Sort (cost=244,661.98..244,665.87 rows=1,556 width=220) (actual time=25,337.862..25,337.865 rows=15 loops=1)

  • Sort Key: (sum(b.cost)) DESC
  • Sort Method: quicksort Memory: 32kB
2. 0.111 25,337.840 ↑ 103.7 15 1

Hash Join (cost=244,475.45..244,579.49 rows=1,556 width=220) (actual time=25,337.744..25,337.840 rows=15 loops=1)

  • Hash Cond: (widgets.imb_id = b.imb_id)
3. 78.547 25,228.431 ↑ 9.1 72 1

HashAggregate (cost=238,174.62..238,181.20 rows=658 width=20) (actual time=25,228.401..25,228.431 rows=72 loops=1)

  • Group Key: widgets.imb_id
4. 25,149.884 25,149.884 ↑ 8.7 170,572 1

Index Scan using widgets_date_idx on widgets (cost=0.44..227,008.23 rows=1,488,853 width=12) (actual time=3.156..25,149.884 rows=170,572 loops=1)

  • Index Cond: ((date >= '2019-06-06'::date) AND (date <= '2019-06-11'::date))
  • Filter: (source_id = 12)
  • Rows Removed by Filter: 1488347
5. 0.057 109.298 ↑ 10.8 44 1

Hash (cost=6,294.92..6,294.92 rows=473 width=163) (actual time=109.298..109.298 rows=44 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 17kB
6. 0.064 109.241 ↑ 10.8 44 1

Hash Left Join (cost=4,454.64..6,294.92 rows=473 width=163) (actual time=50.698..109.241 rows=44 loops=1)

  • Hash Cond: (b.imb_id = names.imb_id)
7. 0.177 106.179 ↑ 10.8 44 1

Hash Right Join (cost=4,367.69..6,201.47 rows=473 width=124) (actual time=47.686..106.179 rows=44 loops=1)

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

Nested Loop (cost=3,567.46..5,392.50 rows=132 width=28) (actual time=43.503..104.321 rows=580 loops=1)

9. 28.085 43.582 ↓ 1.0 978 1

HashAggregate (cost=3,567.05..3,576.45 rows=940 width=8) (actual time=43.162..43.582 rows=978 loops=1)

  • Group Key: campaigns.imb_id
10. 15.497 15.497 ↑ 1.0 97,803 1

Seq Scan on campaigns (cost=0.00..3,078.03 rows=97,803 width=8) (actual time=0.008..15.497 rows=97,803 loops=1)

11. 59.658 59.658 ↑ 1.0 1 978

Index Scan using boosts_pkey on campaigns d1 (cost=0.42..1.91 rows=1 width=32) (actual time=0.061..0.061 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.015 1.681 ↑ 10.8 44 1

Hash (cost=794.32..794.32 rows=473 width=100) (actual time=1.681..1.681 rows=44 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
13. 0.233 1.666 ↑ 10.8 44 1

HashAggregate (cost=764.76..789.59 rows=473 width=100) (actual time=1.610..1.666 rows=44 loops=1)

  • Group Key: b.imb_id
  • Filter: (sum(b.ts_clicks) > 0)
14. 1.433 1.433 ↑ 2.7 246 1

Index Scan using boosts_pkey on campaigns b (cost=0.42..730.37 rows=655 width=36) (actual time=0.183..1.433 rows=246 loops=1)

  • Index Cond: ((date >= '2019-06-06'::date) AND (date <= '2019-06-11'::date))
  • Filter: ((ts_id IS NOT NULL) AND (cost > '0'::double precision))
  • Rows Removed by Filter: 1307
15. 0.297 2.998 ↑ 1.0 1,553 1

Hash (cost=67.53..67.53 rows=1,553 width=43) (actual time=2.998..2.998 rows=1,553 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 118kB
16. 2.701 2.701 ↑ 1.0 1,553 1

Seq Scan on campaign_names_groups names (cost=0.00..67.53 rows=1,553 width=43) (actual time=0.604..2.701 rows=1,553 loops=1)

Planning time : 1.205 ms
Execution time : 25,338.050 ms