explain.depesz.com

PostgreSQL's explain analyze made readable

Result: sRXB

Settings
# exclusive inclusive rows x rows loops node
1. 0.003 3.007 ↓ 0.0 0 1

GroupAggregate (cost=218.14..218.16 rows=1 width=12) (actual time=3.007..3.007 rows=0 loops=1)

  • Group Key: tb.start_date
2. 0.008 3.004 ↓ 0.0 0 1

Sort (cost=218.14..218.15 rows=1 width=12) (actual time=3.004..3.004 rows=0 loops=1)

  • Sort Key: tb.start_date
  • Sort Method: quicksort Memory: 25kB
3. 0.113 2.996 ↓ 0.0 0 1

Nested Loop (cost=56.92..218.13 rows=1 width=12) (actual time=2.996..2.996 rows=0 loops=1)

  • Join Filter: (tb.id = sr.timeblock_id)
  • Rows Removed by Join Filter: 470
4. 0.008 2.658 ↓ 5.0 5 1

Nested Loop (cost=56.92..212.58 rows=1 width=12) (actual time=0.561..2.658 rows=5 loops=1)

5. 0.024 2.620 ↓ 5.0 5 1

Nested Loop (cost=56.77..204.38 rows=1 width=20) (actual time=0.544..2.620 rows=5 loops=1)

6. 0.405 1.462 ↑ 1.2 21 1

Merge Join (cost=56.49..126.34 rows=25 width=16) (actual time=0.271..1.462 rows=21 loops=1)

  • Merge Cond: (pos.id = ep.position_id)
7. 0.961 0.961 ↓ 1.1 1,741 1

Index Only Scan using i_position_id on "position" pos (cost=0.28..80.16 rows=1,630 width=8) (actual time=0.039..0.961 rows=1,741 loops=1)

  • Heap Fetches: 1741
8. 0.032 0.096 ↑ 1.0 33 1

Sort (cost=56.21..56.29 rows=33 width=8) (actual time=0.088..0.096 rows=33 loops=1)

  • Sort Key: ep.position_id
  • Sort Method: quicksort Memory: 26kB
9. 0.064 0.064 ↑ 1.0 33 1

Index Scan using emp_pos_employee_id on employee_position ep (cost=0.28..55.38 rows=33 width=8) (actual time=0.023..0.064 rows=33 loops=1)

  • Index Cond: (employee_id = 305)
  • Filter: (deleted = 'N'::bpchar)
  • Rows Removed by Filter: 12
10. 1.134 1.134 ↓ 0.0 0 21

Index Scan using i_timeblock_position on timeblock tb (cost=0.29..3.11 rows=1 width=28) (actual time=0.026..0.054 rows=0 loops=21)

  • Index Cond: (position_id = pos.id)
  • Filter: ((date_published IS NOT NULL) AND (start_date >= '2019-12-01'::date) AND (start_date <= '2019-12-30'::date) AND (last_published = 'Y'::bpchar) AND (shift_type = 2) AND (start_date >= now()))
  • Rows Removed by Filter: 37
11. 0.030 0.030 ↑ 1.0 1 5

Index Only Scan using i_schedule_idtempn on schedule sch (cost=0.15..8.17 rows=1 width=8) (actual time=0.006..0.006 rows=1 loops=5)

  • Index Cond: (id = tb.schedule_id)
  • Heap Fetches: 5
12. 0.225 0.225 ↑ 1.5 94 5

Seq Scan on shift_request sr (cost=0.00..3.78 rows=142 width=8) (actual time=0.007..0.045 rows=94 loops=5)

  • Filter: (requesting_employee_id <> 305)
  • Rows Removed by Filter: 22