explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.067 706.346 ↑ 18.9 26 1

Sort (cost=12,053.17..12,054.40 rows=492 width=220) (actual time=706.344..706.346 rows=26 loops=1)

  • Sort Key: (sum(b.cost)) DESC
  • Sort Method: quicksort Memory: 38kB
2. 0.110 706.279 ↑ 18.9 26 1

Hash Left Join (cost=10,582.40..12,031.17 rows=492 width=220) (actual time=703.118..706.279 rows=26 loops=1)

  • Hash Cond: (b.imb_id = names.imb_id)
3. 0.051 705.678 ↑ 18.9 26 1

Hash Join (cost=10,535.96..11,966.90 rows=492 width=140) (actual time=702.572..705.678 rows=26 loops=1)

  • Hash Cond: (b.imb_id = imb.imb_id)
4. 0.077 27.526 ↑ 3.3 44 1

Hash Right Join (cost=3,383.39..4,796.81 rows=144 width=124) (actual time=24.424..27.526 rows=44 loops=1)

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

Nested Loop (cost=3,155.70..4,568.43 rows=128 width=28) (actual time=24.063..27.128 rows=580 loops=1)

6. 16.655 24.290 ↓ 1.1 978 1

HashAggregate (cost=3,155.41..3,164.71 rows=930 width=8) (actual time=24.051..24.290 rows=978 loops=1)

  • Group Key: campaigns.imb_id
7. 7.635 7.635 ↓ 1.0 94,443 1

Seq Scan on campaigns (cost=0.00..2,683.27 rows=94,427 width=8) (actual time=0.018..7.635 rows=94,443 loops=1)

8. 2.934 2.934 ↑ 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.003 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
9. 0.016 0.321 ↑ 3.3 44 1

Hash (cost=225.90..225.90 rows=144 width=100) (actual time=0.321..0.321 rows=44 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
10. 0.127 0.305 ↑ 3.3 44 1

HashAggregate (cost=216.90..224.46 rows=144 width=100) (actual time=0.272..0.305 rows=44 loops=1)

  • Group Key: b.imb_id
  • Filter: (sum(b.ts_clicks) > 0)
11. 0.178 0.178 ↓ 1.0 157 1

Index Scan using boosts_pkey on campaigns b (cost=0.29..208.71 rows=156 width=36) (actual time=0.078..0.178 rows=157 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: 226
12. 0.011 678.101 ↑ 26.3 26 1

Hash (cost=7,144.03..7,144.03 rows=683 width=20) (actual time=678.101..678.101 rows=26 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
13. 0.004 678.090 ↑ 26.3 26 1

Subquery Scan on imb (cost=7,130.37..7,144.03 rows=683 width=20) (actual time=678.083..678.090 rows=26 loops=1)

14. 304.124 678.086 ↑ 26.3 26 1

HashAggregate (cost=7,130.37..7,137.20 rows=683 width=20) (actual time=678.082..678.086 rows=26 loops=1)

  • Group Key: widgets.imb_id
15. 373.962 373.962 ↓ 300.1 1,383,231 1

Index Scan using widgets_date_source_id_idx on widgets (cost=0.44..7,095.80 rows=4,610 width=12) (actual time=0.085..373.962 rows=1,383,231 loops=1)

  • Index Cond: ((date >= '2019-06-06'::date) AND (date <= '2019-06-11'::date) AND (source_id = 30))
16. 0.288 0.491 ↑ 1.0 1,486 1

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

  • Buckets: 2048 Batches: 1 Memory Usage: 114kB
17. 0.203 0.203 ↑ 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.019..0.203 rows=1,486 loops=1)