explain.depesz.com

PostgreSQL's explain analyze made readable

Result: C92a : Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: plan #LaHU; plan #IaEQ; plan #ewLA; plan #ZqOR; plan #SdSy; plan #NX5; plan #AAo9; plan #IMEN; plan #VYE1; plan #l3H2; plan #VGlE; plan #i7GS; plan #cExc; plan #WKwM

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.100 10,986.145 ↑ 34.2 15 1

Sort (cost=1,055,133.48..1,055,134.76 rows=513 width=220) (actual time=10,986.142..10,986.145 rows=15 loops=1)

  • Sort Key: (sum(b.cost)) DESC
  • Sort Method: quicksort Memory: 32kB
2. 0.392 10,986.045 ↑ 34.2 15 1

Hash Join (cost=1,053,631.15..1,055,110.39 rows=513 width=220) (actual time=10,711.611..10,986.045 rows=15 loops=1)

  • Hash Cond: (b.imb_id = imb.imb_id)
3. 0.144 460.646 ↑ 10.7 44 1

Hash Left Join (cost=4,070.22..5,518.66 rows=471 width=163) (actual time=186.514..460.646 rows=44 loops=1)

  • Hash Cond: (b.imb_id = names.imb_id)
4. 0.464 458.562 ↑ 10.7 44 1

Hash Right Join (cost=4,021.30..5,463.26 rows=471 width=124) (actual time=184.543..458.562 rows=44 loops=1)

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

Nested Loop (cost=3,261.34..4,694.48 rows=133 width=28) (actual time=85.122..361.183 rows=580 loops=1)

6. 32.909 85.622 ↓ 1.0 978 1

HashAggregate (cost=3,261.05..3,270.39 rows=935 width=8) (actual time=84.644..85.622 rows=978 loops=1)

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

Seq Scan on campaigns (cost=0.00..2,772.03 rows=97,803 width=8) (actual time=0.626..52.713 rows=97,803 loops=1)

8. 274.818 274.818 ↑ 1.0 1 978

Index Scan using boosts_pkey on campaigns d1 (cost=0.29..1.50 rows=1 width=32) (actual time=0.280..0.281 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.038 96.915 ↑ 10.7 44 1

Hash (cost=754.08..754.08 rows=471 width=100) (actual time=96.915..96.915 rows=44 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
10. 0.434 96.877 ↑ 10.7 44 1

HashAggregate (cost=724.64..749.37 rows=471 width=100) (actual time=96.832..96.877 rows=44 loops=1)

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

Index Scan using boosts_pkey on campaigns b (cost=0.29..690.36 rows=653 width=36) (actual time=27.825..96.443 rows=243 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: 1310
12. 0.465 1.940 ↑ 1.0 1,552 1

Hash (cost=29.52..29.52 rows=1,552 width=43) (actual time=1.940..1.940 rows=1,552 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 118kB
13. 1.475 1.475 ↑ 1.0 1,552 1

Seq Scan on campaign_names_groups names (cost=0.00..29.52 rows=1,552 width=43) (actual time=0.324..1.475 rows=1,552 loops=1)

14. 0.037 10,525.007 ↑ 3.1 71 1

Hash (cost=1,049,558.20..1,049,558.20 rows=218 width=20) (actual time=10,525.007..10,525.007 rows=71 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 12kB
15. 0.009 10,524.970 ↑ 3.1 71 1

Subquery Scan on imb (cost=1,049,553.84..1,049,558.20 rows=218 width=20) (actual time=10,524.945..10,524.970 rows=71 loops=1)

16. 74.841 10,524.961 ↑ 3.1 71 1

HashAggregate (cost=1,049,553.84..1,049,556.02 rows=218 width=20) (actual time=10,524.944..10,524.961 rows=71 loops=1)

  • Group Key: widgets.imb_id
17. 9,756.579 10,450.120 ↑ 8.2 165,207 1

Bitmap Heap Scan on widgets (cost=21,588.49..1,039,391.94 rows=1,354,921 width=12) (actual time=723.091..10,450.120 rows=165,207 loops=1)

  • Recheck Cond: ((date >= '2019-06-06'::date) AND (date <= '2019-06-11'::date))
  • Rows Removed by Index Recheck: 6415561
  • Filter: (source_id = 12)
  • Rows Removed by Filter: 1449302
  • Heap Blocks: exact=64263 lossy=407075
18. 693.541 693.541 ↑ 1.0 1,614,509 1

Bitmap Index Scan on widgets_date_idx (cost=0.00..21,249.76 rows=1,639,282 width=0) (actual time=693.540..693.541 rows=1,614,509 loops=1)

  • Index Cond: ((date >= '2019-06-06'::date) AND (date <= '2019-06-11'::date))
Planning time : 14.459 ms
Execution time : 10,987.729 ms