explain.depesz.com

PostgreSQL's explain analyze made readable

Result: tWKH

Settings
# exclusive inclusive rows x rows loops node
1. 0.872 1,026.363 ↑ 7.3 788 1

Sort (cost=28,761.41..28,775.79 rows=5,753 width=52) (actual time=1,026.267..1,026.363 rows=788 loops=1)

  • Sort Key: t.created_on DESC
  • Sort Method: quicksort Memory: 103kB
2. 0.708 1,025.491 ↑ 7.3 788 1

Hash Join (cost=3.53..28,402.13 rows=5,753 width=52) (actual time=20.686..1,025.491 rows=788 loops=1)

  • Hash Cond: (t.task_status_id = ts.id)
3. 0.328 1,024.725 ↑ 7.3 788 1

Merge Join (cost=1.69..28,354.71 rows=5,753 width=52) (actual time=20.589..1,024.725 rows=788 loops=1)

  • Merge Cond: (e.office_id = o.id)
4. 0.562 1,024.343 ↑ 8.9 788 1

Nested Loop (cost=1.56..50,126.07 rows=7,032 width=56) (actual time=20.548..1,024.343 rows=788 loops=1)

5. 0.537 9.466 ↑ 1.0 285 1

Nested Loop Left Join (cost=1.13..3,641.46 rows=290 width=36) (actual time=0.174..9.466 rows=285 loops=1)

6. 0.395 8.074 ↑ 1.0 285 1

Nested Loop Left Join (cost=0.85..3,504.18 rows=290 width=26) (actual time=0.144..8.074 rows=285 loops=1)

7. 0.481 5.684 ↑ 1.0 285 1

Nested Loop (cost=0.56..2,627.14 rows=290 width=26) (actual time=0.111..5.684 rows=285 loops=1)

8. 3.173 3.173 ↑ 1.0 290 1

Index Scan using idx_employees_office_id on employees e (cost=0.28..1,025.24 rows=290 width=22) (actual time=0.073..3.173 rows=290 loops=1)

  • Filter: (department_id = 1)
  • Rows Removed by Filter: 5577
9. 2.030 2.030 ↑ 1.0 1 290

Index Scan using idx_users_employee_id on users u (cost=0.28..5.51 rows=1 width=8) (actual time=0.006..0.007 rows=1 loops=290)

  • Index Cond: (employee_id = e.id)
10. 1.995 1.995 ↑ 1.0 1 285

Index Scan using idx_team_employees_employee_id on team_employees te (cost=0.29..3.01 rows=1 width=8) (actual time=0.006..0.007 rows=1 loops=285)

  • Index Cond: (employee_id = e.id)
  • Filter: (is_primary_team = 1)
  • Rows Removed by Filter: 1
11. 0.855 0.855 ↑ 1.0 1 285

Index Scan using pk_employees on employees e2 (cost=0.28..0.47 rows=1 width=18) (actual time=0.003..0.003 rows=1 loops=285)

  • Index Cond: (id = te.manager_employee_id)
12. 1,014.315 1,014.315 ↑ 28.0 3 285

Index Scan using idx_tasks_user_id on tasks t (cost=0.43..159.45 rows=84 width=28) (actual time=1.826..3.559 rows=3 loops=285)

  • Index Cond: (user_id = u.id)
  • Filter: ((task_status_id <> 7) AND ((call_id IS NULL) OR ((call_id IS NOT NULL) AND (user_id <> created_by) AND (user_id <> 1131))) AND (task_type_id = ANY ('{5,6,61,13,7}'::integer[])) AND ((completed_on IS NULL) OR ((completed_on >= CURRENT_DATE) AND (completed_on <= (CURRENT_DATE + '1 day'::interval)))))
  • Rows Removed by Filter: 1555
13. 0.054 0.054 ↑ 3.0 3 1

Index Scan using offices_pkey on offices o (cost=0.14..12.33 rows=9 width=4) (actual time=0.035..0.054 rows=3 loops=1)

  • Filter: ((country_code)::text = 'US'::text)
  • Rows Removed by Filter: 2
14. 0.034 0.058 ↑ 1.0 37 1

Hash (cost=1.37..1.37 rows=37 width=4) (actual time=0.058..0.058 rows=37 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
15. 0.024 0.024 ↑ 1.0 37 1

Seq Scan on task_statuses ts (cost=0.00..1.37 rows=37 width=4) (actual time=0.015..0.024 rows=37 loops=1)