explain.depesz.com

PostgreSQL's explain analyze made readable

Result: VQct

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

Aggregate (cost=10,458.25..10,458.26 rows=1 width=0) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

HashAggregate (cost=10,428.12..10,441.51 rows=1,339 width=127) (actual rows= loops=)

  • Group Key: t35.id, t35.deleted, t35.name, t35.main_account_id, t35.data_account_id, patients_person.partner_ptr_id, patients_person.created_at, patients_person.updated_at, patients_person.updated_by_id, patients_person.created_by_id, patients_person.firstname, patients_person.lastname, patients_person.birthdate, patients_person.deathdate, patients_person.email, patients_person.phone_number, patients_person.sex_id, patients_person.country_id, patients_person.user_id, patients_person.title_id
3. 0.000 0.000 ↓ 0.0

Nested Loop (cost=9,254.80..10,361.17 rows=1,339 width=127) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=9,254.52..9,910.64 rows=1,339 width=101) (actual rows= loops=)

  • Hash Cond: (t28.id = t29.sample_set_id)
  • Filter: (((t26.distribution_company_id = 27,731) AND (t26.ended_at IS NULL) AND (t26.started_at IS NOT NULL)) OR (patients_person.user_id = 13,463) OR ((t29.distribution_company_id = 27,731) AND (t29.ended_at IS NULL) AND (t29.started_at IS NOT NULL)) OR ((t33.distribution_company_id = 27,731) AND (t33.ended_at IS NULL) AND (t33.started_at IS NOT NULL)))
5. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=9,112.56..9,679.32 rows=7,879 width=145) (actual rows= loops=)

  • Hash Cond: (t28.oncologist_id = patients_oncologist.person_ptr_id)
6. 0.000 0.000 ↓ 0.0

Seq Scan on analyses_sampleset t28 (cost=0.00..415.99 rows=19,199 width=8) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Hash (cost=9,061.61..9,061.61 rows=4,076 width=145) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=8,497.01..9,061.61 rows=4,076 width=145) (actual rows= loops=)

  • Hash Cond: (t32.id = t33.sample_set_id)
9. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=8,355.05..8,883.80 rows=4,076 width=129) (actual rows= loops=)

  • Hash Cond: (t32.patient_case_id = t31.id)
10. 0.000 0.000 ↓ 0.0

Seq Scan on analyses_sampleset t32 (cost=0.00..415.99 rows=19,199 width=8) (actual rows= loops=)

11. 0.000 0.000 ↓ 0.0

Hash (cost=8,305.03..8,305.03 rows=4,002 width=129) (actual rows= loops=)

12. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=7,748.90..8,305.03 rows=4,002 width=129) (actual rows= loops=)

  • Hash Cond: (t31.patient_id = patients_patient.person_ptr_id)
13. 0.000 0.000 ↓ 0.0

Seq Scan on patients_patientcase t31 (cost=0.00..445.44 rows=18,844 width=8) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Hash (cost=7,698.99..7,698.99 rows=3,993 width=129) (actual rows= loops=)

15. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=7,023.16..7,698.99 rows=3,993 width=129) (actual rows= loops=)

  • Hash Cond: (t25.oncologist_id = patients_oncologist.person_ptr_id)
  • Filter: ((upper((patients_person.firstname)::text) ~~ '%@%'::text) OR (upper((patients_person.lastname)::text) ~~ '%@%'::text) OR (upper((patients_person.email)::text) ~~ '%@%'::text) OR (upper((t23.name)::text) ~~ '%@%'::text) OR (upper((t24.readable_id)::text) ~~ '%@%'::text) OR (upper((t25.readable_id)::text) ~~ '%@%'::text))
16. 0.000 0.000 ↓ 0.0

Seq Scan on patients_patientcase t25 (cost=0.00..445.44 rows=18,844 width=14) (actual rows= loops=)

17. 0.000 0.000 ↓ 0.0

Hash (cost=6,994.14..6,994.14 rows=2,322 width=152) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=6,454.81..6,994.14 rows=2,322 width=152) (actual rows= loops=)

  • Hash Cond: (t24.patient_id = patients_patient.person_ptr_id)
19. 0.000 0.000 ↓ 0.0

Seq Scan on patients_patientcase t24 (cost=0.00..445.44 rows=18,844 width=14) (actual rows= loops=)

20. 0.000 0.000 ↓ 0.0

Hash (cost=6,425.85..6,425.85 rows=2,317 width=142) (actual rows= loops=)

21. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=6,220.92..6,425.85 rows=2,317 width=142) (actual rows= loops=)

  • Hash Cond: (t20.distribution_company_id = t21.company_ptr_id)
22. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=6,052.76..6,225.83 rows=2,317 width=133) (actual rows= loops=)

  • Hash Cond: (t26.person_id = patients_person.partner_ptr_id)
23. 0.000 0.000 ↓ 0.0

Seq Scan on patients_personhandling t26 (cost=0.00..135.16 rows=8,216 width=24) (actual rows= loops=)

24. 0.000 0.000 ↓ 0.0

Hash (cost=6,023.80..6,023.80 rows=2,317 width=113) (actual rows= loops=)

25. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=5,850.73..6,023.80 rows=2,317 width=113) (actual rows= loops=)

  • Hash Cond: (t20.person_id = patients_person.partner_ptr_id)
26. 0.000 0.000 ↓ 0.0

Seq Scan on patients_personhandling t20 (cost=0.00..135.16 rows=8,216 width=8) (actual rows= loops=)

27. 0.000 0.000 ↓ 0.0

Hash (cost=5,821.77..5,821.77 rows=2,317 width=109) (actual rows= loops=)

28. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=5,212.98..5,821.77 rows=2,317 width=109) (actual rows= loops=)

  • Hash Cond: (t9.oncologist_id = patients_oncologist.person_ptr_id)
  • Filter: ((upper((patients_person.firstname)::text) ~~ '%@%'::text) OR (upper((patients_person.lastname)::text) ~~ '%@%'::text) OR (upper((patients_person.email)::text) ~~ '%@%'::text) OR (upper((patients_partner.name)::text) ~~ '%@%'::text) OR (upper((patients_patientcase.readable_id)::text) ~~ '%@%'::text) OR (upper((t9.readable_id)::text) ~~ '%@%'::text))
29. 0.000 0.000 ↓ 0.0

Seq Scan on patients_patientcase t9 (cost=0.00..445.44 rows=18,844 width=14) (actual rows= loops=)

30. 0.000 0.000 ↓ 0.0

Hash (cost=5,196.15..5,196.15 rows=1,347 width=132) (actual rows= loops=)

31. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=4,538.93..5,196.15 rows=1,347 width=132) (actual rows= loops=)

  • Hash Cond: (analyses_sampleset.id = patients_samplesethandling.sample_set_id)
  • Filter: (((t10.distribution_company_id = 27,731) AND (t10.ended_at IS NULL) AND (t10.started_at IS NOT NULL)) OR (patients_person.user_id = 13,463) OR ((patients_samplesethandling.distribution_company_id = 27,731) AND (patients_samplesethandling.ended_at IS NULL) AND (patients_samplesethandling.started_at IS NOT NULL)) OR ((t18.distribution_company_id = 27,731) AND (t18.ended_at IS NULL) AND (t18.started_at IS NOT NULL)))
32. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=4,396.97..4,964.25 rows=7,930 width=176) (actual rows= loops=)

  • Hash Cond: (analyses_sampleset.oncologist_id = patients_oncologist.person_ptr_id)
33. 0.000 0.000 ↓ 0.0

Seq Scan on analyses_sampleset (cost=0.00..415.99 rows=19,199 width=8) (actual rows= loops=)

34. 0.000 0.000 ↓ 0.0

Hash (cost=4,345.68..4,345.68 rows=4,103 width=172) (actual rows= loops=)

35. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=3,780.58..4,345.68 rows=4,103 width=172) (actual rows= loops=)

  • Hash Cond: (t17.id = t18.sample_set_id)
36. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=3,638.62..4,167.64 rows=4,103 width=156) (actual rows= loops=)

  • Hash Cond: (t17.patient_case_id = t16.id)
37. 0.000 0.000 ↓ 0.0

Seq Scan on analyses_sampleset t17 (cost=0.00..415.99 rows=19,199 width=8) (actual rows= loops=)

38. 0.000 0.000 ↓ 0.0

Hash (cost=3,588.27..3,588.27 rows=4,028 width=156) (actual rows= loops=)

39. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=3,031.89..3,588.27 rows=4,028 width=156) (actual rows= loops=)

  • Hash Cond: (t16.patient_id = patients_patient.person_ptr_id)
40. 0.000 0.000 ↓ 0.0

Seq Scan on patients_patientcase t16 (cost=0.00..445.44 rows=18,844 width=8) (actual rows= loops=)

41. 0.000 0.000 ↓ 0.0

Hash (cost=2,981.65..2,981.65 rows=4,019 width=152) (actual rows= loops=)

42. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=2,803.36..2,981.65 rows=4,019 width=152) (actual rows= loops=)

  • Hash Cond: (t10.person_id = patients_person.partner_ptr_id)
43. 0.000 0.000 ↓ 0.0

Seq Scan on patients_personhandling t10 (cost=0.00..135.16 rows=8,216 width=24) (actual rows= loops=)

44. 0.000 0.000 ↓ 0.0

Hash (cost=2,753.12..2,753.12 rows=4,019 width=132) (actual rows= loops=)

45. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=2,141.57..2,753.12 rows=4,019 width=132) (actual rows= loops=)

  • Hash Cond: (patients_personhandling.distribution_company_id = patients_distributioncompany.company_ptr_id)
46. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=1,973.41..2,529.71 rows=4,019 width=123) (actual rows= loops=)

  • Hash Cond: (patients_patientcase.patient_id = patients_patient.person_ptr_id)
47. 0.000 0.000 ↓ 0.0

Seq Scan on patients_patientcase (cost=0.00..445.44 rows=18,844 width=14) (actual rows= loops=)

48. 0.000 0.000 ↓ 0.0

Hash (cost=1,923.29..1,923.29 rows=4,010 width=113) (actual rows= loops=)

49. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=1,745.03..1,923.29 rows=4,010 width=113) (actual rows= loops=)

  • Hash Cond: (patients_personhandling.person_id = patients_person.partner_ptr_id)
50. 0.000 0.000 ↓ 0.0

Seq Scan on patients_personhandling (cost=0.00..135.16 rows=8,216 width=8) (actual rows= loops=)

51. 0.000 0.000 ↓ 0.0

Hash (cost=1,694.90..1,694.90 rows=4,010 width=109) (actual rows= loops=)

52. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=1,543.89..1,694.90 rows=4,010 width=109) (actual rows= loops=)

  • Hash Cond: (patients_oncologist.person_ptr_id = patients_person.partner_ptr_id)
53. 0.000 0.000 ↓ 0.0

Seq Scan on patients_oncologist (cost=0.00..110.75 rows=7,675 width=4) (actual rows= loops=)

54. 0.000 0.000 ↓ 0.0

Hash (cost=1,493.76..1,493.76 rows=4,010 width=105) (actual rows= loops=)

55. 0.000 0.000 ↓ 0.0

Hash Anti Join (cost=677.87..1,493.76 rows=4,010 width=105) (actual rows= loops=)

  • Hash Cond: (patients_person.partner_ptr_id = patients_patient.person_ptr_id)
56. 0.000 0.000 ↓ 0.0

Seq Scan on patients_person (cost=176.13..907.25 rows=13,115 width=101) (actual rows= loops=)

  • Filter: (((NOT (hashed SubPlan 1)) OR (user_id IS NULL)) AND ((NOT (hashed SubPlan 2)) OR (user_id IS NULL)))
57.          

SubPlan (for Seq Scan)

58. 0.000 0.000 ↓ 0.0

Nested Loop (cost=2.32..87.99 rows=29 width=4) (actual rows= loops=)

59. 0.000 0.000 ↓ 0.0

Index Scan using auth_group_name_a6ea08ec_like on auth_group u3 (cost=0.28..2.50 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((name)::text = 'SUPER_ADMINS'::text)
60. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on authentication_user_groups u2 (cost=2.04..84.66 rows=83 width=8) (actual rows= loops=)

  • Recheck Cond: (group_id = u3.id)
61. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on authentication_user_groups_0e939a4f (cost=0.00..2.02 rows=83 width=0) (actual rows= loops=)

  • Index Cond: (group_id = u3.id)
62. 0.000 0.000 ↓ 0.0

Nested Loop (cost=2.32..87.99 rows=29 width=4) (actual rows= loops=)

63. 0.000 0.000 ↓ 0.0

Index Scan using auth_group_name_a6ea08ec_like on auth_group u3_1 (cost=0.28..2.50 rows=1 width=4) (actual rows= loops=)

  • Index Cond: ((name)::text = 'SUPER_ADMINS'::text)
64. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on authentication_user_groups u2_1 (cost=2.04..84.66 rows=83 width=8) (actual rows= loops=)

  • Recheck Cond: (group_id = u3_1.id)
65. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on authentication_user_groups_0e939a4f (cost=0.00..2.02 rows=83 width=0) (actual rows= loops=)

  • Index Cond: (group_id = u3_1.id)
66. 0.000 0.000 ↓ 0.0

Hash (cost=269.11..269.11 rows=18,611 width=4) (actual rows= loops=)

67. 0.000 0.000 ↓ 0.0

Seq Scan on patients_patient (cost=0.00..269.11 rows=18,611 width=4) (actual rows= loops=)

68. 0.000 0.000 ↓ 0.0

Hash (cost=166.75..166.75 rows=113 width=17) (actual rows= loops=)

69. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=3.83..166.75 rows=113 width=17) (actual rows= loops=)

70. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=3.54..8.60 rows=113 width=8) (actual rows= loops=)

  • Hash Cond: (patients_company.partner_ptr_id = patients_distributioncompany.company_ptr_id)
71. 0.000 0.000 ↓ 0.0

Seq Scan on patients_company (cost=0.00..3.13 rows=213 width=4) (actual rows= loops=)

72. 0.000 0.000 ↓ 0.0

Hash (cost=2.13..2.13 rows=113 width=4) (actual rows= loops=)

73. 0.000 0.000 ↓ 0.0

Seq Scan on patients_distributioncompany (cost=0.00..2.13 rows=113 width=4) (actual rows= loops=)

74. 0.000 0.000 ↓ 0.0

Index Scan using patients_partner_id_8c95e9cc_uniq on patients_partner (cost=0.29..1.39 rows=1 width=17) (actual rows= loops=)

  • Index Cond: (patients_company.partner_ptr_id = id)
75. 0.000 0.000 ↓ 0.0

Hash (cost=80.87..80.87 rows=4,887 width=24) (actual rows= loops=)

76. 0.000 0.000 ↓ 0.0

Seq Scan on patients_samplesethandling t18 (cost=0.00..80.87 rows=4,887 width=24) (actual rows= loops=)

77. 0.000 0.000 ↓ 0.0

Hash (cost=80.87..80.87 rows=4,887 width=24) (actual rows= loops=)

78. 0.000 0.000 ↓ 0.0

Seq Scan on patients_samplesethandling (cost=0.00..80.87 rows=4,887 width=24) (actual rows= loops=)

79. 0.000 0.000 ↓ 0.0

Hash (cost=166.75..166.75 rows=113 width=17) (actual rows= loops=)

80. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=3.83..166.75 rows=113 width=17) (actual rows= loops=)

81. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=3.54..8.60 rows=113 width=8) (actual rows= loops=)

  • Hash Cond: (t22.partner_ptr_id = t21.company_ptr_id)
82. 0.000 0.000 ↓ 0.0

Seq Scan on patients_company t22 (cost=0.00..3.13 rows=213 width=4) (actual rows= loops=)

83. 0.000 0.000 ↓ 0.0

Hash (cost=2.13..2.13 rows=113 width=4) (actual rows= loops=)

84. 0.000 0.000 ↓ 0.0

Seq Scan on patients_distributioncompany t21 (cost=0.00..2.13 rows=113 width=4) (actual rows= loops=)

85. 0.000 0.000 ↓ 0.0

Index Scan using patients_partner_id_8c95e9cc_uniq on patients_partner t23 (cost=0.29..1.39 rows=1 width=17) (actual rows= loops=)

  • Index Cond: (t22.partner_ptr_id = id)
86. 0.000 0.000 ↓ 0.0

Hash (cost=80.87..80.87 rows=4,887 width=24) (actual rows= loops=)

87. 0.000 0.000 ↓ 0.0

Seq Scan on patients_samplesethandling t33 (cost=0.00..80.87 rows=4,887 width=24) (actual rows= loops=)

88. 0.000 0.000 ↓ 0.0

Hash (cost=80.87..80.87 rows=4,887 width=24) (actual rows= loops=)

89. 0.000 0.000 ↓ 0.0

Seq Scan on patients_samplesethandling t29 (cost=0.00..80.87 rows=4,887 width=24) (actual rows= loops=)

90. 0.000 0.000 ↓ 0.0

Index Scan using patients_partner_id_8c95e9cc_uniq on patients_partner t35 (cost=0.29..0.33 rows=1 width=26) (actual rows= loops=)

  • Index Cond: (id = patients_person.partner_ptr_id)