explain.depesz.com

PostgreSQL's explain analyze made readable

Result: MthX

Settings
# exclusive inclusive rows x rows loops node
1. 0.273 8,232.905 ↓ 9.0 9 1

Merge Join (cost=5.37..1,390,066.34 rows=1 width=76) (actual time=401.938..8,232.905 rows=9 loops=1)

  • Merge Cond: (dschds.dispatch_schedule_id = ls.dispatch_schedule_id)
  • Join Filter: (ls.idx = ((row_number() OVER (?) + 1)))
  • Rows Removed by Join Filter: 72
  • Functions: 25
  • Options: Inlining true, Optimization true, Expressions true, Deforming true
  • Timing: Generation 3.702 ms, Inlining 5.258 ms, Optimization 225.579 ms, Emission 161.709 ms, Total 396.248 ms
2. 1.940 396.289 ↑ 1,732.5 4,022 1

WindowAgg (cost=0.43..534,379.36 rows=6,968,214 width=40) (actual time=393.252..396.289 rows=4,022 loops=1)

3. 394.349 394.349 ↑ 1,732.1 4,023 1

Index Scan using dispatch_schedule_stop_idx2 on dispatch_schedule_stop dschds (cost=0.43..395,015.08 rows=6,968,214 width=32) (actual time=393.224..394.349 rows=4,023 loops=1)

4. 0.012 7,836.343 ↓ 24.3 73 1

Materialize (cost=4.94..768,582.98 rows=3 width=60) (actual time=5.418..7,836.343 rows=73 loops=1)

5. 343.510 7,836.331 ↓ 3.0 9 1

Subquery Scan on ls (cost=4.94..768,582.98 rows=3 width=60) (actual time=5.415..7,836.331 rows=9 loops=1)

  • Filter: ((ls.schedule_id = 30112) AND (ls.schedule_date = '2020-03-16'::date))
  • Rows Removed by Filter: 6968205
6. 3,645.051 7,492.821 ↑ 1.0 6,968,214 1

WindowAgg (cost=4.94..664,059.77 rows=6,968,214 width=60) (actual time=0.240..7,492.821 rows=6,968,214 loops=1)

7. 1,304.291 3,847.770 ↑ 1.0 6,968,214 1

Merge Join (cost=4.94..524,695.49 rows=6,968,214 width=52) (actual time=0.230..3,847.770 rows=6,968,214 loops=1)

  • Merge Cond: (dschds_1.dispatch_schedule_id = dschd.dispatch_schedule_id)
8. 2,026.313 2,026.313 ↑ 1.0 6,968,214 1

Index Scan using dispatch_schedule_stop_idx1 on dispatch_schedule_stop dschds_1 (cost=0.43..395,015.08 rows=6,968,214 width=32) (actual time=0.197..2,026.313 rows=6,968,214 loops=1)

9. 517.166 517.166 ↑ 1.0 971,094 1

Index Scan using dispatch_schedule_pk on dispatch_schedule dschd (cost=0.42..42,620.37 rows=971,094 width=28) (actual time=0.023..517.166 rows=971,094 loops=1)

Execution time : 8,236.782 ms