explain.depesz.com

PostgreSQL's explain analyze made readable

Result: uop8s

Settings
# exclusive inclusive rows x rows loops node
1. 0.012 475.894 ↑ 1.0 16 1

Limit (cost=835.34..48,673.03 rows=16 width=374) (actual time=471.028..475.894 rows=16 loops=1)

  • Output: s._clinic_id, hr.id, c.uid, ((SubPlan 1)), p.id, ((((COALESCE(pi.surname, ''::character varying))::text || COALESCE((' '::text || (pi.name)::text), ''::text)) || COALESCE((' '::text || (pi.patr_name)::text), ''::text))), (COALESCE((('№'::text || (c.uid)::text) || ','::text), ''::text)), (date_part('year'::text, age(now(), (pi.birth_dt)::timestamp with time zone))), csg_t.name, ((((COALESCE(ei.surname, ''::character varying))::text || COALESCE(((' '::text || "substring"((ei.name)::text, 1, 1)) || '.'::text), ''::text)) || COALESCE(((' '::text || "substring"((ei.patr_name)::text, 1, 1)) || '.'::text), ''::text))), s.regimen_id, dp.name, dp.id, ((s.admission_date + COALESCE(s.admission_time, '00:00:00'::time without time zone))), s.admission_date, s.admission_time, (CASE WHEN (dp.type_id = 5) THEN (s.admission_date + COALESCE(s.admission_time, '00:00:00'::time without time zone)) ELSE NULL::timestamp without time zone END), (CASE WHEN (dp.type_id = 5) THEN 'text-error'::text ELSE ''::text END), ((SubPlan 2)), fst.name, fst.id, ((((dg.code)::text || ' '::text) || (dg.name)::text)), hr.issue_planned_date, s.outcome_date, rg.responsible_id, (((c.closing_step_id IS NULL) OR ((c.closing_step_id IS NOT NULL) AND (s.outcome_date > ('now'::cstring)::date)))), ((c.closing_step_id IS NOT NULL)), dp.type_id, c.id, hr.id, hr.department_id, s._clinic_id, c.patient_id, c.id, ((SubPlan 3)), hr.funding_id, ((SubPlan 4)), (NULL::unknown), ((SubPlan 5)), (get_pi_name(s._patient_id)), s.id
  • Buffers: shared hit=498920
2.          

Initplan (for Limit)

3. 0.000 0.000 ↓ 0.0 0

Result (cost=0.00..679.09 rows=1 width=4) (never executed)

  • Output: pim_department.is_social_significant
  • One-Time Filter: NULL::boolean
4. 0.000 0.000 ↓ 0.0 0

Seq Scan on public.pim_department (cost=0.00..679.09 rows=1 width=4) (never executed)

  • Output: pim_department.id, pim_department.is_available_diagnosis, pim_department.code, pim_department.from_dt, pim_department.name, pim_department.to_dt, pim_department.accounting_center_id, pim_department.type_id, pim_department.funding_id, pim_department.org_id, pim_department.parent_id, pim_department.sphere_id, pim_department.is_payment, pim_department.unit_id, pim_department.lpu_1, pim_department.kind_id, pim_department.e_code, pim_department.scope_id, pim_department.aud_who, pim_department.aud_when, pim_department.aud_source, pim_department.aud_who_create, pim_department.aud_when_create, pim_department.aud_source_create, pim_department.is_separate, pim_department.is_social_significant, pim_department.age_group_id, pim_department.is_branch_type, pim_department.visits_per_shift, pim_department.departures_per_shift, pim_department.visits_per_day, pim_department.necropsies_per_day, pim_department.clinical_trials_per_shift, pim_department.brigades_amount, pim_department.ose, pim_department.ose_reject, pim_department.at_home, pim_department.longitude, pim_department.latitude, pim_department.amb_reception_exists, pim_department.cadastral_number, pim_department.hospital_mode_id, pim_department.type_profile_id
5. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=16.90..29.99 rows=1 width=0) (never executed)

  • Hash Cond: (sre.method_id = cm.id)
6. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=8.60..21.33 rows=94 width=4) (never executed)

  • Output: sre.method_id
7. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=8.32..9.90 rows=1 width=8) (never executed)

  • Output: sur.role_id, sr.id
  • Hash Cond: (sr.id = sur.role_id)
8. 0.000 0.000 ↓ 0.0 0

Seq Scan on public.sec_role sr (cost=0.00..1.42 rows=42 width=4) (never executed)

  • Output: sr.id, sr.version, sr.name, sr.note, sr.aud_who, sr.aud_when, sr.aud_source, sr.aud_who_create, sr.aud_when_create, sr.aud_source_create
9. 0.000 0.000 ↓ 0.0 0

Hash (cost=8.30..8.30 rows=1 width=4) (never executed)

  • Output: sur.role_id
10. 0.000 0.000 ↓ 0.0 0

Index Only Scan using ak_userrole on public.sec_user_role sur (cost=0.29..8.30 rows=1 width=4) (never executed)

  • Output: sur.role_id
  • Index Cond: (sur.user_id = 19130)
  • Heap Fetches: 0
11. 0.000 0.000 ↓ 0.0 0

Index Scan using sec_role_element_role_id_idx on public.sec_role_element sre (cost=0.28..10.44 rows=98 width=8) (never executed)

  • Output: sre.id, sre.obj_group_id, sre.property_id, sre.role_id, sre.method_id, sre.aud_who, sre.aud_when, sre.aud_source, sre.aud_who_create, sre.aud_when_create, sre.aud_source_create
  • Index Cond: (sre.role_id = sr.id)
12. 0.000 0.000 ↓ 0.0 0

Hash (cost=8.29..8.29 rows=1 width=4) (never executed)

  • Output: cm.id
13. 0.000 0.000 ↓ 0.0 0

Index Scan using sec_class_method_code_ak on public.sec_class_method cm (cost=0.27..8.29 rows=1 width=4) (never executed)

  • Output: cm.id
  • Index Cond: ((cm.code)::text = 'SocialSignificant.NarcologicProfile'::text)
14. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=16.90..29.99 rows=1 width=0) (never executed)

  • Hash Cond: (sre_1.method_id = cm_1.id)
15. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=8.60..21.33 rows=94 width=4) (never executed)

  • Output: sre_1.method_id
16. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=8.32..9.90 rows=1 width=8) (never executed)

  • Output: sur_1.role_id, sr_1.id
  • Hash Cond: (sr_1.id = sur_1.role_id)
17. 0.000 0.000 ↓ 0.0 0

Seq Scan on public.sec_role sr_1 (cost=0.00..1.42 rows=42 width=4) (never executed)

  • Output: sr_1.id, sr_1.version, sr_1.name, sr_1.note, sr_1.aud_who, sr_1.aud_when, sr_1.aud_source, sr_1.aud_who_create, sr_1.aud_when_create, sr_1.aud_source_create
18. 0.000 0.000 ↓ 0.0 0

Hash (cost=8.30..8.30 rows=1 width=4) (never executed)

  • Output: sur_1.role_id
19. 0.000 0.000 ↓ 0.0 0

Index Only Scan using ak_userrole on public.sec_user_role sur_1 (cost=0.29..8.30 rows=1 width=4) (never executed)

  • Output: sur_1.role_id
  • Index Cond: (sur_1.user_id = 19130)
  • Heap Fetches: 0
20. 0.000 0.000 ↓ 0.0 0

Index Scan using sec_role_element_role_id_idx on public.sec_role_element sre_1 (cost=0.28..10.44 rows=98 width=8) (never executed)

  • Output: sre_1.id, sre_1.obj_group_id, sre_1.property_id, sre_1.role_id, sre_1.method_id, sre_1.aud_who, sre_1.aud_when, sre_1.aud_source, sre_1.aud_who_create, sre_1.aud_when_create, sre_1.aud_source_create
  • Index Cond: (sre_1.role_id = sr_1.id)
21. 0.000 0.000 ↓ 0.0 0

Hash (cost=8.29..8.29 rows=1 width=4) (never executed)

  • Output: cm_1.id
22. 0.000 0.000 ↓ 0.0 0

Index Scan using sec_class_method_code_ak on public.sec_class_method cm_1 (cost=0.27..8.29 rows=1 width=4) (never executed)

  • Output: cm_1.id
  • Index Cond: ((cm_1.code)::text = 'SocialSignificant.PsychiatricProfile'::text)
23. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=16.90..29.99 rows=1 width=0) (never executed)

  • Hash Cond: (sre_2.method_id = cm_2.id)
24. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=8.60..21.33 rows=94 width=4) (never executed)

  • Output: sre_2.method_id
25. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=8.32..9.90 rows=1 width=8) (never executed)

  • Output: sur_2.role_id, sr_2.id
  • Hash Cond: (sr_2.id = sur_2.role_id)
26. 0.000 0.000 ↓ 0.0 0

Seq Scan on public.sec_role sr_2 (cost=0.00..1.42 rows=42 width=4) (never executed)

  • Output: sr_2.id, sr_2.version, sr_2.name, sr_2.note, sr_2.aud_who, sr_2.aud_when, sr_2.aud_source, sr_2.aud_who_create, sr_2.aud_when_create, sr_2.aud_source_create
27. 0.000 0.000 ↓ 0.0 0

Hash (cost=8.30..8.30 rows=1 width=4) (never executed)

  • Output: sur_2.role_id
28. 0.000 0.000 ↓ 0.0 0

Index Only Scan using ak_userrole on public.sec_user_role sur_2 (cost=0.29..8.30 rows=1 width=4) (never executed)

  • Output: sur_2.role_id
  • Index Cond: (sur_2.user_id = 19130)
  • Heap Fetches: 0
29. 0.000 0.000 ↓ 0.0 0

Index Scan using sec_role_element_role_id_idx on public.sec_role_element sre_2 (cost=0.28..10.44 rows=98 width=8) (never executed)

  • Output: sre_2.id, sre_2.obj_group_id, sre_2.property_id, sre_2.role_id, sre_2.method_id, sre_2.aud_who, sre_2.aud_when, sre_2.aud_source, sre_2.aud_who_create, sre_2.aud_when_create, sre_2.aud_source_create
  • Index Cond: (sre_2.role_id = sr_2.id)
30. 0.000 0.000 ↓ 0.0 0

Hash (cost=8.29..8.29 rows=1 width=4) (never executed)

  • Output: cm_2.id
31. 0.000 0.000 ↓ 0.0 0

Index Scan using sec_class_method_code_ak on public.sec_class_method cm_2 (cost=0.27..8.29 rows=1 width=4) (never executed)

  • Output: cm_2.id
  • Index Cond: ((cm_2.code)::text = 'SocialSignificant.VenereologicalProfile'::text)
32. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=16.90..29.99 rows=1 width=0) (never executed)

  • Hash Cond: (sre_3.method_id = cm_3.id)
33. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=8.60..21.33 rows=94 width=4) (never executed)

  • Output: sre_3.method_id
34. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=8.32..9.90 rows=1 width=8) (never executed)

  • Output: sur_3.role_id, sr_3.id
  • Hash Cond: (sr_3.id = sur_3.role_id)
35. 0.000 0.000 ↓ 0.0 0

Seq Scan on public.sec_role sr_3 (cost=0.00..1.42 rows=42 width=4) (never executed)

  • Output: sr_3.id, sr_3.version, sr_3.name, sr_3.note, sr_3.aud_who, sr_3.aud_when, sr_3.aud_source, sr_3.aud_who_create, sr_3.aud_when_create, sr_3.aud_source_create
36. 0.000 0.000 ↓ 0.0 0

Hash (cost=8.30..8.30 rows=1 width=4) (never executed)

  • Output: sur_3.role_id
37. 0.000 0.000 ↓ 0.0 0

Index Only Scan using ak_userrole on public.sec_user_role sur_3 (cost=0.29..8.30 rows=1 width=4) (never executed)

  • Output: sur_3.role_id
  • Index Cond: (sur_3.user_id = 19130)
  • Heap Fetches: 0
38. 0.000 0.000 ↓ 0.0 0

Index Scan using sec_role_element_role_id_idx on public.sec_role_element sre_3 (cost=0.28..10.44 rows=98 width=8) (never executed)

  • Output: sre_3.id, sre_3.obj_group_id, sre_3.property_id, sre_3.role_id, sre_3.method_id, sre_3.aud_who, sre_3.aud_when, sre_3.aud_source, sre_3.aud_who_create, sre_3.aud_when_create, sre_3.aud_source_create
  • Index Cond: (sre_3.role_id = sr_3.id)
39. 0.000 0.000 ↓ 0.0 0

Hash (cost=8.29..8.29 rows=1 width=4) (never executed)

  • Output: cm_3.id
40. 0.000 0.000 ↓ 0.0 0

Index Scan using sec_class_method_code_ak on public.sec_class_method cm_3 (cost=0.27..8.29 rows=1 width=4) (never executed)

  • Output: cm_3.id
  • Index Cond: ((cm_3.code)::text = 'SocialSignificant.TBProfile'::text)
41. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=16.90..29.99 rows=1 width=0) (never executed)

  • Hash Cond: (sre_4.method_id = cm_4.id)
42. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=8.60..21.33 rows=94 width=4) (never executed)

  • Output: sre_4.method_id
43. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=8.32..9.90 rows=1 width=8) (never executed)

  • Output: sur_4.role_id, sr_4.id
  • Hash Cond: (sr_4.id = sur_4.role_id)
44. 0.000 0.000 ↓ 0.0 0

Seq Scan on public.sec_role sr_4 (cost=0.00..1.42 rows=42 width=4) (never executed)

  • Output: sr_4.id, sr_4.version, sr_4.name, sr_4.note, sr_4.aud_who, sr_4.aud_when, sr_4.aud_source, sr_4.aud_who_create, sr_4.aud_when_create, sr_4.aud_source_create
45. 0.000 0.000 ↓ 0.0 0

Hash (cost=8.30..8.30 rows=1 width=4) (never executed)

  • Output: sur_4.role_id
46. 0.000 0.000 ↓ 0.0 0

Index Only Scan using ak_userrole on public.sec_user_role sur_4 (cost=0.29..8.30 rows=1 width=4) (never executed)

  • Output: sur_4.role_id
  • Index Cond: (sur_4.user_id = 19130)
  • Heap Fetches: 0
47. 0.000 0.000 ↓ 0.0 0

Index Scan using sec_role_element_role_id_idx on public.sec_role_element sre_4 (cost=0.28..10.44 rows=98 width=8) (never executed)

  • Output: sre_4.id, sre_4.obj_group_id, sre_4.property_id, sre_4.role_id, sre_4.method_id, sre_4.aud_who, sre_4.aud_when, sre_4.aud_source, sre_4.aud_who_create, sre_4.aud_when_create, sre_4.aud_source_create
  • Index Cond: (sre_4.role_id = sr_4.id)
48. 0.000 0.000 ↓ 0.0 0

Hash (cost=8.29..8.29 rows=1 width=4) (never executed)

  • Output: cm_4.id
49. 0.000 0.000 ↓ 0.0 0

Index Scan using sec_class_method_code_ak on public.sec_class_method cm_4 (cost=0.27..8.29 rows=1 width=4) (never executed)

  • Output: cm_4.id
  • Index Cond: ((cm_4.code)::text = 'SocialSignificant.HIVProfile'::text)
50. 1.031 475.882 ↑ 239,533.4 16 1

Result (cost=6.29..11,458,725,029.16 rows=3,832,534 width=374) (actual time=471.023..475.882 rows=16 loops=1)

  • Output: s._clinic_id, hr.id, c.uid, (SubPlan 1), p.id, (((COALESCE(pi.surname, ''::character varying))::text || COALESCE((' '::text || (pi.name)::text), ''::text)) || COALESCE((' '::text || (pi.patr_name)::text), ''::text)), COALESCE((('№'::text || (c.uid)::text) || ','::text), ''::text), date_part('year'::text, age(now(), (pi.birth_dt)::timestamp with time zone)), csg_t.name, (((COALESCE(ei.surname, ''::character varying))::text || COALESCE(((' '::text || "substring"((ei.name)::text, 1, 1)) || '.'::text), ''::text)) || COALESCE(((' '::text || "substring"((ei.patr_name)::text, 1, 1)) || '.'::text), ''::text)), s.regimen_id, dp.name, dp.id, (s.admission_date + COALESCE(s.admission_time, '00:00:00'::time without time zone)), s.admission_date, s.admission_time, CASE WHEN (dp.type_id = 5) THEN (s.admission_date + COALESCE(s.admission_time, '00:00:00'::time without time zone)) ELSE NULL::timestamp without time zone END, CASE WHEN (dp.type_id = 5) THEN 'text-error'::text ELSE ''::text END, (SubPlan 2), fst.name, fst.id, (((dg.code)::text || ' '::text) || (dg.name)::text), hr.issue_planned_date, s.outcome_date, rg.responsible_id, ((c.closing_step_id IS NULL) OR ((c.closing_step_id IS NOT NULL) AND (s.outcome_date > ('now'::cstring)::date))), (c.closing_step_id IS NOT NULL), dp.type_id, c.id, hr.id, hr.department_id, s._clinic_id, c.patient_id, c.id, (SubPlan 3), hr.funding_id, (SubPlan 4), NULL::unknown, (SubPlan 5), get_pi_name(s._patient_id), s.id
  • One-Time Filter: ((length(concat(NULL::date, '2019-10-20'::date)) <> 0) OR (length(concat(NULL::date, NULL::date)) <> 0))
  • Buffers: shared hit=498920
51. 0.027 464.867 ↑ 239,533.4 16 1

Nested Loop Anti Join (cost=6.29..1,167,459,158.83 rows=3,832,534 width=374) (actual time=463.399..464.867 rows=16 loops=1)

  • Output: hr.id, hr.issue_planned_date, hr.department_id, hr.funding_id, s._clinic_id, s.res_group_id, s.regimen_id, s.admission_date, s.admission_time, s.outcome_date, s._patient_id, s.id, rg.responsible_id, csg_t.name, c.uid, c.id, c.closing_step_id, c.patient_id, p.id, pi.surname, pi.name, pi.patr_name, pi.birth_dt, dp.name, dp.id, dp.type_id, fst.name, fst.id, dg.code, dg.name, ei.surname, ei.name, ei.patr_name
  • Join Filter: (s2.case_id = c.id)
  • Buffers: shared hit=498425
52. 0.014 464.755 ↑ 230,285.9 17 1

Nested Loop Left Join (cost=5.28..1,111,829,411.12 rows=3,914,861 width=374) (actual time=463.387..464.755 rows=17 loops=1)

  • Output: hr.id, hr.issue_planned_date, hr.department_id, hr.funding_id, s._clinic_id, s.res_group_id, s.regimen_id, s.admission_date, s.admission_time, s.outcome_date, s._patient_id, s.id, rg.responsible_id, csg_t.name, c.uid, c.id, c.closing_step_id, c.patient_id, p.id, pi.surname, pi.name, pi.patr_name, pi.birth_dt, dp.name, dp.id, dp.type_id, fst.name, fst.id, dg.code, dg.name, ei.surname, ei.name, ei.patr_name
  • Buffers: shared hit=498368
53. 0.023 464.656 ↑ 230,285.9 17 1

Nested Loop Left Join (cost=4.84..1,082,949,174.70 rows=3,914,861 width=331) (actual time=463.377..464.656 rows=17 loops=1)

  • Output: hr.id, hr.issue_planned_date, hr.department_id, hr.funding_id, s._clinic_id, s.res_group_id, s.regimen_id, s.admission_date, s.admission_time, s.outcome_date, s._patient_id, s.id, rg.responsible_id, csg_t.name, c.uid, c.id, c.closing_step_id, c.patient_id, p.id, pi.surname, pi.name, pi.patr_name, pi.birth_dt, dp.name, dp.id, dp.type_id, fst.name, fst.id, dg.code, dg.name, e.individual_id
  • Buffers: shared hit=498316
54. 0.026 464.565 ↑ 230,285.9 17 1

Nested Loop Left Join (cost=4.55..1,056,175,471.75 rows=3,914,861 width=331) (actual time=463.366..464.565 rows=17 loops=1)

  • Output: hr.id, hr.issue_planned_date, hr.department_id, hr.funding_id, s._clinic_id, s.res_group_id, s.regimen_id, s.admission_date, s.admission_time, s.outcome_date, s._patient_id, s.id, rg.responsible_id, csg_t.name, c.uid, c.id, c.closing_step_id, c.patient_id, p.id, pi.surname, pi.name, pi.patr_name, pi.birth_dt, dp.name, dp.id, dp.type_id, fst.name, fst.id, dg.code, dg.name, ep.employee_id
  • Buffers: shared hit=498277
55. 0.022 464.471 ↑ 230,285.9 17 1

Nested Loop Left Join (cost=4.26..1,029,347,590.32 rows=3,914,861 width=327) (actual time=463.356..464.471 rows=17 loops=1)

  • Output: hr.id, hr.issue_planned_date, hr.department_id, hr.funding_id, s._clinic_id, s.res_group_id, s.regimen_id, s.admission_date, s.admission_time, s.outcome_date, s._patient_id, s.id, rg.responsible_id, csg_t.name, c.uid, c.id, c.closing_step_id, c.patient_id, p.id, pi.surname, pi.name, pi.patr_name, pi.birth_dt, dp.name, dp.id, dp.type_id, fst.name, fst.id, dg.code, dg.name
  • Buffers: shared hit=498238
56. 0.025 464.364 ↑ 230,285.9 17 1

Nested Loop Left Join (cost=3.98..1,002,636,476.00 rows=3,914,861 width=243) (actual time=463.346..464.364 rows=17 loops=1)

  • Output: hr.id, hr.issue_planned_date, hr.department_id, hr.funding_id, s._clinic_id, s.res_group_id, s.regimen_id, s.admission_date, s.admission_time, s.outcome_date, s._patient_id, s.id, rg.responsible_id, csg_t.name, c.uid, c.id, c.closing_step_id, c.patient_id, p.id, pi.surname, pi.name, pi.patr_name, pi.birth_dt, dp.name, dp.id, dp.type_id, fst.name, fst.id, mcdiag.diagnos_id
  • Buffers: shared hit=498187
57. 0.042 464.220 ↑ 230,285.9 17 1

Nested Loop Left Join (cost=3.41..974,506,862.95 rows=3,914,861 width=243) (actual time=463.333..464.220 rows=17 loops=1)

  • Output: hr.id, hr.issue_planned_date, hr.department_id, hr.funding_id, s._clinic_id, s.res_group_id, s.regimen_id, s.admission_date, s.admission_time, s.outcome_date, s._patient_id, s.id, s.main_diagnosis_id, rg.responsible_id, csg_t.name, c.uid, c.id, c.closing_step_id, c.patient_id, p.id, pi.surname, pi.name, pi.patr_name, pi.birth_dt, dp.name, dp.id, dp.type_id, fst.name, fst.id
  • Join Filter: (fst.id = hr.funding_id)
  • Rows Removed by Join Filter: 171
  • Buffers: shared hit=498102
58. 0.035 464.144 ↑ 230,285.9 17 1

Nested Loop (cost=3.41..973,860,909.75 rows=3,914,861 width=211) (actual time=463.307..464.144 rows=17 loops=1)

  • Output: hr.id, hr.issue_planned_date, hr.department_id, hr.funding_id, s._clinic_id, s.res_group_id, s.regimen_id, s.admission_date, s.admission_time, s.outcome_date, s._patient_id, s.id, s.main_diagnosis_id, rg.responsible_id, csg_t.name, c.uid, c.id, c.closing_step_id, c.patient_id, p.id, pi.surname, pi.name, pi.patr_name, pi.birth_dt, dp.name, dp.id, dp.type_id
  • Buffers: shared hit=498101
59. 0.027 463.990 ↑ 230,285.9 17 1

Nested Loop (cost=2.98..959,206,502.80 rows=3,914,861 width=211) (actual time=463.289..463.990 rows=17 loops=1)

  • Output: hr.id, hr.issue_planned_date, hr.department_id, hr.funding_id, s._clinic_id, s.res_group_id, s.regimen_id, s.admission_date, s.admission_time, s.outcome_date, s._patient_id, s.id, s.main_diagnosis_id, rg.responsible_id, csg_t.name, c.uid, c.id, c.closing_step_id, c.patient_id, pi.surname, pi.name, pi.patr_name, pi.birth_dt, pi.id, dp.name, dp.id, dp.type_id
  • Buffers: shared hit=498036
60. 0.033 463.861 ↑ 230,285.9 17 1

Nested Loop Left Join (cost=2.54..931,782,501.36 rows=3,914,861 width=156) (actual time=463.276..463.861 rows=17 loops=1)

  • Output: hr.id, hr.issue_planned_date, hr.department_id, hr.funding_id, s._clinic_id, s.res_group_id, s.regimen_id, s.admission_date, s.admission_time, s.outcome_date, s._patient_id, s.id, s.main_diagnosis_id, rg.responsible_id, csg_t.name, c.uid, c.id, c.closing_step_id, c.patient_id, dp.name, dp.id, dp.type_id
  • Join Filter: (csg_t.id = s.csg_id)
  • Rows Removed by Join Filter: 34
  • Buffers: shared hit=497968
61. 0.030 463.811 ↑ 230,285.9 17 1

Nested Loop Left Join (cost=2.54..931,665,054.51 rows=3,914,861 width=134) (actual time=463.255..463.811 rows=17 loops=1)

  • Output: hr.id, hr.issue_planned_date, hr.department_id, hr.funding_id, s._clinic_id, s.res_group_id, s.regimen_id, s.admission_date, s.admission_time, s.outcome_date, s._patient_id, s.id, s.csg_id, s.main_diagnosis_id, rg.responsible_id, c.uid, c.id, c.closing_step_id, c.patient_id, dp.name, dp.id, dp.type_id
  • Buffers: shared hit=497967
62. 0.030 463.696 ↑ 230,285.9 17 1

Nested Loop (cost=1.98..903,431,442.20 rows=3,914,861 width=130) (actual time=463.241..463.696 rows=17 loops=1)

  • Output: hr.id, hr.issue_planned_date, hr.department_id, hr.funding_id, s._clinic_id, s.res_group_id, s.regimen_id, s.admission_date, s.admission_time, s.outcome_date, s._patient_id, s.id, s.csg_id, s.main_diagnosis_id, c.uid, c.id, c.closing_step_id, c.patient_id, dp.name, dp.id, dp.type_id
  • Buffers: shared hit=497902
63. 0.028 463.558 ↑ 220,208.9 18 1

Nested Loop (cost=1.69..876,447,703.00 rows=3,963,761 width=79) (actual time=463.210..463.558 rows=18 loops=1)

  • Output: hr.id, hr.issue_planned_date, hr.department_id, hr.funding_id, s._clinic_id, s.res_group_id, s.regimen_id, s.admission_date, s.admission_time, s.outcome_date, s._patient_id, s.id, s.csg_id, s.main_diagnosis_id, c.uid, c.id, c.closing_step_id, c.patient_id
  • Buffers: shared hit=497848
64. 0.035 463.404 ↑ 229,402.9 18 1

Nested Loop (cost=1.12..846,802,754.89 rows=4,129,253 width=64) (actual time=463.196..463.404 rows=18 loops=1)

  • Output: hr.id, hr.issue_planned_date, hr.department_id, hr.funding_id, s._clinic_id, s.res_group_id, s.regimen_id, s.admission_date, s.admission_time, s.outcome_date, s._patient_id, s.id, s.csg_id, s.case_id, s.main_diagnosis_id
  • Buffers: shared hit=497758
65. 463.229 463.229 ↑ 2,902,406.9 28 1

Index Scan using mc_step_expr_get_pi_name_id_idx on public.mc_step s (cost=0.69..277,782,630.13 rows=81,267,394 width=48) (actual time=463.175..463.229 rows=28 loops=1)

  • Output: s.id, s.admission_date, s.admission_time, s.death_date, s.death_time, s.outcome_date, s.outcome_time, s.death_employee_id, s.main_diagnosis_id, s.case_id, s.outcome_id, s.outcome_clinic_id, s.outcome_regimen_id, s.regimen_id, s.res_group_id, s.result_id, s.reason_id, s.profile_id, s.mes_id, s.mes_quality_criterion_id, s.is_continue, s.is_continue_editable, s.standard_id, s.csg_id, s.vmp_type_id, s.vmp_method_id, s.deviation_reason_id, s.aud_who, s.aud_when, s.aud_source, s.aud_who_create, s.aud_when_create, s.aud_source_create, s._clinic_id, s._patient_id, s.planned_date_closing_case, s.hsp_bed_profile_id, s.gestational_age, s.onko_stage, s.is_first_step
  • Filter: ((s.admission_date >= '-infinity'::date) AND (s.admission_date <= '2019-10-20'::date))
  • Rows Removed by Filter: 495866
  • Buffers: shared hit=497656
66. 0.140 0.140 ↑ 1.0 1 28

Index Scan using hsp_record_pk on public.hsp_record hr (cost=0.43..6.99 rows=1 width=16) (actual time=0.005..0.005 rows=1 loops=28)

  • Output: hr.id, hr.is_admission_day_counts, hr.old_is_continue, hr.department_id, hr.funding_id, hr.mes_id, hr.previous_id, hr.is_set_diagnosis, hr.old_is_continue_edit, hr.is_diag_not_eq, hr.days_comp_algo_id, hr.missed_days_amount, hr.bed_days_amount, hr.issue_planned_date, hr.complexity_level_id, hr.bed_profile_id, hr.aud_who, hr.aud_when, hr.aud_source, hr.aud_who_create, hr.aud_when_create, hr.aud_source_create, hr.refusal_employee_id, hr.is_finance_type_control, hr.house_call_id, hr.action_allowed_result_id
  • Index Cond: (hr.id = s.id)
  • Buffers: shared hit=102
67. 0.126 0.126 ↑ 1.0 1 18

Index Scan using mc_case_pk on public.mc_case c (cost=0.56..7.17 rows=1 width=19) (actual time=0.007..0.007 rows=1 loops=18)

  • Output: c.id, c.create_date, c.emergency_team_code, c.note, c.plan_case_duration, c.plan_hosp_date, c.uid, c.who_delivered, c.who_delivered_code, c.who_delivered_team_number, c.admission_reason_id, c.admission_state_id, c.admission_type_id, c.care_level_id, c.case_type_id, c.clinic_id, c.main_contract_id, c.drunkenness_type_id, c.funding_id, c.init_goal_id, c.init_type_id, c.main_diagnos_id, c.result_id, c.patient_id, c.referral_id, c.care_regimen_id, c.repeat_count_id, c.soc_group_id, c.state_id, c.time_gone_id, c.transporting_type_id, c.referral_resulting_id, c.payment_method_id, c.complexity_level_id, c.deviation_reason_id, c.open_date, c.closing_step_id, c.provision_condition_id, c.care_providing_form_id, c.injury_type_id, c.uid_old, c.close_date, c.open_time, c.rankin_scale_for_admission_id, c.rankin_scale_on_disposal_id, c.notes_to_work, c.aud_who, c.aud_when, c.aud_source, c.aud_who_create, c.aud_when_create, c.aud_source_create, c.hsp_canal_id, c.prehospital_stage_defect_id, c.mark, c.is_need_sicklist, c.narcotic_substance, c.where_from_delivered, c.severity_level_id, c.is_social_significant, c.death_reason, c.is_finance_type_control, c.is_control_case_init_goal, c.ticket_vmp, c.ticket_vmp_date, c.planned_hospitalization_date, c.external_reason_mkb_id, c.additional_data
  • Index Cond: (c.id = s.case_id)
  • Filter: ((c.is_social_significant IS NULL) OR (c.is_social_significant = $7) OR ((c.is_social_significant = 1) AND $9) OR ((c.is_social_significant = 2) AND $11) OR ((c.is_social_significant = 3) AND $13) OR ((c.is_social_significant = 4) AND $15) OR ((c.is_social_significant = 5) AND $17))
  • Buffers: shared hit=90
68. 0.108 0.108 ↑ 1.0 1 18

Index Scan using pim_department_pk on public.pim_department dp (cost=0.29..6.80 rows=1 width=51) (actual time=0.006..0.006 rows=1 loops=18)

  • Output: dp.id, dp.is_available_diagnosis, dp.code, dp.from_dt, dp.name, dp.to_dt, dp.accounting_center_id, dp.type_id, dp.funding_id, dp.org_id, dp.parent_id, dp.sphere_id, dp.is_payment, dp.unit_id, dp.lpu_1, dp.kind_id, dp.e_code, dp.scope_id, dp.aud_who, dp.aud_when, dp.aud_source, dp.aud_who_create, dp.aud_when_create, dp.aud_source_create, dp.is_separate, dp.is_social_significant, dp.age_group_id, dp.is_branch_type, dp.visits_per_shift, dp.departures_per_shift, dp.visits_per_day, dp.necropsies_per_day, dp.clinical_trials_per_shift, dp.brigades_amount, dp.ose, dp.ose_reject, dp.at_home, dp.longitude, dp.latitude, dp.amb_reception_exists, dp.cadastral_number, dp.hospital_mode_id, dp.type_profile_id
  • Index Cond: (dp.id = hr.department_id)
  • Filter: (dp.type_id <> 4)
  • Rows Removed by Filter: 0
  • Buffers: shared hit=54
69. 0.085 0.085 ↑ 1.0 1 17

Index Scan using sr_res_group_pk on public.sr_res_group rg (cost=0.57..7.20 rows=1 width=8) (actual time=0.005..0.005 rows=1 loops=17)

  • Output: rg.id, rg.bdate, rg.edate, rg.is_system, rg.name, rg.department_id, rg.org_id, rg.responsible_id, rg.is_available_in_electronic_queue, rg.label_id, rg.note, rg.blocked, rg.block_comment, rg.template_res_group_id, rg.emergency, rg.ignore_districts, rg.aud_who, rg.aud_when, rg.aud_source, rg.aud_who_create, rg.aud_when_create, rg.aud_source_create, rg.ignore_regclinic_check, rg.service_template_id
  • Index Cond: (rg.id = s.res_group_id)
  • Buffers: shared hit=65
70. 0.012 0.017 ↑ 1.0 2 17

Materialize (cost=0.00..1.03 rows=2 width=30) (actual time=0.001..0.001 rows=2 loops=17)

  • Output: csg_t.name, csg_t.id
  • Buffers: shared hit=1
71. 0.005 0.005 ↑ 1.0 2 1

Seq Scan on public.md_clinical_statistical_group csg_t (cost=0.00..1.02 rows=2 width=30) (actual time=0.004..0.005 rows=2 loops=1)

  • Output: csg_t.name, csg_t.id
  • Buffers: shared hit=1
72. 0.102 0.102 ↑ 1.0 1 17

Index Scan using pim_individual_pk on public.pim_individual pi (cost=0.43..7.00 rows=1 width=55) (actual time=0.006..0.006 rows=1 loops=17)

  • Output: pi.id, pi.birth_dt, pi.death_dt, pi.has_citizenship, pi.name, pi.patr_name, pi.surname, pi.gender_id, pi.nationality_id, pi.list_identity_doc, pi.list_oms_doc, pi.list_job_org, pi.list_reg_name, pi.list_snils, pi.list_uid, pi.aud_who, pi.aud_when, pi.aud_source, pi.aud_who_create, pi.aud_when_create, pi.aud_source_create, pi.birth_place, pi.age_year, pi.age_month, pi.age_day, pi.list_main_contact
  • Index Cond: (pi.id = s._patient_id)
  • Buffers: shared hit=68
73. 0.119 0.119 ↑ 1.0 1 17

Index Only Scan using pci_patient_pkey on public.pci_patient p (cost=0.43..3.73 rows=1 width=4) (actual time=0.007..0.007 rows=1 loops=17)

  • Output: p.id
  • Index Cond: (p.id = s._patient_id)
  • Heap Fetches: 8
  • Buffers: shared hit=65
74. 0.025 0.034 ↑ 1.0 11 17

Materialize (cost=0.00..1.17 rows=11 width=32) (actual time=0.001..0.002 rows=11 loops=17)

  • Output: fst.name, fst.id
  • Buffers: shared hit=1
75. 0.009 0.009 ↑ 1.0 11 1

Seq Scan on public.fin_funding_source_type fst (cost=0.00..1.11 rows=11 width=32) (actual time=0.005..0.009 rows=11 loops=1)

  • Output: fst.name, fst.id
  • Buffers: shared hit=1
76. 0.119 0.119 ↑ 1.0 1 17

Index Scan using mc_diagnosis_pk on public.mc_diagnosis mcdiag (cost=0.57..7.18 rows=1 width=8) (actual time=0.006..0.007 rows=1 loops=17)

  • Output: mcdiag.id, mcdiag.diagnos_id
  • Index Cond: (mcdiag.id = s.main_diagnosis_id)
  • Buffers: shared hit=85
77. 0.085 0.085 ↑ 1.0 1 17

Index Scan using md_diagnosis_pk on public.md_diagnosis dg (cost=0.29..6.81 rows=1 width=92) (actual time=0.004..0.005 rows=1 loops=17)

  • Output: dg.id, dg.code, dg.name, dg.parent_id, dg.is_injury, dg.level, dg.is_leaf, dg.e_code, dg.oms, dg.stomat, dg.aud_who, dg.aud_when, dg.aud_source, dg.aud_who_create, dg.aud_when_create, dg.aud_source_create, dg.from_dt, dg.to_dt
  • Index Cond: (dg.id = mcdiag.diagnos_id)
  • Buffers: shared hit=51
78. 0.068 0.068 ↑ 1.0 1 17

Index Scan using pim_employee_position_pk on public.pim_employee_position ep (cost=0.29..6.84 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=17)

  • Output: ep.id, ep.dismissal_order_code, ep.start_date, ep.hiring_order_code, ep.rate, ep.end_date, ep.dismissal_reason_id, ep.employee_id, ep.employment_type_id, ep.hiring_type_id, ep.position_id, ep.position_type_id, ep.unit_id, ep.code, ep.aud_who, ep.aud_when, ep.aud_source, ep.aud_who_create, ep.aud_when_create, ep.aud_source_create, ep.pref_prescription, ep.extra_payment, ep.target_training, ep.leaving_reason_id
  • Index Cond: (ep.id = rg.responsible_id)
  • Buffers: shared hit=39
79. 0.068 0.068 ↑ 1.0 1 17

Index Scan using pim_employee_pk on public.pim_employee e (cost=0.29..6.83 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=17)

  • Output: e.id, e.note, e.number, e.photo, e.callup_subject_id, e.individual_id, e.organization_id, e.is_dismissed, e.employment_dt, e.dismissal_dt, e.aud_who, e.aud_when, e.aud_source, e.aud_who_create, e.aud_when_create, e.aud_source_create, e.accreditation_id
  • Index Cond: (e.id = ep.employee_id)
  • Buffers: shared hit=39
80. 0.085 0.085 ↑ 1.0 1 17

Index Scan using pim_individual_pk on public.pim_individual ei (cost=0.43..7.37 rows=1 width=51) (actual time=0.004..0.005 rows=1 loops=17)

  • Output: ei.id, ei.birth_dt, ei.death_dt, ei.has_citizenship, ei.name, ei.patr_name, ei.surname, ei.gender_id, ei.nationality_id, ei.list_identity_doc, ei.list_oms_doc, ei.list_job_org, ei.list_reg_name, ei.list_snils, ei.list_uid, ei.aud_who, ei.aud_when, ei.aud_source, ei.aud_who_create, ei.aud_when_create, ei.aud_source_create, ei.birth_place, ei.age_year, ei.age_month, ei.age_day, ei.list_main_contact
  • Index Cond: (ei.id = e.individual_id)
  • Buffers: shared hit=52
81. 0.010 0.085 ↓ 0.0 0 17

Nested Loop (cost=1.00..14.20 rows=1 width=8) (actual time=0.005..0.005 rows=0 loops=17)

  • Output: h2.previous_id, s2.case_id
  • Buffers: shared hit=57
82. 0.068 0.068 ↓ 0.0 0 17

Index Scan using hsp_record_previous_id_idx on public.hsp_record h2 (cost=0.43..6.99 rows=1 width=8) (actual time=0.004..0.004 rows=0 loops=17)

  • Output: h2.id, h2.is_admission_day_counts, h2.old_is_continue, h2.department_id, h2.funding_id, h2.mes_id, h2.previous_id, h2.is_set_diagnosis, h2.old_is_continue_edit, h2.is_diag_not_eq, h2.days_comp_algo_id, h2.missed_days_amount, h2.bed_days_amount, h2.issue_planned_date, h2.complexity_level_id, h2.bed_profile_id, h2.aud_who, h2.aud_when, h2.aud_source, h2.aud_who_create, h2.aud_when_create, h2.aud_source_create, h2.refusal_employee_id, h2.is_finance_type_control, h2.house_call_id, h2.action_allowed_result_id
  • Index Cond: (h2.previous_id = hr.id)
  • Buffers: shared hit=52
83. 0.007 0.007 ↑ 1.0 1 1

Index Scan using mc_step_pk on public.mc_step s2 (cost=0.57..7.19 rows=1 width=8) (actual time=0.007..0.007 rows=1 loops=1)

  • Output: s2.id, s2.admission_date, s2.admission_time, s2.death_date, s2.death_time, s2.outcome_date, s2.outcome_time, s2.death_employee_id, s2.main_diagnosis_id, s2.case_id, s2.outcome_id, s2.outcome_clinic_id, s2.outcome_regimen_id, s2.regimen_id, s2.res_group_id, s2.result_id, s2.reason_id, s2.profile_id, s2.mes_id, s2.mes_quality_criterion_id, s2.is_continue, s2.is_continue_editable, s2.standard_id, s2.csg_id, s2.vmp_type_id, s2.vmp_method_id, s2.deviation_reason_id, s2.aud_who, s2.aud_when, s2.aud_source, s2.aud_who_create, s2.aud_when_create, s2.aud_source_create, s2._clinic_id, s2._patient_id, s2.planned_date_closing_case, s2.hsp_bed_profile_id, s2.gestational_age, s2.onko_stage, s2.is_first_step
  • Index Cond: (s2.id = h2.id)
  • Buffers: shared hit=5
84.          

SubPlan (for Result)

85. 0.016 7.040 ↓ 0.0 0 16

Limit (cost=2,586.06..2,586.06 rows=1 width=24) (actual time=0.440..0.440 rows=0 loops=16)

  • Output: ((((pim_room.name)::text || ', койка № '::text) || (md_bed.number)::text))
  • Buffers: shared hit=153
86. 0.064 7.024 ↓ 0.0 0 16

Sort (cost=2,586.06..2,589.57 rows=1,405 width=24) (actual time=0.439..0.439 rows=0 loops=16)

  • Output: ((((pim_room.name)::text || ', койка № '::text) || (md_bed.number)::text))
  • Sort Key: ((((pim_room.name)::text || ', койка № '::text) || (md_bed.number)::text))
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=153
87. 0.064 6.960 ↓ 0.0 0 16

Hash Join (cost=1,994.74..2,579.03 rows=1,405 width=24) (actual time=0.435..0.435 rows=0 loops=16)

  • Output: (((pim_room.name)::text || ', койка № '::text) || (md_bed.number)::text)
  • Hash Cond: (md_bed.room_id = pim_room.id)
  • Buffers: shared hit=153
88. 0.093 6.896 ↓ 0.0 0 16

Hash Join (cost=667.65..1,225.60 rows=1,405 width=6) (actual time=0.431..0.431 rows=0 loops=16)

  • Output: md_bed.number, md_bed.room_id
  • Hash Cond: (md_bed.id = md_bed_resource.bed_id)
  • Buffers: shared hit=153
89. 0.003 0.003 ↑ 20,429.0 1 1

Seq Scan on public.md_bed (cost=0.00..467.29 rows=20,429 width=10) (actual time=0.003..0.003 rows=1 loops=1)

  • Output: md_bed.id, md_bed.room_id, md_bed.profile_id, md_bed.regimen_id, md_bed.from_dt, md_bed.to_dt, md_bed.number, md_bed.bed_profile_id, md_bed.unit_id, md_bed.bed_profile_pass_id, md_bed.additional_bed, md_bed.aud_who, md_bed.aud_when, md_bed.aud_source, md_bed.aud_who_create, md_bed.aud_when_create, md_bed.aud_source_create, md_bed.age_group_id, md_bed.gender_id, md_bed.count_shift
  • Buffers: shared hit=1
90. 0.016 6.800 ↓ 0.0 0 16

Hash (cost=650.09..650.09 rows=1,405 width=4) (actual time=0.425..0.425 rows=0 loops=16)

  • Output: md_bed_resource.bed_id
  • Buckets: 2048 Batches: 1 Memory Usage: 16kB
  • Buffers: shared hit=152
91. 0.217 6.784 ↓ 0.0 0 16

Hash Join (cost=486.80..650.09 rows=1,405 width=4) (actual time=0.424..0.424 rows=0 loops=16)

  • Output: md_bed_resource.bed_id
  • Hash Cond: (sr_res_group_relationship.resource_id = md_bed_resource.id)
  • Buffers: shared hit=152
92. 0.112 0.112 ↑ 1,968.0 1 16

Index Scan using sr_res_group_relationship_group_id_idx on public.sr_res_group_relationship (cost=0.57..142.44 rows=1,968 width=4) (actual time=0.006..0.007 rows=1 loops=16)

  • Output: sr_res_group_relationship.id, sr_res_group_relationship.bdatetime, sr_res_group_relationship.edatetime, sr_res_group_relationship.resource_id, sr_res_group_relationship.group_id, sr_res_group_relationship.role_id, sr_res_group_relationship.is_disabled, sr_res_group_relationship.aud_who, sr_res_group_relationship.aud_when, sr_res_group_relationship.aud_source, sr_res_group_relationship.aud_who_create, sr_res_group_relationship.aud_when_create, sr_res_group_relationship.aud_source_create
  • Index Cond: (sr_res_group_relationship.group_id = s.res_group_id)
  • Filter: ((sr_res_group_relationship.is_disabled IS FALSE) OR (sr_res_group_relationship.is_disabled IS NULL))
  • Buffers: shared hit=60
93. 3.640 6.455 ↑ 1.0 17,521 1

Hash (cost=267.21..267.21 rows=17,521 width=8) (actual time=6.455..6.455 rows=17,521 loops=1)

  • Output: md_bed_resource.id, md_bed_resource.bed_id
  • Buckets: 32768 Batches: 1 Memory Usage: 941kB
  • Buffers: shared hit=92
94. 2.815 2.815 ↑ 1.0 17,521 1

Seq Scan on public.md_bed_resource (cost=0.00..267.21 rows=17,521 width=8) (actual time=0.006..2.815 rows=17,521 loops=1)

  • Output: md_bed_resource.id, md_bed_resource.bed_id
  • Buffers: shared hit=92
95. 0.000 0.000 ↓ 0.0 0

Hash (cost=908.15..908.15 rows=33,515 width=26) (never executed)

  • Output: pim_room.name, pim_room.id
96. 0.000 0.000 ↓ 0.0 0

Seq Scan on public.pim_room (cost=0.00..908.15 rows=33,515 width=26) (never executed)

  • Output: pim_room.name, pim_room.id
97. 2.560 2.560 ↑ 1.0 1 16

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

  • Output: get_bed_day_amount_n2o(c.id)
  • Buffers: shared hit=244
98. 0.016 0.208 ↓ 0.0 0 16

Limit (cost=3.56..3.57 rows=1 width=8) (actual time=0.013..0.013 rows=0 loops=16)

  • Output: ffs.id, fspt1.funding_source_id
  • Buffers: shared hit=17
99. 0.032 0.192 ↓ 0.0 0 16

Sort (cost=3.56..3.57 rows=1 width=8) (actual time=0.012..0.012 rows=0 loops=16)

  • Output: ffs.id, fspt1.funding_source_id
  • Sort Key: ffs.id
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=17
100. 0.000 0.160 ↓ 0.0 0 16

Nested Loop (cost=1.07..3.55 rows=1 width=8) (actual time=0.010..0.010 rows=0 loops=16)

  • Output: ffs.id, fspt1.funding_source_id
  • Buffers: shared hit=17
101. 0.060 0.160 ↓ 0.0 0 16

Hash Join (cost=1.07..2.41 rows=1 width=12) (actual time=0.010..0.010 rows=0 loops=16)

  • Output: ffs.id, fspt1.funding_source_id, fspt1.payment_type_id
  • Hash Cond: (ffs.id = fspt1.funding_source_id)
  • Buffers: shared hit=17
102. 0.004 0.004 ↑ 13.0 1 1

Seq Scan on inventory.funding_source ffs (cost=0.00..1.27 rows=13 width=4) (actual time=0.004..0.004 rows=1 loops=1)

  • Output: ffs.id, ffs.code, ffs.name, ffs.org_id, ffs.aud_who, ffs.aud_when, ffs.aud_source, ffs.aud_who_create, ffs.aud_when_create, ffs.aud_source_create, ffs.parent_id
  • Filter: ((ffs.org_id IS NULL) OR (ffs.org_id = s._clinic_id))
  • Buffers: shared hit=1
103. 0.048 0.096 ↓ 0.0 0 16

Hash (cost=1.06..1.06 rows=1 width=8) (actual time=0.006..0.006 rows=0 loops=16)

  • Output: fspt1.funding_source_id, fspt1.payment_type_id
  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
  • Buffers: shared hit=16
104. 0.048 0.048 ↓ 0.0 0 16

Seq Scan on inventory.funding_source_payment_type fspt1 (cost=0.00..1.06 rows=1 width=8) (actual time=0.003..0.003 rows=0 loops=16)

  • Output: fspt1.funding_source_id, fspt1.payment_type_id
  • Filter: (fspt1.is_check_accounting AND ((fspt1.org_id IS NULL) OR (fspt1.org_id = s._clinic_id)) AND (fspt1.payment_type_id = hr.funding_id))
  • Rows Removed by Filter: 4
  • Buffers: shared hit=16
105. 0.000 0.000 ↓ 0.0 0

Seq Scan on public.fin_funding_source_type ffst (cost=0.00..1.14 rows=1 width=4) (never executed)

  • Output: ffst.id, ffst.bdate, ffst.code, ffst.edate, ffst.name, ffst.ordern, ffst.parent_id, ffst.has_exception, ffst.e_code, ffst.is_contract_required, ffst.is_citizen, ffst.is_payer_smo, ffst.is_payer_foms, ffst.is_default, ffst.is_privileged, ffst.aud_who, ffst.aud_when, ffst.aud_source, ffst.aud_who_create, ffst.aud_when_create, ffst.aud_source_create, ffst.from_dt, ffst.to_dt, ffst.is_vmp, ffst.billing_code
  • Filter: (ffst.id = hr.funding_id)
106. 0.016 0.176 ↓ 0.0 0 16

Limit (cost=3.56..3.57 rows=1 width=34) (actual time=0.011..0.011 rows=0 loops=16)

  • Output: ffs_1.name, fspt1_1.funding_source_id
  • Buffers: shared hit=17
107. 0.048 0.160 ↓ 0.0 0 16

Sort (cost=3.56..3.57 rows=1 width=34) (actual time=0.010..0.010 rows=0 loops=16)

  • Output: ffs_1.name, fspt1_1.funding_source_id
  • Sort Key: fspt1_1.funding_source_id, ffs_1.name
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=17
108. 0.016 0.112 ↓ 0.0 0 16

Nested Loop (cost=1.07..3.55 rows=1 width=34) (actual time=0.007..0.007 rows=0 loops=16)

  • Output: ffs_1.name, fspt1_1.funding_source_id
  • Buffers: shared hit=17
109. 0.030 0.096 ↓ 0.0 0 16

Hash Join (cost=1.07..2.41 rows=1 width=38) (actual time=0.006..0.006 rows=0 loops=16)

  • Output: ffs_1.name, fspt1_1.funding_source_id, fspt1_1.payment_type_id
  • Hash Cond: (ffs_1.id = fspt1_1.funding_source_id)
  • Buffers: shared hit=17
110. 0.002 0.002 ↑ 13.0 1 1

Seq Scan on inventory.funding_source ffs_1 (cost=0.00..1.27 rows=13 width=34) (actual time=0.002..0.002 rows=1 loops=1)

  • Output: ffs_1.id, ffs_1.code, ffs_1.name, ffs_1.org_id, ffs_1.aud_who, ffs_1.aud_when, ffs_1.aud_source, ffs_1.aud_who_create, ffs_1.aud_when_create, ffs_1.aud_source_create, ffs_1.parent_id
  • Filter: ((ffs_1.org_id IS NULL) OR (ffs_1.org_id = s._clinic_id))
  • Buffers: shared hit=1
111. 0.032 0.064 ↓ 0.0 0 16

Hash (cost=1.06..1.06 rows=1 width=8) (actual time=0.004..0.004 rows=0 loops=16)

  • Output: fspt1_1.funding_source_id, fspt1_1.payment_type_id
  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
  • Buffers: shared hit=16
112. 0.032 0.032 ↓ 0.0 0 16

Seq Scan on inventory.funding_source_payment_type fspt1_1 (cost=0.00..1.06 rows=1 width=8) (actual time=0.002..0.002 rows=0 loops=16)

  • Output: fspt1_1.funding_source_id, fspt1_1.payment_type_id
  • Filter: (fspt1_1.is_check_accounting AND ((fspt1_1.org_id IS NULL) OR (fspt1_1.org_id = s._clinic_id)) AND (fspt1_1.payment_type_id = hr.funding_id))
  • Rows Removed by Filter: 4
  • Buffers: shared hit=16
113. 0.000 0.000 ↓ 0.0 0

Seq Scan on public.fin_funding_source_type ffst_1 (cost=0.00..1.14 rows=1 width=4) (never executed)

  • Output: ffst_1.id, ffst_1.bdate, ffst_1.code, ffst_1.edate, ffst_1.name, ffst_1.ordern, ffst_1.parent_id, ffst_1.has_exception, ffst_1.e_code, ffst_1.is_contract_required, ffst_1.is_citizen, ffst_1.is_payer_smo, ffst_1.is_payer_foms, ffst_1.is_default, ffst_1.is_privileged, ffst_1.aud_who, ffst_1.aud_when, ffst_1.aud_source, ffst_1.aud_who_create, ffst_1.aud_when_create, ffst_1.aud_source_create, ffst_1.from_dt, ffst_1.to_dt, ffst_1.is_vmp, ffst_1.billing_code
  • Filter: (ffst_1.id = hr.funding_id)
114. 0.000 0.000 ↓ 0.0 0 16

Hash Join (cost=78.56..91.46 rows=1 width=0) (actual time=0.000..0.000 rows=0 loops=16)

  • Hash Cond: (oc.pregnant_outcome_id = o.id)
115. 0.000 0.000 ↓ 0.0 0 16

Seq Scan on motherhood.mh_pregnant_outcome_child oc (cost=0.00..12.10 rows=210 width=4) (actual time=0.000..0.000 rows=0 loops=16)

  • Output: oc.id, oc.gender_id, oc.birth_dt, oc.outcome_id, oc.pregnant_outcome_id, oc.note, oc.weight, oc.height, oc.pulse_id, oc.breath_id, oc.muscle_tone_id, oc.reflexes_id, oc.skin_color_id, oc.patient_id, oc.aud_who, oc.aud_when, oc.aud_source, oc.aud_who_create, oc.aud_when_create, oc.aud_source_create, oc.full_term_id, oc.head, oc.chest
116. 0.000 0.000 ↓ 0.0 0

Hash (cost=78.55..78.55 rows=1 width=4) (never executed)

  • Output: o.id
117. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=63.18..78.55 rows=1 width=4) (never executed)

  • Output: o.id
  • Hash Cond: (o.service_id = msr.id)
118. 0.000 0.000 ↓ 0.0 0

Seq Scan on motherhood.mh_pregnant_outcome o (cost=0.00..13.90 rows=390 width=8) (never executed)

  • Output: o.id, o.service_id, o.pregnant_age, o.reg_number, o.start_anhydrous_dt, o.end_anhydrous_dt, o.is_surgery, o.aud_who, o.aud_when, o.aud_source, o.aud_who_create, o.aud_when_create, o.aud_source_create
119. 0.000 0.000 ↓ 0.0 0

Hash (cost=54.50..54.50 rows=694 width=4) (never executed)

  • Output: msr.id
120. 0.000 0.000 ↓ 0.0 0

Index Scan using md_srv_rendered_case_id_idx on public.md_srv_rendered msr (cost=0.57..54.50 rows=694 width=4) (never executed)

  • Output: msr.id
  • Index Cond: (msr.case_id = c.id)
Planning time : 72.195 ms
Execution time : 477.608 ms