explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ZdWH : 1

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

Limit (cost=9,063,569.37..9,259,717.83 rows=11 width=233) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=9,063,569.37..10,293,955.18 rows=69 width=233) (actual rows= loops=)

  • Join Filter: (mhg2.id = md2.health_group_id)
3. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=9,063,569.37..9,123,352.94 rows=69 width=234) (actual rows= loops=)

  • Merge Cond: (mep.id = md2.id)
4. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=9,063,541.68..9,123,323.37 rows=69 width=229) (actual rows= loops=)

  • Join Filter: (ppa.party_id = i.id)
5. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=9,063,540.81..9,123,320.35 rows=69 width=229) (actual rows= loops=)

  • Join Filter: (mhg.id = md.health_group_id)
6. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=9,063,540.81..9,123,310.97 rows=69 width=226) (actual rows= loops=)

7. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=9,063,540.40..9,123,020.82 rows=69 width=220) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=9,063,539.83..9,122,738.70 rows=69 width=220) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=9,063,539.27..9,122,149.88 rows=69 width=216) (actual rows= loops=)

10. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=9,063,538.98..9,121,886.55 rows=69 width=212) (actual rows= loops=)

  • Join Filter: (ppr.id = (SubPlan 42))
11. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=9,063,538.55..9,121,046.90 rows=69 width=198) (actual rows= loops=)

  • Join Filter: (g.id = i.gender_id)
12. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=9,063,538.55..9,121,042.76 rows=69 width=178) (actual rows= loops=)

  • Filter: (mc.closing_step_id IS NULL)
13. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=9,063,537.98..9,092,028.26 rows=3,400 width=162) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=9,063,537.55..9,064,044.26 rows=3,400 width=103) (actual rows= loops=)

  • Merge Cond: (mep.id = mea.event_patient_id)
  • Filter: ((mea.denial IS NULL) OR (mea.denial IS FALSE))
15. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=9,060,351.97..9,060,678.34 rows=3,400 width=97) (actual rows= loops=)

  • Join Filter: (mar.id = mdoa.reason_id)
16. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=9,060,351.97..9,060,371.27 rows=3,400 width=59) (actual rows= loops=)

  • Merge Cond: (mep.id = mdoa.event_patient_id)
17. 0.000 0.000 ↓ 0.0

Sort (cost=9,060,318.25..9,060,326.75 rows=3,400 width=55) (actual rows= loops=)

  • Sort Key: mep.id
18. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..9,060,118.82 rows=3,400 width=55) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=0.00..12.46 rows=1 width=14) (actual rows= loops=)

  • Join Filter: (met.id = me.event_type)
20. 0.000 0.000 ↓ 0.0

Seq Scan on md_event me (cost=0.00..11.12 rows=1 width=12) (actual rows= loops=)

  • Filter: (id = 1436)
21. 0.000 0.000 ↓ 0.0

Seq Scan on md_event_type met (cost=0.00..1.15 rows=15 width=10) (actual rows= loops=)

22. 0.000 0.000 ↓ 0.0

Index Scan using idx_md_event_patient on md_event_patient mep (cost=0.42..9,060,072.36 rows=3,400 width=45) (actual rows= loops=)

  • Index Cond: (event_id = 1436)
  • Filter: ((is_deleted IS NOT TRUE) AND (case_id_2stage IS NULL) AND ((SubPlan 43) IS NOT TRUE))
23.          

SubPlan (forIndex Scan)

24. 0.000 0.000 ↓ 0.0

Merge Join (cost=85.07..1,115.59 rows=1 width=0) (actual rows= loops=)

  • Merge Cond: (ref.service_id = msr_4.id)
25. 0.000 0.000 ↓ 0.0

Index Only Scan using md_referral_to_service_fk on md_referral ref (cost=0.43..43,890.82 rows=1,680,426 width=4) (actual rows= loops=)

26. 0.000 0.000 ↓ 0.0

Sort (cost=84.52..86.09 rows=628 width=4) (actual rows= loops=)

  • Sort Key: msr_4.id
27. 0.000 0.000 ↓ 0.0

Index Scan using md_srv_rendered_case_id_idx on md_srv_rendered msr_4 (cost=0.57..55.33 rows=628 width=4) (actual rows= loops=)

  • Index Cond: (case_id = mep.case_id)
28. 0.000 0.000 ↓ 0.0

Sort (cost=33.72..34.82 rows=440 width=8) (actual rows= loops=)

  • Sort Key: mdoa.event_patient_id
29. 0.000 0.000 ↓ 0.0

Seq Scan on md_disp_orphans_absence mdoa (cost=0.00..14.40 rows=440 width=8) (actual rows= loops=)

30. 0.000 0.000 ↓ 0.0

Materialize (cost=0.00..1.09 rows=6 width=38) (actual rows= loops=)

31. 0.000 0.000 ↓ 0.0

Seq Scan on md_absence_reason mar (cost=0.00..1.06 rows=6 width=38) (actual rows= loops=)

32. 0.000 0.000 ↓ 0.0

Sort (cost=3,185.58..3,267.73 rows=32,858 width=10) (actual rows= loops=)

  • Sort Key: mea.event_patient_id
33. 0.000 0.000 ↓ 0.0

Seq Scan on md_event_agreement mea (cost=0.00..720.58 rows=32,858 width=10) (actual rows= loops=)

34. 0.000 0.000 ↓ 0.0

Index Scan using pim_individual_pk on pim_individual i (cost=0.43..8.22 rows=1 width=59) (actual rows= loops=)

  • Index Cond: (id = mep.indiv_id)
35. 0.000 0.000 ↓ 0.0

Index Scan using mc_case_pk on mc_case mc (cost=0.56..8.52 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (id = mep.case_id)
36. 0.000 0.000 ↓ 0.0

Materialize (cost=0.00..1.04 rows=3 width=24) (actual rows= loops=)

37. 0.000 0.000 ↓ 0.0

Seq Scan on pim_gender g (cost=0.00..1.03 rows=3 width=24) (actual rows= loops=)

38. 0.000 0.000 ↓ 0.0

Index Scan using pci_patient_reg_patient_id_idx on pci_patient_reg ppr (cost=0.43..3.69 rows=1 width=22) (actual rows= loops=)

  • Index Cond: (patient_id = i.id)
39.          

SubPlan (forNested Loop Left Join)

40. 0.000 0.000 ↓ 0.0

Aggregate (cost=8.46..8.46 rows=1 width=4) (actual rows= loops=)

41. 0.000 0.000 ↓ 0.0

Index Scan using pci_patient_reg_patient_id_number_attach_ix on pci_patient_reg ppr_1 (cost=0.43..8.45 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (patient_id = i.id)
  • Filter: ((unreg_dt IS NULL) AND (type_id = 1) AND (state_id = 1) AND (clinic_id = me.org_id))
42. 0.000 0.000 ↓ 0.0

Index Scan using md_event_planning_event_patient_id_key on md_event_planning meplan (cost=0.29..3.81 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
43. 0.000 0.000 ↓ 0.0

Index Scan using mc_case_pk on mc_case mc2 (cost=0.56..8.52 rows=1 width=12) (actual rows= loops=)

  • Index Cond: (id = mep.case_id_2stage)
44. 0.000 0.000 ↓ 0.0

Index Scan using mc_step_pk on mc_step mss (cost=0.56..4.08 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = mc.closing_step_id)
45. 0.000 0.000 ↓ 0.0

Index Scan using md_dispr_pkey on md_dispr md (cost=0.42..4.20 rows=1 width=10) (actual rows= loops=)

  • Index Cond: (id = mep.id)
46. 0.000 0.000 ↓ 0.0

Materialize (cost=0.00..1.12 rows=8 width=7) (actual rows= loops=)

47. 0.000 0.000 ↓ 0.0

Seq Scan on mc_health_group mhg (cost=0.00..1.08 rows=8 width=7) (actual rows= loops=)

48. 0.000 0.000 ↓ 0.0

Materialize (cost=0.86..1.99 rows=1 width=8) (actual rows= loops=)

49. 0.000 0.000 ↓ 0.0

Limit (cost=0.86..1.97 rows=1 width=8) (actual rows= loops=)

50. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=0.86..7,878,031.89 rows=7,102,805 width=8) (actual rows= loops=)

51. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.43..4,580,625.01 rows=7,102,805 width=8) (actual rows= loops=)

52. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.00..1,266,200.71 rows=7,102,805 width=4) (actual rows= loops=)

  • Join Filter: (ppatat.address_type_id = pat.id)
53. 0.000 0.000 ↓ 0.0

Seq Scan on pim_address_type pat (cost=0.00..1.07 rows=1 width=4) (actual rows= loops=)

  • Filter: ((code)::text = 'ACTUAL'::text)
54. 0.000 0.000 ↓ 0.0

Seq Scan on pim_party_addr_to_addr_type ppatat (cost=0.00..733,489.28 rows=42,616,828 width=8) (actual rows= loops=)

55. 0.000 0.000 ↓ 0.0

Index Scan using pim_party_address_pk on pim_party_address ppa (cost=0.43..0.46 rows=1 width=12) (actual rows= loops=)

  • Index Cond: (id = ppatat.party_address_id)
56. 0.000 0.000 ↓ 0.0

Index Only Scan using address_element_pkey on address_element ae (cost=0.43..0.45 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = ppa.addr_id)
57. 0.000 0.000 ↓ 0.0

Sort (cost=27.70..28.55 rows=340 width=9) (actual rows= loops=)

  • Sort Key: md2.id
58. 0.000 0.000 ↓ 0.0

Seq Scan on md_dispr_2_stage md2 (cost=0.00..13.40 rows=340 width=9) (actual rows= loops=)

59. 0.000 0.000 ↓ 0.0

Materialize (cost=0.00..1.12 rows=8 width=7) (actual rows= loops=)

60. 0.000 0.000 ↓ 0.0

Seq Scan on mc_health_group mhg2 (cost=0.00..1.08 rows=8 width=7) (actual rows= loops=)

61.          

SubPlan (forNested Loop Left Join)

62. 0.000 0.000 ↓ 0.0

Limit (cost=1.13..14.21 rows=1 width=0) (actual rows= loops=)

63. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.13..53.45 rows=4 width=0) (actual rows= loops=)

64. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.70..39.97 rows=4 width=4) (actual rows= loops=)

65. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..10.29 rows=4 width=4) (actual rows= loops=)

  • Join Filter: (mesp.status = mess.id)
66. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_patient__event_patient_id_ix on md_event_service_patient mesp (cost=0.42..8.95 rows=9 width=8) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
67. 0.000 0.000 ↓ 0.0

Materialize (cost=0.00..1.07 rows=2 width=4) (actual rows= loops=)

68. 0.000 0.000 ↓ 0.0

Seq Scan on md_event_service_status mess (cost=0.00..1.06 rows=2 width=4) (actual rows= loops=)

  • Filter: ((code = 4) OR (code = 3))
69. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_pkey on md_event_service mes (cost=0.28..7.41 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = mesp.service_id)
70. 0.000 0.000 ↓ 0.0

Index Only Scan using sr_service_pk on sr_service ss (cost=0.43..3.36 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mes.service_id)
71. 0.000 0.000 ↓ 0.0

Aggregate (cost=84.98..84.99 rows=1 width=4) (actual rows= loops=)

72. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.84..84.98 rows=1 width=4) (actual rows= loops=)

73. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_patient__event_patient_id_ix on md_event_service_patient mesp_1 (cost=0.42..8.95 rows=9 width=4) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
74. 0.000 0.000 ↓ 0.0

Index Scan using idx_md_event_service_patient_agreement on md_event_service_patient_agreement mespa (cost=0.42..8.44 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (service_id = mesp_1.id)
  • Filter: denial
75. 0.000 0.000 ↓ 0.0

Limit (cost=0.15..8.17 rows=1 width=4) (actual rows= loops=)

76. 0.000 0.000 ↓ 0.0

Index Scan using mdk_log_event_patient_id_idx on mdk_log ml (cost=0.15..8.17 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
  • Filter: (status = ANY ('{1,3}'::integer[]))
77. 0.000 0.000 ↓ 0.0

Limit (cost=0.15..8.17 rows=1 width=4) (actual rows= loops=)

78. 0.000 0.000 ↓ 0.0

Index Scan using mdk_log_event_patient_id_idx on mdk_log ml_1 (cost=0.15..8.17 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
  • Filter: (status = ANY ('{1,3}'::integer[]))
79. 0.000 0.000 ↓ 0.0

Limit (cost=2.26..2,233.14 rows=1 width=4) (actual rows= loops=)

80. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=2.26..2,233.14 rows=1 width=4) (actual rows= loops=)

  • Join Filter: (ssr.service_id = mes_1.service_id)
81. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.12..98.15 rows=1 width=8) (actual rows= loops=)

82. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.70..89.70 rows=1 width=8) (actual rows= loops=)

  • Join Filter: (mes_1.doc_service_id = mnds.id)
83. 0.000 0.000 ↓ 0.0

Seq Scan on md_norm_document_service mnds (cost=0.00..13.40 rows=4 width=4) (actual rows= loops=)

  • Filter: ((code)::text = 'Д1.02'::text)
84. 0.000 0.000 ↓ 0.0

Materialize (cost=0.70..75.79 rows=9 width=12) (actual rows= loops=)

85. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.70..75.74 rows=9 width=12) (actual rows= loops=)

86. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_patient__event_patient_id_ix on md_event_service_patient mesp_2 (cost=0.42..8.95 rows=9 width=8) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
87. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_pkey on md_event_service mes_1 (cost=0.28..7.41 rows=1 width=12) (actual rows= loops=)

  • Index Cond: (id = mesp_2.service_id)
88. 0.000 0.000 ↓ 0.0

Index Scan using md_event_patient_pkey on md_event_patient mep1 (cost=0.42..8.44 rows=1 width=12) (actual rows= loops=)

  • Index Cond: (id = mep.id)
89. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.14..2,127.21 rows=623 width=12) (actual rows= loops=)

90. 0.000 0.000 ↓ 0.0

Index Scan using md_srv_rendered_case_id_idx on md_srv_rendered msr (cost=0.57..55.33 rows=628 width=8) (actual rows= loops=)

  • Index Cond: (case_id = mep1.case_id)
91. 0.000 0.000 ↓ 0.0

Index Scan using sr_srv_rendered_pk on sr_srv_rendered ssr (cost=0.57..3.29 rows=1 width=12) (actual rows= loops=)

  • Index Cond: (id = msr.id)
92. 0.000 0.000 ↓ 0.0

Limit (cost=0.42..2.89 rows=1 width=0) (actual rows= loops=)

93. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..10.29 rows=4 width=0) (actual rows= loops=)

  • Join Filter: (mesp_3.status = mess_1.code)
94. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_patient__event_patient_id_ix on md_event_service_patient mesp_3 (cost=0.42..8.95 rows=9 width=4) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
95. 0.000 0.000 ↓ 0.0

Materialize (cost=0.00..1.07 rows=2 width=4) (actual rows= loops=)

96. 0.000 0.000 ↓ 0.0

Seq Scan on md_event_service_status mess_1 (cost=0.00..1.06 rows=2 width=4) (actual rows= loops=)

  • Filter: ((code = 3) OR (code = 4))
97. 0.000 0.000 ↓ 0.0

Index Scan using idx_md_disp_orphans_result_event_patient on md_disp_orphans_result mdor1 (cost=0.29..8.66 rows=1 width=1) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
  • Filter: ((is_before IS NULL) AND is_2_stage)
98. 0.000 0.000 ↓ 0.0

Limit (cost=0.29..9.84 rows=1 width=3) (actual rows= loops=)

99. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.29..9.84 rows=1 width=3) (actual rows= loops=)

  • Join Filter: (mhg_1.id = mdor.health_group_id)
100. 0.000 0.000 ↓ 0.0

Index Scan using idx_md_disp_orphans_result_event_patient on md_disp_orphans_result mdor (cost=0.29..8.66 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
  • Filter: ((is_before IS NOT TRUE) AND (is_2_stage IS NOT TRUE))
101. 0.000 0.000 ↓ 0.0

Seq Scan on mc_health_group mhg_1 (cost=0.00..1.08 rows=8 width=7) (actual rows= loops=)

102. 0.000 0.000 ↓ 0.0

Limit (cost=0.29..9.84 rows=1 width=3) (actual rows= loops=)

103. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.29..9.84 rows=1 width=3) (actual rows= loops=)

  • Join Filter: (mhg_2.id = mdor_1.health_group_id)
104. 0.000 0.000 ↓ 0.0

Index Scan using idx_md_disp_orphans_result_event_patient on md_disp_orphans_result mdor_1 (cost=0.29..8.66 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
  • Filter: ((is_before IS NOT TRUE) AND (is_2_stage IS TRUE))
105. 0.000 0.000 ↓ 0.0

Seq Scan on mc_health_group mhg_2 (cost=0.00..1.08 rows=8 width=7) (actual rows= loops=)

106. 0.000 0.000 ↓ 0.0

Limit (cost=0.84..2.65 rows=1 width=0) (actual rows= loops=)

107. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.84..17.10 rows=9 width=0) (actual rows= loops=)

108. 0.000 0.000 ↓ 0.0

Index Only Scan using md_event_patient_pkey on md_event_patient mep1_1 (cost=0.42..8.44 rows=1 width=0) (actual rows= loops=)

  • Index Cond: (id = mep.id)
109. 0.000 0.000 ↓ 0.0

Index Only Scan using md_event_service_patient__event_patient_id_ix on md_event_service_patient mesp_4 (cost=0.42..8.58 rows=9 width=0) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
110. 0.000 0.000 ↓ 0.0

Result (cost=0.00..0.26 rows=1 width=0) (actual rows= loops=)

111. 0.000 0.000 ↓ 0.0

Aggregate (cost=4,456.13..4,456.14 rows=1 width=8) (actual rows= loops=)

112. 0.000 0.000 ↓ 0.0

Append (cost=2,228.04..4,456.12 rows=2 width=8) (actual rows= loops=)

113. 0.000 0.000 ↓ 0.0

Aggregate (cost=2,228.04..2,228.05 rows=1 width=4) (actual rows= loops=)

114. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=2.40..2,228.04 rows=1 width=4) (actual rows= loops=)

  • Join Filter: (ssr_1.service_id = mes_2.service_id)
115. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.27..93.04 rows=1 width=8) (actual rows= loops=)

116. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.85..84.60 rows=1 width=8) (actual rows= loops=)

117. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.70..75.74 rows=9 width=12) (actual rows= loops=)

118. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_patient__event_patient_id_ix on md_event_service_patient mesp_5 (cost=0.42..8.95 rows=9 width=8) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
119. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_pkey on md_event_service mes_2 (cost=0.28..7.41 rows=1 width=12) (actual rows= loops=)

  • Index Cond: (id = mesp_5.service_id)
120. 0.000 0.000 ↓ 0.0

Index Scan using md_norm_document_service_pk on md_norm_document_service mnds_1 (cost=0.15..0.97 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mes_2.doc_service_id)
  • Filter: ((code)::text = 'Д1.02'::text)
121. 0.000 0.000 ↓ 0.0

Index Scan using md_event_patient_pkey on md_event_patient mep4 (cost=0.42..8.44 rows=1 width=12) (actual rows= loops=)

  • Index Cond: (id = mep.id)
122. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.14..2,127.21 rows=623 width=12) (actual rows= loops=)

123. 0.000 0.000 ↓ 0.0

Index Scan using md_srv_rendered_case_id_idx on md_srv_rendered msr_1 (cost=0.57..55.33 rows=628 width=8) (actual rows= loops=)

  • Index Cond: (case_id = mep4.case_id)
124. 0.000 0.000 ↓ 0.0

Index Scan using sr_srv_rendered_pk on sr_srv_rendered ssr_1 (cost=0.57..3.29 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = msr_1.id)
125. 0.000 0.000 ↓ 0.0

Aggregate (cost=2,228.04..2,228.05 rows=1 width=4) (actual rows= loops=)

126. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=2.40..2,228.04 rows=1 width=4) (actual rows= loops=)

  • Join Filter: (ssr_2.service_id = mes_3.service_id)
127. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.27..93.04 rows=1 width=8) (actual rows= loops=)

128. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.85..84.60 rows=1 width=8) (actual rows= loops=)

129. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.70..75.74 rows=9 width=12) (actual rows= loops=)

130. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_patient__event_patient_id_ix on md_event_service_patient mesp_6 (cost=0.42..8.95 rows=9 width=8) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
131. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_pkey on md_event_service mes_3 (cost=0.28..7.41 rows=1 width=12) (actual rows= loops=)

  • Index Cond: (id = mesp_6.service_id)
132. 0.000 0.000 ↓ 0.0

Index Scan using md_norm_document_service_pk on md_norm_document_service mnds_2 (cost=0.15..0.97 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mes_3.doc_service_id)
  • Filter: ((code)::text = 'Д1.04'::text)
133. 0.000 0.000 ↓ 0.0

Index Scan using md_event_patient_pkey on md_event_patient mep5 (cost=0.42..8.44 rows=1 width=12) (actual rows= loops=)

  • Index Cond: (id = mep.id)
134. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.14..2,127.21 rows=623 width=12) (actual rows= loops=)

135. 0.000 0.000 ↓ 0.0

Index Scan using md_srv_rendered_case_id_idx on md_srv_rendered msr_2 (cost=0.57..55.33 rows=628 width=8) (actual rows= loops=)

  • Index Cond: (case_id = mep5.case_id)
136. 0.000 0.000 ↓ 0.0

Index Scan using sr_srv_rendered_pk on sr_srv_rendered ssr_2 (cost=0.57..3.29 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = msr_2.id)
137. 0.000 0.000 ↓ 0.0

Aggregate (cost=93.53..93.54 rows=1 width=4) (actual rows= loops=)

138. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1.26..93.51 rows=9 width=4) (actual rows= loops=)

139. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.84..17.48 rows=9 width=4) (actual rows= loops=)

140. 0.000 0.000 ↓ 0.0

Index Only Scan using md_event_patient_pkey on md_event_patient mep1_2 (cost=0.42..8.44 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mep.id)
141. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_patient__event_patient_id_ix on md_event_service_patient mesp_7 (cost=0.42..8.95 rows=9 width=12) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
142. 0.000 0.000 ↓ 0.0

Index Scan using idx_md_event_service_patient_agreement on md_event_service_patient_agreement mespa_1 (cost=0.42..8.44 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (service_id = mesp_7.id)
143. 0.000 0.000 ↓ 0.0

Aggregate (cost=17.51..17.52 rows=1 width=4) (actual rows= loops=)

144. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.84..17.49 rows=8 width=4) (actual rows= loops=)

145. 0.000 0.000 ↓ 0.0

Index Only Scan using md_event_patient_pkey on md_event_patient mep3 (cost=0.42..8.44 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mep.id)
146. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_patient__event_patient_id_ix on md_event_service_patient mesp3 (cost=0.42..8.97 rows=8 width=4) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
  • Filter: (status = 4)
147. 0.000 0.000 ↓ 0.0

Result (cost=0.00..0.26 rows=1 width=0) (actual rows= loops=)

148. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1.13..17.18 rows=1 width=4) (actual rows= loops=)

149. 0.000 0.000 ↓ 0.0

Index Scan using mc_case_pk on mc_case mc_1 (cost=0.56..8.58 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mep.case_id)
150. 0.000 0.000 ↓ 0.0

Index Scan using mc_step_pk on mc_step ms (cost=0.56..8.58 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = mc_1.closing_step_id)
151. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1.13..17.18 rows=1 width=4) (actual rows= loops=)

152. 0.000 0.000 ↓ 0.0

Index Scan using mc_case_pk on mc_case mc_2 (cost=0.56..8.58 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mep.case_id)
153. 0.000 0.000 ↓ 0.0

Index Scan using mc_step_pk on mc_step ms_1 (cost=0.56..8.58 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = mc_2.closing_step_id)
154. 0.000 0.000 ↓ 0.0

Aggregate (cost=14.03..14.05 rows=1 width=17) (actual rows= loops=)

155. 0.000 0.000 ↓ 0.0

Nested Loop (cost=7.52..14.03 rows=1 width=17) (actual rows= loops=)

  • Join Filter: (mid.id = midep.invalid_data_id)
156. 0.000 0.000 ↓ 0.0

Seq Scan on mdk_invalid_data mid (cost=0.00..1.04 rows=4 width=21) (actual rows= loops=)

157. 0.000 0.000 ↓ 0.0

Materialize (cost=7.52..12.87 rows=2 width=4) (actual rows= loops=)

158. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on mdk_invalid_data_event_patient midep (cost=7.52..12.86 rows=2 width=4) (actual rows= loops=)

  • Recheck Cond: (event_patient_id = mep.id)
159. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on mdk_invalid_data_event_patient_key (cost=0.00..7.52 rows=2 width=0) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
160. 0.000 0.000 ↓ 0.0

Result (cost=7.81..7.82 rows=1 width=0) (actual rows= loops=)

161.          

Initplan (forResult)

162. 0.000 0.000 ↓ 0.0

Seq Scan on mdk_invalid_data_event_patient midep_1 (cost=0.00..15.62 rows=2 width=0) (actual rows= loops=)

  • Filter: (event_patient_id = mep.id)
163. 0.000 0.000 ↓ 0.0

Aggregate (cost=8,502.05..8,502.06 rows=1 width=4) (actual rows= loops=)

164. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.13..8,501.02 rows=411 width=4) (actual rows= loops=)

165. 0.000 0.000 ↓ 0.0

Index Scan using md_srv_rendered_case_id_idx on md_srv_rendered msr_3 (cost=0.57..55.33 rows=628 width=4) (actual rows= loops=)

  • Index Cond: (mc.id = case_id)
166. 0.000 0.000 ↓ 0.0

Index Scan using fin_bill_spec_item_service_id_idx on fin_bill_spec_item fbsi (cost=0.56..13.40 rows=5 width=8) (actual rows= loops=)

  • Index Cond: (service_id = msr_3.id)
167. 0.000 0.000 ↓ 0.0

Index Only Scan using md_event_questioning_pkey on md_event_questioning questioning (cost=0.42..8.44 rows=1 width=0) (actual rows= loops=)

  • Index Cond: (id = mep.id)
168. 0.000 0.000 ↓ 0.0

Seq Scan on md_event_questioning questioning_1 (cost=0.00..2,640.53 rows=128,153 width=4) (actual rows= loops=)

169. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.69..97.82 rows=1 width=0) (actual rows= loops=)

170. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.42..97.46 rows=1 width=4) (actual rows= loops=)

171. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.27..89.28 rows=1 width=4) (actual rows= loops=)

172. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.85..80.83 rows=1 width=0) (actual rows= loops=)

  • Join Filter: ((mnds_3.code)::text = (sf.service_code)::text)
173. 0.000 0.000 ↓ 0.0

Seq Scan on service_n2o_form sf (cost=0.00..3.31 rows=1 width=7) (actual rows= loops=)

  • Filter: ((n2o_form)::text = 'disprCardRenderingServiceQuestioningEvent'::text)
174. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.85..77.41 rows=9 width=7) (actual rows= loops=)

175. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.70..75.74 rows=9 width=4) (actual rows= loops=)

176. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_patient__event_patient_id_ix on md_event_service_patient mesp_8 (cost=0.42..8.95 rows=9 width=4) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
177. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_pkey on md_event_service mes_4 (cost=0.28..7.41 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = mesp_8.service_id)
178. 0.000 0.000 ↓ 0.0

Index Scan using md_norm_document_service_pk on md_norm_document_service mnds_3 (cost=0.15..0.18 rows=1 width=11) (actual rows= loops=)

  • Index Cond: (id = mes_4.doc_service_id)
179. 0.000 0.000 ↓ 0.0

Index Scan using md_event_patient_pkey on md_event_patient mep1_3 (cost=0.42..8.44 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mep.id)
180. 0.000 0.000 ↓ 0.0

Index Scan using md_events_pkey on md_event me_1 (cost=0.15..8.17 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = mep1_3.event_id)
181. 0.000 0.000 ↓ 0.0

Index Only Scan using md_standard_pk on md_standard ms_2 (cost=0.28..0.35 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = me_1.standard_id)
182. 0.000 0.000 ↓ 0.0

Limit (cost=1.69..97.82 rows=1 width=7) (actual rows= loops=)

183. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.69..97.82 rows=1 width=7) (actual rows= loops=)

184. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.42..97.46 rows=1 width=11) (actual rows= loops=)

185. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.27..89.28 rows=1 width=11) (actual rows= loops=)

186. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.85..80.83 rows=1 width=7) (actual rows= loops=)

  • Join Filter: ((mnds_4.code)::text = (sf_1.service_code)::text)
187. 0.000 0.000 ↓ 0.0

Seq Scan on service_n2o_form sf_1 (cost=0.00..3.31 rows=1 width=7) (actual rows= loops=)

  • Filter: ((n2o_form)::text = 'disprCardRenderingServiceQuestioningEvent'::text)
188. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.85..77.41 rows=9 width=7) (actual rows= loops=)

189. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.70..75.74 rows=9 width=4) (actual rows= loops=)

190. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_patient__event_patient_id_ix on md_event_service_patient mesp_9 (cost=0.42..8.95 rows=9 width=4) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
191. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_pkey on md_event_service mes_5 (cost=0.28..7.41 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = mesp_9.service_id)
192. 0.000 0.000 ↓ 0.0

Index Scan using md_norm_document_service_pk on md_norm_document_service mnds_4 (cost=0.15..0.18 rows=1 width=11) (actual rows= loops=)

  • Index Cond: (id = mes_5.doc_service_id)
193. 0.000 0.000 ↓ 0.0

Index Scan using md_event_patient_pkey on md_event_patient mep1_4 (cost=0.42..8.44 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mep.id)
194. 0.000 0.000 ↓ 0.0

Index Scan using md_events_pkey on md_event me_2 (cost=0.15..8.17 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = mep1_4.event_id)
195. 0.000 0.000 ↓ 0.0

Index Only Scan using md_standard_pk on md_standard ms_3 (cost=0.28..0.35 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = me_2.standard_id)
196. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.69..97.82 rows=1 width=0) (actual rows= loops=)

197. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.42..97.46 rows=1 width=4) (actual rows= loops=)

198. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.27..89.28 rows=1 width=4) (actual rows= loops=)

199. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.85..80.83 rows=1 width=0) (actual rows= loops=)

  • Join Filter: ((mnds_5.code)::text = (sf_2.service_code)::text)
200. 0.000 0.000 ↓ 0.0

Seq Scan on service_n2o_form sf_2 (cost=0.00..3.31 rows=1 width=7) (actual rows= loops=)

  • Filter: ((n2o_form)::text = 'disprCardRenderingServiceAnthropomentry'::text)
201. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.85..77.41 rows=9 width=7) (actual rows= loops=)

202. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.70..75.74 rows=9 width=4) (actual rows= loops=)

203. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_patient__event_patient_id_ix on md_event_service_patient mesp_10 (cost=0.42..8.95 rows=9 width=4) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
204. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_pkey on md_event_service mes_6 (cost=0.28..7.41 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = mesp_10.service_id)
205. 0.000 0.000 ↓ 0.0

Index Scan using md_norm_document_service_pk on md_norm_document_service mnds_5 (cost=0.15..0.18 rows=1 width=11) (actual rows= loops=)

  • Index Cond: (id = mes_6.doc_service_id)
206. 0.000 0.000 ↓ 0.0

Index Scan using md_event_patient_pkey on md_event_patient mep1_5 (cost=0.42..8.44 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mep.id)
207. 0.000 0.000 ↓ 0.0

Index Scan using md_events_pkey on md_event me_3 (cost=0.15..8.17 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = mep1_5.event_id)
208. 0.000 0.000 ↓ 0.0

Index Only Scan using md_standard_pk on md_standard ms_4 (cost=0.28..0.35 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = me_3.standard_id)
209. 0.000 0.000 ↓ 0.0

Limit (cost=1.69..97.82 rows=1 width=7) (actual rows= loops=)

210. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.69..97.82 rows=1 width=7) (actual rows= loops=)

211. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.42..97.46 rows=1 width=11) (actual rows= loops=)

212. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.27..89.28 rows=1 width=11) (actual rows= loops=)

213. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.85..80.83 rows=1 width=7) (actual rows= loops=)

  • Join Filter: ((mnds_6.code)::text = (sf_3.service_code)::text)
214. 0.000 0.000 ↓ 0.0

Seq Scan on service_n2o_form sf_3 (cost=0.00..3.31 rows=1 width=7) (actual rows= loops=)

  • Filter: ((n2o_form)::text = 'disprCardRenderingServiceAnthropomentry'::text)
215. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.85..77.41 rows=9 width=7) (actual rows= loops=)

216. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.70..75.74 rows=9 width=4) (actual rows= loops=)

217. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_patient__event_patient_id_ix on md_event_service_patient mesp_11 (cost=0.42..8.95 rows=9 width=4) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
218. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_pkey on md_event_service mes_7 (cost=0.28..7.41 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = mesp_11.service_id)
219. 0.000 0.000 ↓ 0.0

Index Scan using md_norm_document_service_pk on md_norm_document_service mnds_6 (cost=0.15..0.18 rows=1 width=11) (actual rows= loops=)

  • Index Cond: (id = mes_7.doc_service_id)
220. 0.000 0.000 ↓ 0.0

Index Scan using md_event_patient_pkey on md_event_patient mep1_6 (cost=0.42..8.44 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mep.id)
221. 0.000 0.000 ↓ 0.0

Index Scan using md_events_pkey on md_event me_4 (cost=0.15..8.17 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = mep1_6.event_id)
222. 0.000 0.000 ↓ 0.0

Index Only Scan using md_standard_pk on md_standard ms_5 (cost=0.28..0.35 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = me_4.standard_id)
223. 0.000 0.000 ↓ 0.0

Limit (cost=1.12..84.19 rows=1 width=4) (actual rows= loops=)

224. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.12..84.19 rows=1 width=4) (actual rows= loops=)

225. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.70..75.74 rows=1 width=8) (actual rows= loops=)

226. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_patient__event_patient_id_ix on md_event_service_patient mesp_12 (cost=0.42..8.95 rows=9 width=12) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
227. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_pkey on md_event_service mes_8 (cost=0.28..7.41 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mesp_12.service_id)
  • Filter: (first IS TRUE)
228. 0.000 0.000 ↓ 0.0

Index Only Scan using md_event_patient_pkey on md_event_patient mep1_7 (cost=0.42..8.44 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mep.id)
229. 0.000 0.000 ↓ 0.0

Limit (cost=1.27..84.85 rows=1 width=7) (actual rows= loops=)

230. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1.27..84.85 rows=1 width=7) (actual rows= loops=)

231. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.12..84.19 rows=1 width=4) (actual rows= loops=)

232. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.70..75.74 rows=1 width=8) (actual rows= loops=)

233. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_patient__event_patient_id_ix on md_event_service_patient mesp_13 (cost=0.42..8.95 rows=9 width=8) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
234. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_pkey on md_event_service mes_9 (cost=0.28..7.41 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = mesp_13.service_id)
  • Filter: (first IS TRUE)
235. 0.000 0.000 ↓ 0.0

Index Only Scan using md_event_patient_pkey on md_event_patient mep1_8 (cost=0.42..8.44 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mep.id)
236. 0.000 0.000 ↓ 0.0

Index Scan using md_norm_document_service_pk on md_norm_document_service mnds_7 (cost=0.15..0.65 rows=1 width=11) (actual rows= loops=)

  • Index Cond: (id = mes_9.doc_service_id)
237. 0.000 0.000 ↓ 0.0

Limit (cost=1.79..88.33 rows=1 width=35) (actual rows= loops=)

238. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.79..88.33 rows=1 width=35) (actual rows= loops=)

239. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1.37..79.87 rows=1 width=39) (actual rows= loops=)

240. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.70..75.74 rows=1 width=8) (actual rows= loops=)

241. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_patient__event_patient_id_ix on md_event_service_patient mesp_14 (cost=0.42..8.95 rows=9 width=8) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
242. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_pkey on md_event_service mes_10 (cost=0.28..7.41 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = mesp_14.service_id)
  • Filter: (first IS TRUE)
243. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=0.67..4.12 rows=1 width=39) (actual rows= loops=)

  • Hash Cond: ((n2oform.service_code)::text = (mnds_8.code)::text)
244. 0.000 0.000 ↓ 0.0

Seq Scan on service_n2o_form n2oform (cost=0.00..3.05 rows=105 width=35) (actual rows= loops=)

245. 0.000 0.000 ↓ 0.0

Hash (cost=0.65..0.65 rows=1 width=11) (actual rows= loops=)

246. 0.000 0.000 ↓ 0.0

Index Scan using md_norm_document_service_pk on md_norm_document_service mnds_8 (cost=0.15..0.65 rows=1 width=11) (actual rows= loops=)

  • Index Cond: (id = mes_10.doc_service_id)
247. 0.000 0.000 ↓ 0.0

Index Only Scan using md_event_patient_pkey on md_event_patient mep1_9 (cost=0.42..8.44 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mep.id)
248. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.12..84.19 rows=1 width=0) (actual rows= loops=)

249. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.70..75.74 rows=1 width=4) (actual rows= loops=)

250. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_patient__event_patient_id_ix on md_event_service_patient mesp_15 (cost=0.42..8.95 rows=9 width=8) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
251. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_pkey on md_event_service mes_11 (cost=0.28..7.41 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mesp_15.service_id)
  • Filter: (first IS TRUE)
252. 0.000 0.000 ↓ 0.0

Index Only Scan using md_event_patient_pkey on md_event_patient mep1_10 (cost=0.42..8.44 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mep.id)
253. 0.000 0.000 ↓ 0.0

Nested Loop (cost=110.11..6,229.67 rows=3,451 width=4) (actual rows= loops=)

254. 0.000 0.000 ↓ 0.0

Hash Join (cost=109.69..4,643.52 rows=3,451 width=4) (actual rows= loops=)

  • Hash Cond: (mesp_16.service_id = mes_12.id)
255. 0.000 0.000 ↓ 0.0

Seq Scan on md_event_service_patient mesp_16 (cost=0.00..3,885.59 rows=163,659 width=8) (actual rows= loops=)

256. 0.000 0.000 ↓ 0.0

Hash (cost=108.47..108.47 rows=98 width=4) (actual rows= loops=)

257. 0.000 0.000 ↓ 0.0

Seq Scan on md_event_service mes_12 (cost=0.00..108.47 rows=98 width=4) (actual rows= loops=)

  • Filter: (first IS TRUE)
258. 0.000 0.000 ↓ 0.0

Index Only Scan using md_event_patient_pkey on md_event_patient mep1_11 (cost=0.42..0.45 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mesp_16.event_patient_id)
259. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.69..96.72 rows=1 width=0) (actual rows= loops=)

  • Join Filter: ((mnds_9.code)::text = (sf_4.service_code)::text)
260. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.69..93.39 rows=1 width=7) (actual rows= loops=)

261. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.54..92.73 rows=1 width=4) (actual rows= loops=)

262. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.27..92.36 rows=1 width=8) (actual rows= loops=)

263. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.12..84.19 rows=1 width=8) (actual rows= loops=)

264. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.70..75.74 rows=1 width=4) (actual rows= loops=)

265. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_patient__event_patient_id_ix on md_event_service_patient mesp_17 (cost=0.42..8.95 rows=9 width=4) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
266. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_pkey on md_event_service mes_13 (cost=0.28..7.41 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = mesp_17.service_id)
  • Filter: (first IS TRUE)
267. 0.000 0.000 ↓ 0.0

Index Scan using md_event_patient_pkey on md_event_patient mep1_12 (cost=0.42..8.44 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mep.id)
268. 0.000 0.000 ↓ 0.0

Index Scan using md_events_pkey on md_event me_5 (cost=0.15..8.17 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = mep1_12.event_id)
269. 0.000 0.000 ↓ 0.0

Index Only Scan using md_standard_pk on md_standard ms_6 (cost=0.28..0.35 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = me_5.standard_id)
270. 0.000 0.000 ↓ 0.0

Index Scan using md_norm_document_service_pk on md_norm_document_service mnds_9 (cost=0.15..0.65 rows=1 width=11) (actual rows= loops=)

  • Index Cond: (id = mes_13.doc_service_id)
271. 0.000 0.000 ↓ 0.0

Seq Scan on service_n2o_form sf_4 (cost=0.00..3.31 rows=1 width=7) (actual rows= loops=)

  • Filter: ((n2o_form)::text = 'disprCardRenderingServiceQuestioningEvent'::text)
272. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.69..96.72 rows=1 width=0) (actual rows= loops=)

  • Join Filter: ((mnds_10.code)::text = (sf_5.service_code)::text)
273. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.69..93.39 rows=1 width=7) (actual rows= loops=)

274. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.54..92.73 rows=1 width=4) (actual rows= loops=)

275. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.27..92.36 rows=1 width=8) (actual rows= loops=)

276. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.12..84.19 rows=1 width=8) (actual rows= loops=)

277. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.70..75.74 rows=1 width=4) (actual rows= loops=)

278. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_patient__event_patient_id_ix on md_event_service_patient mesp_18 (cost=0.42..8.95 rows=9 width=4) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
279. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_pkey on md_event_service mes_14 (cost=0.28..7.41 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = mesp_18.service_id)
  • Filter: (first IS TRUE)
280. 0.000 0.000 ↓ 0.0

Index Scan using md_event_patient_pkey on md_event_patient mep1_13 (cost=0.42..8.44 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mep.id)
281. 0.000 0.000 ↓ 0.0

Index Scan using md_events_pkey on md_event me_6 (cost=0.15..8.17 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = mep1_13.event_id)
282. 0.000 0.000 ↓ 0.0

Index Only Scan using md_standard_pk on md_standard ms_7 (cost=0.28..0.35 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = me_6.standard_id)
283. 0.000 0.000 ↓ 0.0

Index Scan using md_norm_document_service_pk on md_norm_document_service mnds_10 (cost=0.15..0.65 rows=1 width=11) (actual rows= loops=)

  • Index Cond: (id = mes_14.doc_service_id)
284. 0.000 0.000 ↓ 0.0

Seq Scan on service_n2o_form sf_5 (cost=0.00..3.31 rows=1 width=7) (actual rows= loops=)

  • Filter: ((n2o_form)::text = 'disprCardRenderingServiceAnthropomentry'::text)
285. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.54..89.50 rows=1 width=0) (actual rows= loops=)

286. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.27..89.14 rows=1 width=4) (actual rows= loops=)

287. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.12..80.96 rows=1 width=4) (actual rows= loops=)

288. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.12..79.90 rows=1 width=8) (actual rows= loops=)

289. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.70..71.45 rows=1 width=4) (actual rows= loops=)

290. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_patient__event_patient_id_ix on md_event_service_patient mesp_19 (cost=0.42..8.97 rows=8 width=8) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
  • Filter: (status = 4)
291. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_pkey on md_event_service mes_15 (cost=0.28..7.80 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mesp_19.service_id)
  • Filter: (first IS TRUE)
292. 0.000 0.000 ↓ 0.0

Index Scan using md_event_patient_pkey on md_event_patient mep1_14 (cost=0.42..8.44 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mep.id)
293. 0.000 0.000 ↓ 0.0

Seq Scan on md_event_service_status mess_2 (cost=0.00..1.05 rows=1 width=4) (actual rows= loops=)

  • Filter: (code = 4)
294. 0.000 0.000 ↓ 0.0

Index Scan using md_events_pkey on md_event me_7 (cost=0.15..8.17 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = mep1_14.event_id)
295. 0.000 0.000 ↓ 0.0

Index Only Scan using md_standard_pk on md_standard ms_8 (cost=0.28..0.35 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = me_7.standard_id)
296. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.12..84.19 rows=1 width=0) (actual rows= loops=)

297. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.70..75.74 rows=1 width=4) (actual rows= loops=)

298. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_patient__event_patient_id_ix on md_event_service_patient mesp_20 (cost=0.42..8.95 rows=9 width=8) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
299. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_pkey on md_event_service mes_16 (cost=0.28..7.41 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mesp_20.service_id)
  • Filter: (last IS TRUE)
300. 0.000 0.000 ↓ 0.0

Index Only Scan using md_event_patient_pkey on md_event_patient mep1_15 (cost=0.42..8.44 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mep.id)
301. 0.000 0.000 ↓ 0.0

Nested Loop (cost=111.36..7,884.94 rows=6,973 width=4) (actual rows= loops=)

302. 0.000 0.000 ↓ 0.0

Hash Join (cost=110.94..4,679.99 rows=6,973 width=4) (actual rows= loops=)

  • Hash Cond: (mesp_21.service_id = mes_17.id)
303. 0.000 0.000 ↓ 0.0

Seq Scan on md_event_service_patient mesp_21 (cost=0.00..3,885.59 rows=163,659 width=8) (actual rows= loops=)

304. 0.000 0.000 ↓ 0.0

Hash (cost=108.47..108.47 rows=198 width=4) (actual rows= loops=)

305. 0.000 0.000 ↓ 0.0

Seq Scan on md_event_service mes_17 (cost=0.00..108.47 rows=198 width=4) (actual rows= loops=)

  • Filter: (last IS TRUE)
306. 0.000 0.000 ↓ 0.0

Index Only Scan using md_event_patient_pkey on md_event_patient mep1_16 (cost=0.42..0.45 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mesp_21.event_patient_id)
307. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.69..96.47 rows=1 width=0) (actual rows= loops=)

  • Join Filter: ((mnds_11.code)::text = (sf_6.service_code)::text)
308. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.69..93.14 rows=1 width=7) (actual rows= loops=)

309. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.54..92.73 rows=1 width=4) (actual rows= loops=)

310. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.27..92.36 rows=1 width=8) (actual rows= loops=)

311. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.12..84.19 rows=1 width=8) (actual rows= loops=)

312. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.70..75.74 rows=1 width=4) (actual rows= loops=)

313. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_patient__event_patient_id_ix on md_event_service_patient mesp_22 (cost=0.42..8.95 rows=9 width=4) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
314. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_pkey on md_event_service mes_18 (cost=0.28..7.41 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = mesp_22.service_id)
  • Filter: (last IS TRUE)
315. 0.000 0.000 ↓ 0.0

Index Scan using md_event_patient_pkey on md_event_patient mep1_17 (cost=0.42..8.44 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mep.id)
316. 0.000 0.000 ↓ 0.0

Index Scan using md_events_pkey on md_event me_8 (cost=0.15..8.17 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = mep1_17.event_id)
317. 0.000 0.000 ↓ 0.0

Index Only Scan using md_standard_pk on md_standard ms_9 (cost=0.28..0.35 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = me_8.standard_id)
318. 0.000 0.000 ↓ 0.0

Index Scan using md_norm_document_service_pk on md_norm_document_service mnds_11 (cost=0.15..0.41 rows=1 width=11) (actual rows= loops=)

  • Index Cond: (id = mes_18.doc_service_id)
319. 0.000 0.000 ↓ 0.0

Seq Scan on service_n2o_form sf_6 (cost=0.00..3.31 rows=1 width=7) (actual rows= loops=)

  • Filter: ((n2o_form)::text = 'disprCardRenderingServiceQuestioningEvent'::text)
320. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.69..96.47 rows=1 width=0) (actual rows= loops=)

  • Join Filter: ((mnds_12.code)::text = (sf_7.service_code)::text)
321. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.69..93.14 rows=1 width=7) (actual rows= loops=)

322. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.54..92.73 rows=1 width=4) (actual rows= loops=)

323. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.27..92.36 rows=1 width=8) (actual rows= loops=)

324. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.12..84.19 rows=1 width=8) (actual rows= loops=)

325. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.70..75.74 rows=1 width=4) (actual rows= loops=)

326. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_patient__event_patient_id_ix on md_event_service_patient mesp_23 (cost=0.42..8.95 rows=9 width=4) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
327. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_pkey on md_event_service mes_19 (cost=0.28..7.41 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = mesp_23.service_id)
  • Filter: (last IS TRUE)
328. 0.000 0.000 ↓ 0.0

Index Scan using md_event_patient_pkey on md_event_patient mep1_18 (cost=0.42..8.44 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mep.id)
329. 0.000 0.000 ↓ 0.0

Index Scan using md_events_pkey on md_event me_9 (cost=0.15..8.17 rows=1 width=8) (actual rows= loops=)

  • Index Cond: (id = mep1_18.event_id)
330. 0.000 0.000 ↓ 0.0

Index Only Scan using md_standard_pk on md_standard ms_10 (cost=0.28..0.35 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = me_9.standard_id)
331. 0.000 0.000 ↓ 0.0

Index Scan using md_norm_document_service_pk on md_norm_document_service mnds_12 (cost=0.15..0.41 rows=1 width=11) (actual rows= loops=)

  • Index Cond: (id = mes_19.doc_service_id)
332. 0.000 0.000 ↓ 0.0

Seq Scan on service_n2o_form sf_7 (cost=0.00..3.31 rows=1 width=7) (actual rows= loops=)

  • Filter: ((n2o_form)::text = 'disprCardRenderingServiceAnthropomentry'::text)
333. 0.000 0.000 ↓ 0.0

Aggregate (cost=70.62..70.63 rows=1 width=0) (actual rows= loops=)

334. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=2.21..70.60 rows=7 width=0) (actual rows= loops=)

  • Filter: ((mes1.last IS NULL) OR (NOT mes1.last))
335. 0.000 0.000 ↓ 0.0

Nested Loop (cost=1.93..18.65 rows=7 width=4) (actual rows= loops=)

336. 0.000 0.000 ↓ 0.0

Index Only Scan using md_event_patient_pkey on md_event_patient mep1_19 (cost=0.42..8.44 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mep.id)
337. 0.000 0.000 ↓ 0.0

Hash Join (cost=1.51..10.15 rows=7 width=8) (actual rows= loops=)

  • Hash Cond: (mesp1.status = mess1.code)
338. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_patient__event_patient_id_ix on md_event_service_patient mesp1 (cost=0.42..8.95 rows=9 width=12) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
339. 0.000 0.000 ↓ 0.0

Hash (cost=1.05..1.05 rows=3 width=4) (actual rows= loops=)

340. 0.000 0.000 ↓ 0.0

Seq Scan on md_event_service_status mess1 (cost=0.00..1.05 rows=3 width=4) (actual rows= loops=)

  • Filter: (code = ANY ('{2,3,4}'::integer[]))
341. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_pkey on md_event_service mes1 (cost=0.28..7.41 rows=1 width=5) (actual rows= loops=)

  • Index Cond: (id = mesp1.service_id)
342. 0.000 0.000 ↓ 0.0

Aggregate (cost=84.29..84.30 rows=1 width=0) (actual rows= loops=)

343. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=1.12..84.27 rows=9 width=0) (actual rows= loops=)

  • Filter: ((mes1_1.last IS NULL) OR (NOT mes1_1.last))
344. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.84..17.48 rows=9 width=4) (actual rows= loops=)

345. 0.000 0.000 ↓ 0.0

Index Only Scan using md_event_patient_pkey on md_event_patient mep1_20 (cost=0.42..8.44 rows=1 width=4) (actual rows= loops=)

  • Index Cond: (id = mep.id)
346. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_patient__event_patient_id_ix on md_event_service_patient mesp1_1 (cost=0.42..8.95 rows=9 width=8) (actual rows= loops=)

  • Index Cond: (event_patient_id = mep.id)
347. 0.000 0.000 ↓ 0.0

Index Scan using md_event_service_pkey on md_event_service mes1_1 (cost=0.28..7.41 rows=1 width=5) (actual rows= loops=)

  • Index Cond: (id = mesp1_1.service_id)