explain.depesz.com

PostgreSQL's explain analyze made readable

Result: yjc : Optimization for: Optimization for: Optimization for: plan #jjT8; plan #R0k; plan #RqOF

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.025 37,853.076 ↑ 122.1 15 1

Sort (cost=214,062.94..214,067.52 rows=1,831 width=220) (actual time=37,853.074..37,853.076 rows=15 loops=1)

  • Sort Key: (sum(b.cost)) DESC
  • Sort Method: quicksort Memory: 32kB
2. 0.082 37,853.051 ↑ 122.1 15 1

Hash Join (cost=213,839.56..213,963.72 rows=1,831 width=220) (actual time=37,852.990..37,853.051 rows=15 loops=1)

  • Hash Cond: (widgets.imb_id = b.imb_id)
3. 71.898 37,601.163 ↑ 11.6 71 1

HashAggregate (cost=207,506.77..207,514.98 rows=821 width=20) (actual time=37,601.142..37,601.163 rows=71 loops=1)

  • Group Key: widgets.imb_id
4. 37,529.265 37,529.265 ↑ 7.6 165,616 1

Index Scan using widgets_date_idx on widgets (cost=0.44..198,099.05 rows=1,254,363 width=12) (actual time=0.752..37,529.265 rows=165,616 loops=1)

  • Index Cond: ((date >= '2019-06-06'::date) AND (date <= '2019-06-11'::date))
  • Filter: (source_id = 12)
  • Rows Removed by Filter: 1451927
5. 0.048 251.806 ↑ 10.1 44 1

Hash (cost=6,327.21..6,327.21 rows=446 width=163) (actual time=251.806..251.806 rows=44 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 17kB
6. 0.056 251.758 ↑ 10.1 44 1

Hash Left Join (cost=4,431.43..6,327.21 rows=446 width=163) (actual time=182.164..251.758 rows=44 loops=1)

  • Hash Cond: (b.imb_id = names.imb_id)
7. 0.219 249.867 ↑ 10.1 44 1

Hash Right Join (cost=4,309.59..6,199.24 rows=446 width=124) (actual time=180.317..249.867 rows=44 loops=1)

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

Nested Loop (cost=3,567.46..5,448.76 rows=132 width=28) (actual time=72.031..143.951 rows=580 loops=1)

9. 37.447 72.083 ↑ 1.0 978 1

HashAggregate (cost=3,567.05..3,576.83 rows=978 width=8) (actual time=71.642..72.083 rows=978 loops=1)

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

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

11. 71.394 71.394 ↑ 1.0 1 978

Index Scan using boosts_pkey on campaigns d1 (cost=0.42..1.89 rows=1 width=32) (actual time=0.073..0.073 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.025 105.697 ↑ 10.1 44 1

Hash (cost=736.55..736.55 rows=446 width=100) (actual time=105.697..105.697 rows=44 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
13. 0.476 105.672 ↑ 10.1 44 1

HashAggregate (cost=708.68..732.09 rows=446 width=100) (actual time=105.586..105.672 rows=44 loops=1)

  • Group Key: b.imb_id
  • Filter: (sum(b.ts_clicks) > 0)
14. 105.196 105.196 ↑ 2.4 243 1

Index Scan using boosts_pkey on campaigns b (cost=0.42..677.49 rows=594 width=36) (actual time=20.049..105.196 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
15. 0.314 1.835 ↑ 2.0 1,552 1

Hash (cost=83.04..83.04 rows=3,104 width=43) (actual time=1.835..1.835 rows=1,552 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 134kB
16. 1.521 1.521 ↑ 2.0 1,552 1

Seq Scan on campaign_names_groups names (cost=0.00..83.04 rows=3,104 width=43) (actual time=0.014..1.521 rows=1,552 loops=1)

Planning time : 3.340 ms
Execution time : 37,853.332 ms