explain.depesz.com

PostgreSQL's explain analyze made readable

Result: SrGe : Optimization for: Optimization for: Optimization for: Optimization for: plan #X7OV; plan #4qTb; plan #oZWp; plan #Vm5S

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.271 16,906.020 ↑ 170.7 12 1

Merge Join (cost=340,926.56..341,064.97 rows=2,048 width=148) (actual time=16,905.904..16,906.020 rows=12 loops=1)

  • Merge Cond: (b.date = wid.date)
2. 0.012 163.161 ↑ 52.9 12 1

Merge Left Join (cost=1,247.76..1,251.46 rows=635 width=75) (actual time=163.150..163.161 rows=12 loops=1)

  • Merge Cond: (b.date = n.date)
3. 0.027 162.724 ↑ 52.9 12 1

Sort (cost=1,246.46..1,248.05 rows=635 width=60) (actual time=162.721..162.724 rows=12 loops=1)

  • Sort Key: b.date DESC
  • Sort Method: quicksort Memory: 26kB
4. 0.008 162.697 ↑ 52.9 12 1

Subquery Scan on b (cost=0.42..1,216.90 rows=635 width=60) (actual time=12.135..162.697 rows=12 loops=1)

5. 1.253 162.689 ↑ 52.9 12 1

GroupAggregate (cost=0.42..1,210.55 rows=635 width=64) (actual time=12.133..162.689 rows=12 loops=1)

  • Group Key: campaigns.date
6. 161.436 161.436 ↓ 1.1 2,700 1

Index Scan using boosts_pkey on campaigns (cost=0.42..1,131.76 rows=2,403 width=32) (actual time=0.619..161.436 rows=2,700 loops=1)

  • Index Cond: ((date >= '2019-06-01'::date) AND (date <= '2019-06-12'::date))
  • Filter: (source_id = 12)
  • Rows Removed by Filter: 363
7. 0.027 0.425 ↑ 11.0 1 1

Sort (cost=1.30..1.33 rows=11 width=19) (actual time=0.425..0.425 rows=1 loops=1)

  • Sort Key: n.date DESC
  • Sort Method: quicksort Memory: 25kB
8. 0.398 0.398 ↑ 1.0 11 1

Seq Scan on notes n (cost=0.00..1.11 rows=11 width=19) (actual time=0.396..0.398 rows=11 loops=1)

9. 0.042 16,742.588 ↑ 53.8 12 1

Sort (cost=339,678.80..339,680.42 rows=645 width=12) (actual time=16,742.586..16,742.588 rows=12 loops=1)

  • Sort Key: wid.date DESC
  • Sort Method: quicksort Memory: 25kB
10. 0.009 16,742.546 ↑ 53.8 12 1

Subquery Scan on wid (cost=0.44..339,648.70 rows=645 width=12) (actual time=173.756..16,742.546 rows=12 loops=1)

11. 73.695 16,742.537 ↑ 53.8 12 1

GroupAggregate (cost=0.44..339,642.25 rows=645 width=20) (actual time=173.756..16,742.537 rows=12 loops=1)

  • Group Key: widgets.date
12. 16,668.842 16,668.842 ↑ 5.9 390,767 1

Index Scan using widgets_date_idx on widgets (cost=0.44..328,081.84 rows=2,310,793 width=8) (actual time=1.521..16,668.842 rows=390,767 loops=1)

  • Index Cond: ((date >= '2019-06-01'::date) AND (date <= '2019-06-12'::date))
  • Filter: (source_id = 12)
  • Rows Removed by Filter: 2669352
Planning time : 11.496 ms
Execution time : 16,906.302 ms