explain.depesz.com

PostgreSQL's explain analyze made readable

Result: xQnOT

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

HashAggregate (cost=143,986.56..143,986.74 rows=18 width=88) (actual rows= loops=)

  • Group Key: r2.type_id, p2.id, (initcap((p2.name1)::text)), (initcap((p2.name2)::text)), r2.status, r2.study_year_id
2. 0.000 0.000 ↓ 0.0

Append (cost=139,951.83..143,986.29 rows=18 width=88) (actual rows= loops=)

3. 0.000 0.000 ↓ 0.0

Unique (cost=139,951.83..139,951.96 rows=9 width=88) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Sort (cost=139,951.83..139,951.85 rows=9 width=88) (actual rows= loops=)

  • Sort Key: p2.id, (initcap((p2.name1)::text)), (initcap((p2.name2)::text)), r2.status, r2.study_year_id
5. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1.28..139,951.69 rows=9 width=88) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.86..139,933.08 rows=9 width=24) (actual rows= loops=)

  • Join Filter: ((r.class_level_id = r2.class_level_id) AND (COALESCE(r.parallel_identifier_id, '0'::bigint) = COALESCE(r2.parallel_identifier_id, '0'::bigint)))
7. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.86..51.32 rows=1 width=16) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Index Only Scan using person_pkey on person (cost=0.43..8.45 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = '14812101711'::bigint)
9. 0.000 0.000 ↓ 0.0

Index Scan using i_role_person on role r (cost=0.43..42.86 rows=1 width=24) (actual rows= loops=)

  • Index Cond: (person_id = '14812101711'::bigint)
  • Filter: (institution_id = 35)
10. 0.000 0.000 ↓ 0.0

Seq Scan on role r2 (cost=0.00..138,510.09 rows=91,445 width=40) (actual rows= loops=)

  • Filter: (type_id = 5)
11. 0.000 0.000 ↓ 0.0

Index Scan using person_pkey on person p2 (cost=0.43..2.05 rows=1 width=22) (actual rows= loops=)

  • Index Cond: (r2.person_id = id)
12. 0.000 0.000 ↓ 0.0

Unique (cost=114.71..114.83 rows=7 width=88) (actual rows= loops=)

13. 0.000 0.000 ↓ 0.0

Sort (cost=114.71..114.73 rows=7 width=88) (actual rows= loops=)

  • Sort Key: r2_1.type_id, p2_1.id, (initcap((p2_1.name1)::text)), (initcap((p2_1.name2)::text)), r2_1.status, r2_1.study_year_id
14. 0.000 0.000 ↓ 0.0

Nested Loop (cost=3.13..114.61 rows=7 width=88) (actual rows= loops=)

15. 0.000 0.000 ↓ 0.0

Nested Loop (cost=2.71..111.06 rows=7 width=24) (actual rows= loops=)

16. 0.000 0.000 ↓ 0.0

Nested Loop (cost=2.27..105.79 rows=7 width=8) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.85..102.86 rows=6 width=16) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.42..100.09 rows=6 width=8) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.86..51.32 rows=1 width=8) (actual rows= loops=)

20. 0.000 0.000 ↓ 0.0

Index Only Scan using person_pkey on person person_1 (cost=0.43..8.45 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = '14812101711'::bigint)
21. 0.000 0.000 ↓ 0.0

Index Scan using i_role_person on role (cost=0.43..42.86 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (person_id = '14812101711'::bigint)
  • Filter: (institution_id = 35)
22. 0.000 0.000 ↓ 0.0

Index Only Scan using iu_student_seen_in_journal on student_seen_in_journal (cost=0.56..48.54 rows=23 width=16) (actual rows= loops=)

  • Index Cond: (student_id = role.id)
23. 0.000 0.000 ↓ 0.0

Index Only Scan using journal_pkey on journal (cost=0.43..0.45 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = student_seen_in_journal.journal_id)
24. 0.000 0.000 ↓ 0.0

Index Scan using i_jrnlteacherrel_journal on journal_teacher_rel (cost=0.43..0.47 rows=2 width=16) (actual rows= loops=)

  • Index Cond: (journal_id = student_seen_in_journal.journal_id)
25. 0.000 0.000 ↓ 0.0

Index Scan using role_pkey on role r2_1 (cost=0.43..0.74 rows=1 width=32) (actual rows= loops=)

  • Index Cond: (id = journal_teacher_rel.teacher_id)
26. 0.000 0.000 ↓ 0.0

Index Scan using person_pkey on person p2_1 (cost=0.43..0.49 rows=1 width=22) (actual rows= loops=)

  • Index Cond: (id = r2_1.person_id)
27. 0.000 0.000 ↓ 0.0

Unique (cost=3,752.74..3,752.76 rows=1 width=88) (actual rows= loops=)

28. 0.000 0.000 ↓ 0.0

Sort (cost=3,752.74..3,752.75 rows=1 width=88) (actual rows= loops=)

  • Sort Key: p.id, (initcap((p.name1)::text)), (initcap((p.name2)::text)), r_1.status, r_1.study_year_id
29. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.28..3,752.73 rows=1 width=88) (actual rows= loops=)

30. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.85..3,744.27 rows=1 width=24) (actual rows= loops=)

31. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..3,735.92 rows=1 width=8) (actual rows= loops=)

32. 0.000 0.000 ↓ 0.0

Seq Scan on register_person_role (cost=0.00..13.82 rows=482 width=16) (actual rows= loops=)

33. 0.000 0.000 ↓ 0.0

Index Scan using register_person_pkey on register_person (cost=0.42..7.71 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = register_person_role.register_person_id)
  • Filter: (user_person_id = '14812101711'::bigint)
34. 0.000 0.000 ↓ 0.0

Index Scan using role_pkey on role r_1 (cost=0.43..8.34 rows=1 width=32) (actual rows= loops=)

  • Index Cond: (id = register_person_role.social_workers_id)
  • Filter: ((type_id = 20) AND (institution_id = 35))
35. 0.000 0.000 ↓ 0.0

Index Scan using person_pkey on person p (cost=0.43..8.45 rows=1 width=22) (actual rows= loops=)

  • Index Cond: (id = r_1.person_id)
36. 0.000 0.000 ↓ 0.0

Unique (cost=166.53..166.55 rows=1 width=88) (actual rows= loops=)

37. 0.000 0.000 ↓ 0.0

Sort (cost=166.53..166.54 rows=1 width=88) (actual rows= loops=)

  • Sort Key: p_1.id, (initcap((p_1.name1)::text)), (initcap((p_1.name2)::text)), r_2.status, r_2.study_year_id
38. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.28..166.52 rows=1 width=88) (actual rows= loops=)

39. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.86..161.14 rows=1 width=24) (actual rows= loops=)

40. 0.000 0.000 ↓ 0.0

Index Scan using i_role_person on role role_1 (cost=0.43..42.84 rows=10 width=8) (actual rows= loops=)

  • Index Cond: (person_id = '14812101711'::bigint)
41. 0.000 0.000 ↓ 0.0

Index Scan using role_student on role r_2 (cost=0.43..11.82 rows=1 width=32) (actual rows= loops=)

  • Index Cond: (student_id = role_1.id)
  • Filter: ((type_id = 3) AND (institution_id = 35))
42. 0.000 0.000 ↓ 0.0

Index Scan using person_pkey on person p_1 (cost=0.43..5.37 rows=1 width=22) (actual rows= loops=)

  • Index Cond: (id = r_2.person_id)