explain.depesz.com

PostgreSQL's explain analyze made readable

Result: VYE1 : 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

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.039 469.678 ↑ 32.8 15 1

Sort (cost=45,303.41..45,304.64 rows=492 width=220) (actual time=469.676..469.678 rows=15 loops=1)

  • Sort Key: (sum(b.cost)) DESC
  • Sort Method: quicksort Memory: 32kB
2. 0.103 469.639 ↑ 32.8 15 1

Hash Left Join (cost=43,832.65..45,281.41 rows=492 width=220) (actual time=466.824..469.639 rows=15 loops=1)

  • Hash Cond: (b.imb_id = names.imb_id)
3. 0.021 468.975 ↑ 32.8 15 1

Hash Join (cost=43,786.21..45,217.14 rows=492 width=140) (actual time=466.222..468.975 rows=15 loops=1)

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

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

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

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

6. 16.602 24.442 ↓ 1.1 978 1

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

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

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

8. 1.956 1.956 ↑ 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.002 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.012 0.200 ↑ 3.3 44 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
10. 0.092 0.188 ↑ 3.3 44 1

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

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

Index Scan using boosts_pkey on campaigns b (cost=0.29..208.71 rows=156 width=36) (actual time=0.035..0.096 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.012 441.787 ↑ 31.1 22 1

Hash (cost=40,394.27..40,394.27 rows=684 width=20) (actual time=441.787..441.787 rows=22 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
13. 0.002 441.775 ↑ 31.1 22 1

Subquery Scan on imb (cost=40,380.59..40,394.27 rows=684 width=20) (actual time=441.769..441.775 rows=22 loops=1)

14. 1.881 441.773 ↑ 31.1 22 1

HashAggregate (cost=40,380.59..40,387.43 rows=684 width=20) (actual time=441.768..441.773 rows=22 loops=1)

  • Group Key: widgets.imb_id
15. 439.892 439.892 ↑ 21.6 11,206 1

Index Scan using widgets_date_idx on widgets (cost=0.44..38,568.84 rows=241,566 width=12) (actual time=70.129..439.892 rows=11,206 loops=1)

  • Index Cond: ((date >= '2019-06-06'::date) AND (date <= '2019-06-11'::date))
  • Filter: (source_id = 12)
  • Rows Removed by Filter: 1383344
16. 0.284 0.561 ↑ 1.0 1,486 1

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

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

Planning time : 0.700 ms
Execution time : 469.915 ms