explain.depesz.com

PostgreSQL's explain analyze made readable

Result: kI2U

Settings
# exclusive inclusive rows x rows loops node
1. 0.241 216.242 ↑ 2.5 220 1

Sort (cost=33,927.40..33,928.75 rows=540 width=13) (actual time=216.221..216.242 rows=220 loops=1)

  • Sort Key: r.size
  • Sort Method: quicksort Memory: 35kB
2. 0.251 216.001 ↑ 2.5 220 1

Hash Join (cost=6,430.06..33,902.89 rows=540 width=13) (actual time=132.553..216.001 rows=220 loops=1)

  • Hash Cond: ((a.semesterid)::text = (sem.id)::text)
3. 3.155 215.731 ↑ 2.5 220 1

Hash Join (cost=6,428.50..33,899.66 rows=540 width=17) (actual time=132.512..215.731 rows=220 loops=1)

  • Hash Cond: ((t.activityid)::text = (a.id)::text)
  • Join Filter: (((a.ownerid)::text = (r.ownerid)::text) OR (SubPlan 3) OR (SubPlan 4) OR (SubPlan 7))
  • Rows Removed by Join Filter: 542
4. 1.958 22.484 ↓ 1.2 762 1

Nested Loop (cost=0.42..27,469.98 rows=614 width=46) (actual time=0.150..22.484 rows=762 loops=1)

  • Join Filter: (NOT (SubPlan 10))
  • Rows Removed by Join Filter: 612
5. 0.019 0.019 ↑ 1.0 1 1

Index Scan using activitytime_pkey on activitytime t (cost=0.42..4.44 rows=1 width=43) (actual time=0.017..0.019 rows=1 loops=1)

  • Index Cond: ((id)::text = '19V-ENG1100-1-1-1-1'::text)
6. 1.271 1.271 ↓ 1.1 1,374 1

Seq Scan on room r (cost=0.00..86.81 rows=1,228 width=36) (actual time=0.007..1.271 rows=1,374 loops=1)

  • Filter: ((size > 0) AND (((clash)::text = 'N'::text) OR (((clash)::text = 'J'::text) AND ((typeid)::text = ANY ('{OPPMØTE,KLINIKK,VIRTUELT}'::text[])))))
  • Rows Removed by Filter: 76
7.          

SubPlan (forNested Loop)

8. 5.444 19.236 ↓ 0.0 0 1,374

Nested Loop (cost=18.22..22.29 rows=1 width=0) (actual time=0.014..0.014 rows=0 loops=1,374)

  • Join Filter: ((r.active_to < to_date(concat(t.preset_year, '-', w.weeknumberid, '-', 'MON'), 'IYYY-IW-DY'::text)) OR (r.active_from > to_date(concat(t.preset_year, '-', y.weeknumberid, '-', 'MON'), 'IYYY-IW-DY'::text)))
  • Rows Removed by Join Filter: 1
9.          

Initplan (forNested Loop)

10. 0.007 0.018 ↑ 1.0 1 1

Aggregate (cost=8.67..8.68 rows=1 width=32) (actual time=0.017..0.018 rows=1 loops=1)

11. 0.011 0.011 ↓ 1.9 13 1

Index Scan using activitytime_week_activitytimeid_idx on activitytime_week x (cost=0.43..8.66 rows=7 width=5) (actual time=0.007..0.011 rows=13 loops=1)

  • Index Cond: ((activitytimeid)::text = '19V-ENG1100-1-1-1-1'::text)
12. 0.010 0.034 ↑ 1.0 1 1

Aggregate (cost=8.67..8.68 rows=1 width=32) (actual time=0.034..0.034 rows=1 loops=1)

13. 0.024 0.024 ↓ 1.9 13 1

Index Scan using activitytime_week_activitytimeid_idx on activitytime_week x_1 (cost=0.43..8.66 rows=7 width=5) (actual time=0.018..0.024 rows=13 loops=1)

  • Index Cond: ((activitytimeid)::text = '19V-ENG1100-1-1-1-1'::text)
14. 6.870 6.870 ↑ 1.0 1 1,374

Index Only Scan using activitytime_week_pkey on activitytime_week w (cost=0.43..2.45 rows=1 width=5) (actual time=0.005..0.005 rows=1 loops=1,374)

  • Index Cond: ((weeknumberid = $19) AND (activitytimeid = (t.id)::text))
  • Heap Fetches: 0
15. 6.870 6.870 ↑ 1.0 1 1,374

Index Only Scan using activitytime_week_pkey on activitytime_week y (cost=0.43..2.45 rows=1 width=5) (actual time=0.005..0.005 rows=1 loops=1,374)

  • Index Cond: ((weeknumberid = $17) AND (activitytimeid = (t.id)::text))
  • Heap Fetches: 0
16. 74.539 131.540 ↓ 1.0 167,502 1

Hash (cost=4,334.70..4,334.70 rows=167,470 width=43) (actual time=131.539..131.540 rows=167,502 loops=1)

  • Buckets: 262144 Batches: 1 Memory Usage: 14467kB
17. 57.001 57.001 ↓ 1.0 167,502 1

Seq Scan on activity a (cost=0.00..4,334.70 rows=167,470 width=43) (actual time=0.014..57.001 rows=167,502 loops=1)

18.          

SubPlan (forHash Join)

19. 0.000 54.102 ↓ 0.0 0 762

Nested Loop (cost=2.69..23.19 rows=1 width=0) (actual time=0.071..0.071 rows=0 loops=762)

20.          

Initplan (forNested Loop)

21. 1.524 5.334 ↑ 1.0 1 762

Nested Loop (cost=0.00..2.40 rows=1 width=4) (actual time=0.007..0.007 rows=1 loops=762)

  • Join Filter: ((z.fase)::text = (f.id)::text)
  • Rows Removed by Join Filter: 3
22. 3.048 3.048 ↑ 1.0 1 762

Seq Scan on semester z (cost=0.00..1.31 rows=1 width=6) (actual time=0.003..0.004 rows=1 loops=762)

  • Filter: ((id)::text = (a.semesterid)::text)
  • Rows Removed by Filter: 24
23. 0.762 0.762 ↑ 1.0 4 762

Seq Scan on fase f (cost=0.00..1.04 rows=4 width=11) (actual time=0.000..0.001 rows=4 loops=762)

24. 8.382 8.382 ↓ 4.0 4 762

Seq Scan on fase fa (cost=0.00..1.05 rows=1 width=7) (actual time=0.009..0.011 rows=4 loops=762)

  • Filter: ($3 >= sort)
25. 13.789 43.425 ↓ 0.0 0 2,895

Index Scan using roomshare_pkey on roomshare s (cost=0.29..19.73 rows=1 width=8) (actual time=0.015..0.015 rows=0 loops=2,895)

  • Index Cond: (((roomid)::text = (r.id)::text) AND ((fase)::text = (fa.id)::text))
  • Filter: (((departmentid)::text = (a.ownerid)::text) OR (heritage AND (SubPlan 1)))
  • Rows Removed by Filter: 2
26.          

SubPlan (forIndex Scan)

27. 29.636 29.636 ↑ 71.4 14 62

ProjectSet (cost=0.00..5.27 rows=1,000 width=32) (actual time=0.455..0.478 rows=14 loops=62)

28. 0.000 0.000 ↑ 1.0 1 62

Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.000..0.000 rows=1 loops=62)

29. 0.019 2.824 ↓ 0.0 0 706

Result (cost=0.42..10.88 rows=1 width=0) (actual time=0.004..0.004 rows=0 loops=706)

  • One-Time Filter: r.roomshare
30. 0.330 2.805 ↑ 1.0 1 165

Nested Loop (cost=0.42..10.88 rows=1 width=0) (actual time=0.017..0.017 rows=1 loops=165)

  • Join Filter: (((b.campusshare)::text = (d.campusshare)::text) AND ((f_1.sort >= d.campus_share_phase) OR (f_1.sort >= b.campus_share_phase)))
  • Rows Removed by Join Filter: 0
31. 0.330 1.980 ↑ 1.0 1 165

Nested Loop (cost=0.14..6.57 rows=1 width=18) (actual time=0.012..0.012 rows=1 loops=165)

  • Join Filter: ((z_1.fase)::text = (f_1.id)::text)
  • Rows Removed by Join Filter: 3
32. 0.330 1.485 ↑ 1.0 1 165

Nested Loop (cost=0.14..5.48 rows=1 width=20) (actual time=0.009..0.009 rows=1 loops=165)

33. 0.495 0.495 ↑ 1.0 1 165

Index Scan using building_pkey on building b (cost=0.14..4.16 rows=1 width=14) (actual time=0.003..0.003 rows=1 loops=165)

  • Index Cond: ((r.buildingid)::text = (id)::text)
34. 0.660 0.660 ↑ 1.0 1 165

Seq Scan on semester z_1 (cost=0.00..1.31 rows=1 width=6) (actual time=0.004..0.004 rows=1 loops=165)

  • Filter: ((id)::text = (a.semesterid)::text)
  • Rows Removed by Filter: 24
35. 0.165 0.165 ↑ 1.0 4 165

Seq Scan on fase f_1 (cost=0.00..1.04 rows=4 width=11) (actual time=0.001..0.001 rows=4 loops=165)

36. 0.495 0.495 ↑ 1.0 1 165

Index Scan using department_pkey on department d (cost=0.27..4.29 rows=1 width=14) (actual time=0.003..0.003 rows=1 loops=165)

  • Index Cond: ((id)::text = (a.ownerid)::text)
37. 1.626 1.626 ↓ 0.0 0 542

Seq Scan on roomshare_course s_1 (cost=2.62..4.15 rows=1 width=0) (actual time=0.003..0.003 rows=0 loops=542)

  • Filter: (((roomid)::text = (r.id)::text) AND ((courseid)::text = (a.courseid)::text) AND (((fase)::text = 'initial'::text) OR (((fase)::text = 'facshare'::text) AND (($12)::text = 'final'::text)) OR ((fase)::text = ($13)::text)))
  • Rows Removed by Filter: 21
38.          

Initplan (forSeq Scan)

39. 0.000 0.000 ↓ 0.0 0

Seq Scan on semester z_2 (cost=0.00..1.31 rows=1 width=6) (never executed)

  • Filter: ((id)::text = (a.semesterid)::text)
40. 0.000 0.000 ↓ 0.0 0

Seq Scan on semester z_3 (cost=0.00..1.31 rows=1 width=6) (never executed)

  • Filter: ((id)::text = (a.semesterid)::text)
41. 0.008 0.019 ↑ 1.0 25 1

Hash (cost=1.25..1.25 rows=25 width=4) (actual time=0.018..0.019 rows=25 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
42. 0.011 0.011 ↑ 1.0 25 1

Seq Scan on semester sem (cost=0.00..1.25 rows=25 width=4) (actual time=0.007..0.011 rows=25 loops=1)