explain.depesz.com

PostgreSQL's explain analyze made readable

Result: PrUk : Optimization for: Optimization for: plan #5KhA; plan #4lF6

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.008 98.154 ↑ 1.0 20 1

Limit (cost=1.27..2,560.80 rows=20 width=66) (actual time=9.670..98.154 rows=20 loops=1)

2. 9.743 98.146 ↑ 51.0 20 1

Nested Loop (cost=1.27..130,409.07 rows=1,019 width=66) (actual time=9.669..98.146 rows=20 loops=1)

  • Join Filter: (title.employee_id = salary.employee_id)
3. 15.045 54.866 ↑ 6.5 11,179 1

Merge Join (cost=0.84..40,089.91 rows=72,612 width=62) (actual time=0.021..54.866 rows=11,179 loops=1)

  • Merge Cond: (employee.id = title.employee_id)
4. 17.216 17.216 ↑ 3.7 81,855 1

Index Scan using idx_16988_primary on employee (cost=0.42..10,284.78 rows=300,024 width=35) (actual time=0.008..17.216 rows=81,855 loops=1)

5. 22.605 22.605 ↑ 6.5 11,179 1

Index Scan using title_employee_id_is_last_title_idx on title (cost=0.42..28,147.41 rows=72,612 width=27) (actual time=0.010..22.605 rows=11,179 loops=1)

  • Index Cond: (is_last_title = true)
  • Filter: (is_last_title AND ((title)::text = 'Staff'::text))
  • Rows Removed by Filter: 70,676
6. 33.537 33.537 ↓ 0.0 0 11,179

Index Scan using salary_employee_id_is_last_salary_idx on salary (cost=0.43..1.23 rows=1 width=20) (actual time=0.003..0.003 rows=0 loops=11,179)

  • Index Cond: ((employee_id = employee.id) AND (is_last_salary = true))
  • Filter: (is_last_salary AND (amount >= 120,000))
  • Rows Removed by Filter: 1
Planning time : 9.777 ms
Execution time : 98.199 ms