explain.depesz.com

PostgreSQL's explain analyze made readable

Result: O8yA

Settings
# exclusive inclusive rows x rows loops node
1. 3.405 1,099.746 ↑ 8.2 4,419 1

Nested Loop (cost=1,143.45..39,045.69 rows=36,305 width=2,314) (actual time=6.712..1,099.746 rows=4,419 loops=1)

2. 0.292 6.759 ↑ 1.3 183 1

HashAggregate (cost=1,143.02..1,145.39 rows=237 width=4) (actual time=6.533..6.759 rows=183 loops=1)

  • Group Key: u.id
3. 0.070 6.467 ↑ 1.3 183 1

Hash Join (cost=244.37..1,142.43 rows=237 width=4) (actual time=1.027..6.467 rows=183 loops=1)

  • Hash Cond: (e.office_id = o.id)
4. 0.816 6.377 ↑ 1.0 285 1

Hash Join (cost=243.12..1,140.25 rows=290 width=8) (actual time=0.990..6.377 rows=285 loops=1)

  • Hash Cond: (u.employee_id = e.id)
5. 4.602 4.602 ↑ 1.0 5,871 1

Seq Scan on users u (cost=0.00..881.71 rows=5,871 width=8) (actual time=0.011..4.602 rows=5,871 loops=1)

6. 0.073 0.959 ↑ 1.0 290 1

Hash (cost=239.48..239.48 rows=291 width=8) (actual time=0.959..0.959 rows=290 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 19kB
7. 0.828 0.886 ↑ 1.0 290 1

Bitmap Heap Scan on employees e (cost=10.54..239.48 rows=291 width=8) (actual time=0.085..0.886 rows=290 loops=1)

  • Recheck Cond: (department_id = 1)
  • Heap Blocks: exact=131
8. 0.058 0.058 ↓ 1.0 295 1

Bitmap Index Scan on idx_employees_department_id (cost=0.00..10.47 rows=291 width=0) (actual time=0.058..0.058 rows=295 loops=1)

  • Index Cond: (department_id = 1)
9. 0.011 0.020 ↑ 1.0 9 1

Hash (cost=1.14..1.14 rows=9 width=4) (actual time=0.020..0.020 rows=9 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
10. 0.009 0.009 ↑ 1.0 9 1

Seq Scan on offices o (cost=0.00..1.14 rows=9 width=4) (actual time=0.006..0.009 rows=9 loops=1)

  • Filter: ((country_code)::text = 'US'::text)
  • Rows Removed by Filter: 2
11. 1,089.582 1,089.582 ↑ 6.4 24 183

Index Scan using idx_tasks_user_id on tasks t (cost=0.43..158.39 rows=153 width=2,314) (actual time=1.636..5.954 rows=24 loops=183)

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