explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.200 17,170.079 ↑ 61.0 26 1

Sort (cost=69,503.18..69,507.15 rows=1,585 width=220) (actual time=17,170.069..17,170.079 rows=26 loops=1)

  • Sort Key: (sum(b.cost)) DESC
  • Sort Method: quicksort Memory: 38kB
2. 0.304 17,169.879 ↑ 61.0 26 1

Hash Join (cost=67,486.35..69,418.94 rows=1,585 width=220) (actual time=17,098.366..17,169.879 rows=26 loops=1)

  • Hash Cond: (b.imb_id = imb.imb_id)
3. 0.072 199.075 ↑ 10.8 44 1

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

  • Hash Cond: (b.imb_id = names.imb_id)
4. 0.224 197.828 ↑ 10.8 44 1

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

  • Hash Cond: (d1.imb_id = b.imb_id)
5. 0.613 193.488 ↓ 4.4 580 1

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

6. 72.710 111.701 ↓ 1.0 978 1

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

  • Group Key: campaigns.imb_id
7. 38.991 38.991 ↑ 1.0 97,803 1

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

8. 81.174 81.174 ↑ 1.0 1 978

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

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

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
10. 0.379 4.088 ↑ 10.8 44 1

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

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

Index Scan using boosts_pkey on campaigns b (cost=0.42..730.37 rows=655 width=36) (actual time=0.820..3.709 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
12. 0.427 1.175 ↑ 1.0 1,553 1

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

  • Buckets: 2048 Batches: 1 Memory Usage: 118kB
13. 0.748 0.748 ↑ 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.021..0.748 rows=1,553 loops=1)

14. 0.037 16,970.500 ↑ 25.8 26 1

Hash (cost=63,023.34..63,023.34 rows=670 width=20) (actual time=16,970.500..16,970.500 rows=26 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
15. 0.012 16,970.463 ↑ 25.8 26 1

Subquery Scan on imb (cost=63,009.94..63,023.34 rows=670 width=20) (actual time=16,970.445..16,970.463 rows=26 loops=1)

16. 697.980 16,970.451 ↑ 25.8 26 1

HashAggregate (cost=63,009.94..63,016.64 rows=670 width=20) (actual time=16,970.443..16,970.451 rows=26 loops=1)

  • Group Key: widgets.imb_id
17. 13,074.311 16,272.471 ↓ 19.0 1,486,878 1

Bitmap Heap Scan on widgets (cost=40,467.12..62,423.93 rows=78,135 width=12) (actual time=3,225.808..16,272.471 rows=1,486,878 loops=1)

  • Recheck Cond: ((source_id = 30) AND (date > '2019-01-01'::date) AND (date >= '2019-06-06'::date) AND (date <= '2019-06-11'::date))
  • Rows Removed by Index Recheck: 24308265
  • Heap Blocks: exact=57448 lossy=447417
18. 118.310 3,198.160 ↓ 0.0 0 1

BitmapAnd (cost=40,467.12..40,467.12 rows=19,991 width=0) (actual time=3,198.160..3,198.160 rows=0 loops=1)

19. 1,664.460 1,664.460 ↓ 4.1 3,763,721 1

Bitmap Index Scan on widgets_source_id_idx (cost=0.00..9,712.20 rows=922,808 width=0) (actual time=1,664.460..1,664.460 rows=3,763,721 loops=1)

  • Index Cond: (source_id = 30)
20. 1,415.390 1,415.390 ↑ 1.1 1,662,962 1

Bitmap Index Scan on widgets_pkey (cost=0.00..30,715.61 rows=1,747,984 width=0) (actual time=1,415.390..1,415.390 rows=1,662,962 loops=1)

  • Index Cond: ((date >= '2019-06-06'::date) AND (date <= '2019-06-11'::date))