explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Eis7I

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 281.424 ↓ 16.0 16 1

Limit (cost=475.38..119,875.29 rows=1 width=495) (actual time=89.716..281.424 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)), (6742), ((SubPlan 5))
  • Buffers: shared hit=73815
2.          

Initplan (for Limit)

3. 0.000 0.000 ↓ 0.0 0

Index Scan using pim_department_pk on public.pim_department (cost=0.28..8.30 rows=1 width=4) (never executed)

  • Output: pim_department.is_social_significant
  • Index Cond: (pim_department.id = 6742)
4. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=5.11..76.98 rows=1 width=0) (never executed)

  • Join Filter: (sur.role_id = sr.id)
5. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=4.97..76.81 rows=1 width=8) (never executed)

  • Output: sur.role_id, sre.role_id
6. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=4.69..70.17 rows=17 width=4) (never executed)

  • Output: sre.role_id
7. 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, cm.version, cm.code, cm.has_groups, cm.name, cm.note, cm.class_id, cm.aud_who, cm.aud_when, cm.aud_source, cm.aud_who_create, cm.aud_when_create, cm.aud_source_create
  • Index Cond: ((cm.code)::text = 'SocialSignificant.NarcologicProfile'::text)
8. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on public.sec_role_element sre (cost=4.41..61.71 rows=17 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
  • Recheck Cond: (sre.method_id = cm.id)
9. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on sec_role_element_method_id_idx (cost=0.00..4.41 rows=17 width=0) (never executed)

  • Index Cond: (sre.method_id = cm.id)
10. 0.000 0.000 ↓ 0.0 0

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

  • Output: sur.user_id, sur.role_id
  • Index Cond: ((sur.user_id = 2358) AND (sur.role_id = sre.role_id))
  • Heap Fetches: 0
11. 0.000 0.000 ↓ 0.0 0

Index Only Scan using sec_role_pk on public.sec_role sr (cost=0.14..0.16 rows=1 width=4) (never executed)

  • Output: sr.id
  • Index Cond: (sr.id = sre.role_id)
  • Heap Fetches: 0
12. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=5.11..76.98 rows=1 width=0) (never executed)

  • Join Filter: (sur_1.role_id = sr_1.id)
13. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=4.97..76.81 rows=1 width=8) (never executed)

  • Output: sur_1.role_id, sre_1.role_id
14. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=4.69..70.17 rows=17 width=4) (never executed)

  • Output: sre_1.role_id
15. 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, cm_1.version, cm_1.code, cm_1.has_groups, cm_1.name, cm_1.note, cm_1.class_id, cm_1.aud_who, cm_1.aud_when, cm_1.aud_source, cm_1.aud_who_create, cm_1.aud_when_create, cm_1.aud_source_create
  • Index Cond: ((cm_1.code)::text = 'SocialSignificant.PsychiatricProfile'::text)
16. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on public.sec_role_element sre_1 (cost=4.41..61.71 rows=17 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
  • Recheck Cond: (sre_1.method_id = cm_1.id)
17. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on sec_role_element_method_id_idx (cost=0.00..4.41 rows=17 width=0) (never executed)

  • Index Cond: (sre_1.method_id = cm_1.id)
18. 0.000 0.000 ↓ 0.0 0

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

  • Output: sur_1.user_id, sur_1.role_id
  • Index Cond: ((sur_1.user_id = 2358) AND (sur_1.role_id = sre_1.role_id))
  • Heap Fetches: 0
19. 0.000 0.000 ↓ 0.0 0

Index Only Scan using sec_role_pk on public.sec_role sr_1 (cost=0.14..0.16 rows=1 width=4) (never executed)

  • Output: sr_1.id
  • Index Cond: (sr_1.id = sre_1.role_id)
  • Heap Fetches: 0
20. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=5.11..76.98 rows=1 width=0) (never executed)

  • Join Filter: (sur_2.role_id = sr_2.id)
21. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=4.97..76.81 rows=1 width=8) (never executed)

  • Output: sur_2.role_id, sre_2.role_id
22. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=4.69..70.17 rows=17 width=4) (never executed)

  • Output: sre_2.role_id
23. 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, cm_2.version, cm_2.code, cm_2.has_groups, cm_2.name, cm_2.note, cm_2.class_id, cm_2.aud_who, cm_2.aud_when, cm_2.aud_source, cm_2.aud_who_create, cm_2.aud_when_create, cm_2.aud_source_create
  • Index Cond: ((cm_2.code)::text = 'SocialSignificant.VenereologicalProfile'::text)
24. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on public.sec_role_element sre_2 (cost=4.41..61.71 rows=17 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
  • Recheck Cond: (sre_2.method_id = cm_2.id)
25. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on sec_role_element_method_id_idx (cost=0.00..4.41 rows=17 width=0) (never executed)

  • Index Cond: (sre_2.method_id = cm_2.id)
26. 0.000 0.000 ↓ 0.0 0

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

  • Output: sur_2.user_id, sur_2.role_id
  • Index Cond: ((sur_2.user_id = 2358) AND (sur_2.role_id = sre_2.role_id))
  • Heap Fetches: 0
27. 0.000 0.000 ↓ 0.0 0

Index Only Scan using sec_role_pk on public.sec_role sr_2 (cost=0.14..0.16 rows=1 width=4) (never executed)

  • Output: sr_2.id
  • Index Cond: (sr_2.id = sre_2.role_id)
  • Heap Fetches: 0
28. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=5.11..76.98 rows=1 width=0) (never executed)

  • Join Filter: (sur_3.role_id = sr_3.id)
29. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=4.97..76.81 rows=1 width=8) (never executed)

  • Output: sur_3.role_id, sre_3.role_id
30. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=4.69..70.17 rows=17 width=4) (never executed)

  • Output: sre_3.role_id
31. 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, cm_3.version, cm_3.code, cm_3.has_groups, cm_3.name, cm_3.note, cm_3.class_id, cm_3.aud_who, cm_3.aud_when, cm_3.aud_source, cm_3.aud_who_create, cm_3.aud_when_create, cm_3.aud_source_create
  • Index Cond: ((cm_3.code)::text = 'SocialSignificant.TBProfile'::text)
32. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on public.sec_role_element sre_3 (cost=4.41..61.71 rows=17 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
  • Recheck Cond: (sre_3.method_id = cm_3.id)
33. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on sec_role_element_method_id_idx (cost=0.00..4.41 rows=17 width=0) (never executed)

  • Index Cond: (sre_3.method_id = cm_3.id)
34. 0.000 0.000 ↓ 0.0 0

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

  • Output: sur_3.user_id, sur_3.role_id
  • Index Cond: ((sur_3.user_id = 2358) AND (sur_3.role_id = sre_3.role_id))
  • Heap Fetches: 0
35. 0.000 0.000 ↓ 0.0 0

Index Only Scan using sec_role_pk on public.sec_role sr_3 (cost=0.14..0.16 rows=1 width=4) (never executed)

  • Output: sr_3.id
  • Index Cond: (sr_3.id = sre_3.role_id)
  • Heap Fetches: 0
36. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=5.11..76.98 rows=1 width=0) (never executed)

  • Join Filter: (sur_4.role_id = sr_4.id)
37. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=4.97..76.81 rows=1 width=8) (never executed)

  • Output: sur_4.role_id, sre_4.role_id
38. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=4.69..70.17 rows=17 width=4) (never executed)

  • Output: sre_4.role_id
39. 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, cm_4.version, cm_4.code, cm_4.has_groups, cm_4.name, cm_4.note, cm_4.class_id, cm_4.aud_who, cm_4.aud_when, cm_4.aud_source, cm_4.aud_who_create, cm_4.aud_when_create, cm_4.aud_source_create
  • Index Cond: ((cm_4.code)::text = 'SocialSignificant.HIVProfile'::text)
40. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on public.sec_role_element sre_4 (cost=4.41..61.71 rows=17 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
  • Recheck Cond: (sre_4.method_id = cm_4.id)
41. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on sec_role_element_method_id_idx (cost=0.00..4.41 rows=17 width=0) (never executed)

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

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

  • Output: sur_4.user_id, sur_4.role_id
  • Index Cond: ((sur_4.user_id = 2358) AND (sur_4.role_id = sre_4.role_id))
  • Heap Fetches: 0
43. 0.000 0.000 ↓ 0.0 0

Index Only Scan using sec_role_pk on public.sec_role sr_4 (cost=0.14..0.16 rows=1 width=4) (never executed)

  • Output: sr_4.id
  • Index Cond: (sr_4.id = sre_4.role_id)
  • Heap Fetches: 0
44. 0.002 0.064 ↑ 1.0 1 1

Result (cost=76.98..76.99 rows=1 width=0) (actual time=0.064..0.064 rows=1 loops=1)

  • Output: $25
  • Buffers: shared hit=11
45.          

Initplan (for Result)

46. 0.001 0.062 ↓ 0.0 0 1

Nested Loop (cost=5.11..76.98 rows=1 width=0) (actual time=0.062..0.062 rows=0 loops=1)

  • Join Filter: (ur.role_id = r.id)
  • Buffers: shared hit=11
47. 0.003 0.061 ↓ 0.0 0 1

Nested Loop (cost=4.97..76.81 rows=1 width=8) (actual time=0.061..0.061 rows=0 loops=1)

  • Output: ur.role_id, e_1.role_id
  • Buffers: shared hit=11
48. 0.008 0.050 ↑ 8.5 2 1

Nested Loop (cost=4.69..70.17 rows=17 width=4) (actual time=0.047..0.050 rows=2 loops=1)

  • Output: e_1.role_id
  • Buffers: shared hit=7
49. 0.020 0.020 ↑ 1.0 1 1

Index Scan using sec_class_method_code_ak on public.sec_class_method scm (cost=0.27..8.29 rows=1 width=4) (actual time=0.020..0.020 rows=1 loops=1)

  • Output: scm.id, scm.version, scm.code, scm.has_groups, scm.name, scm.note, scm.class_id, scm.aud_who, scm.aud_when, scm.aud_source, scm.aud_who_create, scm.aud_when_create, scm.aud_source_create
  • Index Cond: ((scm.code)::text = 'Patient.access.to.archive'::text)
  • Buffers: shared hit=3
50. 0.008 0.022 ↑ 8.5 2 1

Bitmap Heap Scan on public.sec_role_element e_1 (cost=4.41..61.71 rows=17 width=8) (actual time=0.020..0.022 rows=2 loops=1)

  • Output: e_1.id, e_1.obj_group_id, e_1.property_id, e_1.role_id, e_1.method_id, e_1.aud_who, e_1.aud_when, e_1.aud_source, e_1.aud_who_create, e_1.aud_when_create, e_1.aud_source_create
  • Recheck Cond: (e_1.method_id = scm.id)
  • Heap Blocks: exact=2
  • Buffers: shared hit=4
51. 0.014 0.014 ↑ 8.5 2 1

Bitmap Index Scan on sec_role_element_method_id_idx (cost=0.00..4.41 rows=17 width=0) (actual time=0.014..0.014 rows=2 loops=1)

  • Index Cond: (e_1.method_id = scm.id)
  • Buffers: shared hit=2
52. 0.008 0.008 ↓ 0.0 0 2

Index Only Scan using ak_userrole on public.sec_user_role ur (cost=0.29..0.38 rows=1 width=4) (actual time=0.004..0.004 rows=0 loops=2)

  • Output: ur.user_id, ur.role_id
  • Index Cond: ((ur.user_id = 2358) AND (ur.role_id = e_1.role_id))
  • Heap Fetches: 0
  • Buffers: shared hit=4
53. 0.000 0.000 ↓ 0.0 0

Index Only Scan using sec_role_pk on public.sec_role r (cost=0.14..0.16 rows=1 width=4) (never executed)

  • Output: r.id
  • Index Cond: (r.id = e_1.role_id)
  • Heap Fetches: 0
54. 0.295 281.410 ↓ 16.0 16 1

Result (cost=5.17..119,405.08 rows=1 width=495) (actual time=89.710..281.410 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), 6742, (SubPlan 5)
  • One-Time Filter: ((length(concat(NULL::date, '2020-02-02'::date)) <> 0) OR (length(concat('2020-01-27'::date, '2020-02-02'::date)) <> 0))
  • Buffers: shared hit=73815
55. 0.069 272.139 ↓ 16.0 16 1

Nested Loop Anti Join (cost=5.17..118,539.58 rows=1 width=495) (actual time=83.706..272.139 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, 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=73109
56. 0.034 271.814 ↓ 32.0 32 1

Nested Loop Left Join (cost=4.29..118,513.73 rows=1 width=495) (actual time=66.411..271.814 rows=32 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, 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=72933
57. 0.044 271.620 ↓ 32.0 32 1

Nested Loop Left Join (cost=3.87..118,506.85 rows=1 width=450) (actual time=66.398..271.620 rows=32 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, 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=72805
58. 0.076 271.448 ↓ 32.0 32 1

Nested Loop Left Join (cost=3.58..118,498.53 rows=1 width=450) (actual time=66.386..271.448 rows=32 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, 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=72709
59. 53.055 271.212 ↓ 32.0 32 1

Nested Loop Left Join (cost=3.29..118,492.06 rows=1 width=446) (actual time=66.366..271.212 rows=32 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, 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
  • Join Filter: (dg.id = mcdiag.diagnos_id)
  • Rows Removed by Join Filter: 477648
  • Buffers: shared hit=72613
60. 0.043 172.621 ↓ 32.0 32 1

Nested Loop Left Join (cost=3.29..117,760.20 rows=1 width=328) (actual time=65.409..172.621 rows=32 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, 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=59941
61. 0.130 172.418 ↓ 32.0 32 1

Nested Loop Left Join (cost=2.72..117,753.37 rows=1 width=328) (actual time=65.392..172.418 rows=32 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.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: 223
  • Buffers: shared hit=59861
62. 19.504 172.192 ↓ 32.0 32 1

Nested Loop (cost=2.72..117,752.19 rows=1 width=295) (actual time=65.380..172.192 rows=32 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.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
  • Join Filter: (hr.department_id = dp.id)
  • Rows Removed by Join Filter: 219115
  • Buffers: shared hit=59829
63. 0.052 105.040 ↓ 32.0 32 1

Nested Loop (cost=2.72..117,408.48 rows=1 width=229) (actual time=64.788..105.040 rows=32 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.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
  • Buffers: shared hit=54629
64. 0.069 104.700 ↓ 32.0 32 1

Nested Loop (cost=2.29..117,401.86 rows=1 width=233) (actual time=64.706..104.700 rows=32 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.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
  • Buffers: shared hit=54490
65. 13.756 104.407 ↓ 32.0 32 1

Nested Loop Left Join (cost=1.87..117,395.24 rows=1 width=176) (actual time=64.690..104.407 rows=32 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.main_diagnosis_id, rg.responsible_id, csg_t.name, c.uid, c.id, c.closing_step_id, c.patient_id
  • Join Filter: (csg_t.id = s.csg_id)
  • Rows Removed by Join Filter: 165568
  • Buffers: shared hit=54362
66. 2.249 63.867 ↓ 32.0 32 1

Nested Loop (cost=1.87..117,129.83 rows=1 width=78) (actual time=63.080..63.867 rows=32 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.csg_id, s._patient_id, s.main_diagnosis_id, rg.responsible_id, c.uid, c.id, c.closing_step_id, c.patient_id
  • Buffers: shared hit=49594
67. 1.987 47.033 ↓ 121.5 2,917 1

Nested Loop (cost=1.43..116,969.10 rows=24 width=64) (actual time=0.081..47.033 rows=2,917 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.csg_id, s.case_id, s._patient_id, s.main_diagnosis_id, rg.responsible_id
  • Buffers: shared hit=37912
68. 0.828 33.378 ↓ 3.9 2,917 1

Nested Loop (cost=1.00..112,055.85 rows=743 width=52) (actual time=0.069..33.378 rows=2,917 loops=1)

  • Output: s._clinic_id, s.res_group_id, s.regimen_id, s.admission_date, s.admission_time, s.outcome_date, s.id, s.csg_id, s.case_id, s._patient_id, s.main_diagnosis_id, rg.responsible_id
  • Buffers: shared hit=26222
69. 3.714 3.714 ↑ 1.8 7,209 1

Index Only Scan using sr_res_group_responsible_id_id_ix on public.sr_res_group rg (cost=0.57..4,769.56 rows=13,165 width=8) (actual time=0.041..3.714 rows=7,209 loops=1)

  • Output: rg.responsible_id, rg.id
  • Index Cond: (rg.responsible_id = 68241)
  • Heap Fetches: 1919
  • Buffers: shared hit=1667
70. 28.836 28.836 ↓ 0.0 0 7,209

Index Scan using mc_step_res_group_id_key on public.mc_step s (cost=0.44..8.14 rows=1 width=48) (actual time=0.004..0.004 rows=0 loops=7,209)

  • 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.gestational_age, s.onko_stage, s.hsp_bed_profile_id, s.is_first_step
  • Index Cond: (s.res_group_id = rg.id)
  • Filter: ((s._clinic_id = 36988) AND ((s.admission_date + COALESCE(s.admission_time, '00:00:00'::time without time zone)) >= '-infinity'::timestamp without time zone) AND ((s.admission_date + COALESCE(s.admission_time, '00:00:00'::time without time zone)) <= '2020-02-02 00:00:00'::timestamp without time zone))
  • Buffers: shared hit=24555
71. 11.668 11.668 ↑ 1.0 1 2,917

Index Scan using hsp_record_pk on public.hsp_record hr (cost=0.42..6.60 rows=1 width=16) (actual time=0.003..0.004 rows=1 loops=2,917)

  • 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=11690
72. 14.585 14.585 ↓ 0.0 0 2,917

Index Scan using mc_case_pk on public.mc_case c (cost=0.44..6.69 rows=1 width=18) (actual time=0.005..0.005 rows=0 loops=2,917)

  • Output: c.uid, c.id, c.closing_step_id, c.patient_id
  • Index Cond: (c.id = s.case_id)
  • Filter: (((c.closing_step_id IS NULL) OR ((c.closing_step_id IS NOT NULL) AND (s.outcome_date > ('now'::cstring)::date))) AND ((c.is_social_significant IS NULL) OR (c.is_social_significant = $7) OR ((c.is_social_significant = 1) AND $10) OR ((c.is_social_significant = 2) AND $13) OR ((c.is_social_significant = 3) AND $16) OR ((c.is_social_significant = 4) AND $19) OR ((c.is_social_significant = 5) AND $22)))
  • Rows Removed by Filter: 1
  • Buffers: shared hit=11682
73. 26.784 26.784 ↑ 1.0 5,174 32

Seq Scan on public.md_clinical_statistical_group csg_t (cost=0.00..200.74 rows=5,174 width=106) (actual time=0.002..0.837 rows=5,174 loops=32)

  • Output: csg_t.name, csg_t.id
  • Buffers: shared hit=4768
74. 0.224 0.224 ↑ 1.0 1 32

Index Scan using pim_individual_pk on public.pim_individual pi (cost=0.43..6.61 rows=1 width=57) (actual time=0.007..0.007 rows=1 loops=32)

  • 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, pi.is_only_birth_year
  • Index Cond: (pi.id = s._patient_id)
  • Buffers: shared hit=128
75. 0.288 0.288 ↑ 1.0 1 32

Index Scan using pci_patient_pk on public.pci_patient p (cost=0.43..6.61 rows=1 width=4) (actual time=0.008..0.009 rows=1 loops=32)

  • Output: p.id, p.created_dt, p.note, p.vip, p.rh_blood_group_id, p.ethnic_group_id, p.social_group_id, p.death_src_inf_id, p.empl_state_death_id, p.unidentified_dt, p.newborn_number, p.education_type_id, p.birthweight, p.aud_who, p.aud_when, p.aud_source, p.aud_who_create, p.aud_when_create, p.aud_source_create, p.employee_reg_death_position_id, p.last_fluorography_date, p.is_arch
  • Index Cond: (p.id = s._patient_id)
  • Filter: CASE WHEN (NOT $26) THEN (NOT p.is_arch) ELSE true END
  • Buffers: shared hit=139
76. 47.648 47.648 ↑ 1.0 6,848 32

Seq Scan on public.pim_department dp (cost=0.00..256.06 rows=7,012 width=66) (actual time=0.003..1.489 rows=6,848 loops=32)

  • 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.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
  • Filter: (dp.type_id <> 4)
  • Rows Removed by Filter: 110
  • Buffers: shared hit=5200
77. 0.096 0.096 ↑ 1.0 8 32

Seq Scan on public.fin_funding_source_type fst (cost=0.00..1.08 rows=8 width=33) (actual time=0.001..0.003 rows=8 loops=32)

  • Output: fst.id, fst.bdate, fst.code, fst.edate, fst.name, fst.ordern, fst.parent_id, fst.has_exception, fst.e_code, fst.is_contract_required, fst.is_citizen, fst.is_payer_smo, fst.is_payer_foms, fst.is_default, fst.is_privileged, fst.aud_who, fst.aud_when, fst.aud_source, fst.aud_who_create, fst.aud_when_create, fst.aud_source_create, fst.from_dt, fst.to_dt, fst.is_vmp, fst.billing_code
  • Buffers: shared hit=32
78. 0.160 0.160 ↓ 0.0 0 32

Index Scan using mc_diagnosis_pk on public.mc_diagnosis mcdiag (cost=0.56..6.82 rows=1 width=8) (actual time=0.004..0.005 rows=0 loops=32)

  • Output: mcdiag.id, mcdiag.diagnos_id
  • Index Cond: (mcdiag.id = s.main_diagnosis_id)
  • Buffers: shared hit=80
79. 45.536 45.536 ↑ 1.0 14,927 32

Seq Scan on public.md_diagnosis dg (cost=0.00..545.27 rows=14,927 width=126) (actual time=0.001..1.423 rows=14,927 loops=32)

  • 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
  • Buffers: shared hit=12672
80. 0.160 0.160 ↑ 1.0 1 32

Index Scan using pim_employee_position_pk on public.pim_employee_position ep (cost=0.29..6.46 rows=1 width=8) (actual time=0.005..0.005 rows=1 loops=32)

  • 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) AND (ep.id = 68241))
  • Buffers: shared hit=96
81. 0.128 0.128 ↑ 1.0 1 32

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

  • 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=96
82. 0.160 0.160 ↑ 1.0 1 32

Index Scan using pim_individual_pk on public.pim_individual ei (cost=0.43..6.87 rows=1 width=53) (actual time=0.004..0.005 rows=1 loops=32)

  • 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, ei.is_only_birth_year
  • Index Cond: (ei.id = e.individual_id)
  • Buffers: shared hit=128
83. 0.032 0.256 ↓ 0.0 0 32

Nested Loop (cost=0.86..13.34 rows=1 width=8) (actual time=0.008..0.008 rows=0 loops=32)

  • Output: h2.previous_id, s2.case_id
  • Buffers: shared hit=176
84. 0.128 0.128 ↓ 0.0 0 32

Index Scan using hsp_record_previous_id_idx on public.hsp_record h2 (cost=0.42..6.60 rows=1 width=8) (actual time=0.004..0.004 rows=0 loops=32)

  • 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=112
85. 0.096 0.096 ↑ 1.0 1 16

Index Scan using mc_step_pk on public.mc_step s2 (cost=0.44..6.73 rows=1 width=8) (actual time=0.006..0.006 rows=1 loops=16)

  • 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.gestational_age, s2.onko_stage, s2.hsp_bed_profile_id, s2.is_first_step
  • Index Cond: (s2.id = h2.id)
  • Buffers: shared hit=64
86.          

SubPlan (for Result)

87. 0.032 5.792 ↓ 0.0 0 16

Limit (cost=794.05..794.06 rows=1 width=21) (actual time=0.362..0.362 rows=0 loops=16)

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

Sort (cost=794.05..794.62 rows=228 width=21) (actual time=0.360..0.360 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=238
89. 0.084 5.696 ↓ 0.0 0 16

Hash Join (cost=496.44..792.91 rows=228 width=21) (actual time=0.356..0.356 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=238
90. 0.061 3.552 ↓ 0.0 0 16

Hash Join (cost=321.35..613.55 rows=228 width=6) (actual time=0.222..0.222 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=160
91. 0.003 0.003 ↑ 10,176.0 1 1

Seq Scan on public.md_bed (cost=0.00..251.76 rows=10,176 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
92. 0.016 3.488 ↓ 0.0 0 16

Hash (cost=318.50..318.50 rows=228 width=4) (actual time=0.218..0.218 rows=0 loops=16)

  • Output: md_bed_resource.bed_id
  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
  • Buffers: shared hit=159
93. 0.138 3.472 ↓ 0.0 0 16

Hash Join (cost=289.90..318.50 rows=228 width=4) (actual time=0.217..0.217 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=159
94. 0.128 0.128 ↑ 238.0 1 16

Index Scan using sr_res_group_relationship__group_id_ix on public.sr_res_group_relationship (cost=0.57..26.00 rows=238 width=4) (actual time=0.008..0.008 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, sr_res_group_relationship._is_system
  • 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=80
95. 1.535 3.206 ↓ 1.0 9,349 1

Hash (cost=172.48..172.48 rows=9,348 width=8) (actual time=3.206..3.206 rows=9,349 loops=1)

  • Output: md_bed_resource.id, md_bed_resource.bed_id
  • Buckets: 16384 Batches: 1 Memory Usage: 494kB
  • Buffers: shared hit=79
96. 1.671 1.671 ↓ 1.0 9,349 1

Seq Scan on public.md_bed_resource (cost=0.00..172.48 rows=9,348 width=8) (actual time=0.006..1.671 rows=9,349 loops=1)

  • Output: md_bed_resource.id, md_bed_resource.bed_id
  • Buffers: shared hit=79
97. 0.983 2.060 ↓ 1.0 4,316 1

Hash (cost=121.15..121.15 rows=4,315 width=23) (actual time=2.060..2.060 rows=4,316 loops=1)

  • Output: pim_room.name, pim_room.id
  • Buckets: 8192 Batches: 1 Memory Usage: 306kB
  • Buffers: shared hit=78
98. 1.077 1.077 ↓ 1.0 4,316 1

Seq Scan on public.pim_room (cost=0.00..121.15 rows=4,315 width=23) (actual time=0.009..1.077 rows=4,316 loops=1)

  • Output: pim_room.name, pim_room.id
  • Buffers: shared hit=78
99. 2.640 2.640 ↑ 1.0 1 16

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

  • Output: get_bed_day_amount_n2o(c.id)
  • Buffers: shared hit=354
100. 0.016 0.224 ↓ 0.0 0 16

Limit (cost=3.50..3.50 rows=1 width=8) (actual time=0.014..0.014 rows=0 loops=16)

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

Sort (cost=3.50..3.50 rows=1 width=8) (actual time=0.013..0.013 rows=0 loops=16)

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

Nested Loop (cost=1.10..3.49 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
103. 0.042 0.144 ↓ 0.0 0 16

Hash Join (cost=1.10..2.38 rows=1 width=12) (actual time=0.009..0.009 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
104. 0.006 0.006 ↑ 7.0 1 1

Seq Scan on inventory.funding_source ffs (cost=0.00..1.24 rows=7 width=4) (actual time=0.006..0.006 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
105. 0.016 0.096 ↓ 0.0 0 16

Hash (cost=1.09..1.09 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
106. 0.080 0.080 ↓ 0.0 0 16

Seq Scan on inventory.funding_source_payment_type fspt1 (cost=0.00..1.09 rows=1 width=8) (actual time=0.005..0.005 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: 6
  • Buffers: shared hit=16
107. 0.000 0.000 ↓ 0.0 0

Seq Scan on public.fin_funding_source_type ffst (cost=0.00..1.10 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)
108. 0.000 0.144 ↓ 0.0 0 16

Limit (cost=3.50..3.50 rows=1 width=27) (actual time=0.009..0.009 rows=0 loops=16)

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

Sort (cost=3.50..3.50 rows=1 width=27) (actual time=0.009..0.009 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
110. 0.016 0.096 ↓ 0.0 0 16

Nested Loop (cost=1.10..3.49 rows=1 width=27) (actual time=0.006..0.006 rows=0 loops=16)

  • Output: ffs_1.name, fspt1_1.funding_source_id
  • Buffers: shared hit=17
111. 0.029 0.080 ↓ 0.0 0 16

Hash Join (cost=1.10..2.38 rows=1 width=31) (actual time=0.005..0.005 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
112. 0.003 0.003 ↑ 7.0 1 1

Seq Scan on inventory.funding_source ffs_1 (cost=0.00..1.24 rows=7 width=27) (actual time=0.003..0.003 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
113. 0.016 0.048 ↓ 0.0 0 16

Hash (cost=1.09..1.09 rows=1 width=8) (actual time=0.003..0.003 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
114. 0.032 0.032 ↓ 0.0 0 16

Seq Scan on inventory.funding_source_payment_type fspt1_1 (cost=0.00..1.09 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: 6
  • Buffers: shared hit=16
115. 0.000 0.000 ↓ 0.0 0

Seq Scan on public.fin_funding_source_type ffst_1 (cost=0.00..1.10 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)
116. 0.000 0.176 ↓ 0.0 0 16

Nested Loop (cost=2.31..64.12 rows=1 width=0) (actual time=0.011..0.011 rows=0 loops=16)

  • Join Filter: (o.id = oc.pregnant_outcome_id)
  • Buffers: shared hit=80
117. 0.028 0.176 ↓ 0.0 0 16

Hash Join (cost=2.31..62.51 rows=1 width=4) (actual time=0.011..0.011 rows=0 loops=16)

  • Output: o.id
  • Hash Cond: (msr.id = o.service_id)
  • Buffers: shared hit=80
118. 0.128 0.128 ↑ 901.0 1 16

Index Scan using md_srv_rendered_case_id_idx on public.md_srv_rendered msr (cost=0.57..57.38 rows=901 width=4) (actual time=0.008..0.008 rows=1 loops=16)

  • Output: msr.id, msr.is_urgent, msr.is_use_cryogenic, msr.is_use_endoscopic, msr.is_use_laser, msr.anesthesia_type_id, msr.step_id, msr.complication_type_id, msr.diagnosis_id, msr.case_id, msr.referral_id, msr.result_category_id, msr.patient_prescription_id, msr.health_group_id, msr.vmp_type_id, msr.vmp_method_id, msr.anatomic_zone_id, msr.aud_who, msr.aud_when, msr.aud_source, msr.aud_who_create, msr.aud_when_create, msr.aud_source_create, msr.prescription_id, msr.by_standard, msr.complicated_value, msr.vmp_profile_id
  • Index Cond: (msr.case_id = c.id)
  • Buffers: shared hit=79
119. 0.009 0.020 ↓ 1.2 38 1

Hash (cost=1.33..1.33 rows=33 width=8) (actual time=0.020..0.020 rows=38 loops=1)

  • Output: o.id, o.service_id
  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
  • Buffers: shared hit=1
120. 0.011 0.011 ↓ 1.2 38 1

Seq Scan on motherhood.mh_pregnant_outcome o (cost=0.00..1.33 rows=33 width=8) (actual time=0.006..0.011 rows=38 loops=1)

  • Output: o.id, o.service_id
  • Buffers: shared hit=1
121. 0.000 0.000 ↓ 0.0 0

Seq Scan on motherhood.mh_pregnant_outcome_child oc (cost=0.00..1.27 rows=27 width=4) (never executed)

  • 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, oc.surname, oc.patr_name
Planning time : 127.698 ms
Execution time : 282.837 ms