explain.depesz.com

PostgreSQL's explain analyze made readable

Result: FQSY : Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: Optimization for: plan #jjT8; plan #R0k; plan #RqOF; plan #yjc; plan #fWeZ; plan #X2Wd; plan #DsHq

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.086 20,075.594 ↑ 61.0 26 1

Sort (cost=69,477.96..69,481.92 rows=1,585 width=220) (actual time=20,075.588..20,075.594 rows=26 loops=1)

  • Sort Key: (sum(b.cost)) DESC
  • Sort Method: quicksort Memory: 38kB
2. 0.300 20,075.508 ↑ 61.0 26 1

Hash Join (cost=67,461.12..69,393.71 rows=1,585 width=220) (actual time=19,988.891..20,075.508 rows=26 loops=1)

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

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

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

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

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

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

6. 34.827 74.197 ↓ 1.0 978 1

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

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

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

8. 90.954 90.954 ↑ 1.0 1 978

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

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

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
10. 0.283 2.806 ↑ 10.8 44 1

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

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

Index Scan using boosts_pkey on campaigns b (cost=0.42..730.37 rows=655 width=36) (actual time=0.386..2.523 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.497 1.416 ↑ 1.0 1,553 1

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

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

14. 0.013 19,904.927 ↑ 25.8 26 1

Hash (cost=62,998.11..62,998.11 rows=670 width=20) (actual time=19,904.927..19,904.927 rows=26 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
15. 0.007 19,904.914 ↑ 25.8 26 1

Subquery Scan on imb (cost=62,984.71..62,998.11 rows=670 width=20) (actual time=19,904.903..19,904.914 rows=26 loops=1)

16. 678.760 19,904.907 ↑ 25.8 26 1

HashAggregate (cost=62,984.71..62,991.41 rows=670 width=20) (actual time=19,904.901..19,904.907 rows=26 loops=1)

  • Group Key: widgets.imb_id
17. 16,480.448 19,226.147 ↓ 18.9 1,476,416 1

Bitmap Heap Scan on widgets (cost=40,452.12..62,399.01 rows=78,094 width=12) (actual time=2,773.801..19,226.147 rows=1,476,416 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: 24213834
  • Heap Blocks: exact=55325 lossy=447191
18. 106.400 2,745.699 ↓ 0.0 0 1

BitmapAnd (cost=40,452.12..40,452.12 rows=19,981 width=0) (actual time=2,745.699..2,745.699 rows=0 loops=1)

19. 1,038.578 1,038.578 ↓ 4.0 3,683,732 1

Bitmap Index Scan on widgets_source_id_idx (cost=0.00..9,707.48 rows=922,325 width=0) (actual time=1,038.578..1,038.578 rows=3,683,732 loops=1)

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

Bitmap Index Scan on widgets_pkey (cost=0.00..30,705.35 rows=1,747,068 width=0) (actual time=1,600.721..1,600.721 rows=1,662,331 loops=1)

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