explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 6miK

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 43,773.982 ↓ 0.0 0 1

Limit (cost=5,741.25..5,741.26 rows=1 width=276) (actual time=43,773.982..43,773.982 rows=0 loops=1)

  • Output: mc.id, c.id, mc.uid, mc.open_date, mc.close_date, laststepdep.id, mcd.diagnos_id, rend.id, (concat_ws(' '::text, diag.code, diag.name)), mct.id, mct.name, ((alternatives: SubPlan 1 or hashed SubPlan 2)), ((alternatives: SubPlan 3 or hashed SubPlan 4)), ((alternatives: SubPlan 5 or hashed SubPlan 6)), i.id, (concat(((i.surname)::text || ' '::text), ("substring"((i.name)::text, 1, 1) || '.'::text), ("substring"((i.patr_name)::text, 1, 1) || '.'::text))), (date_part('year'::text, age(now(), (i.birth_dt)::timestamp with time zone))), ((SubPlan 7)), ((SubPlan 8)), ((SubPlan 9)), ((SubPlan 10)), ((SubPlan 11)), ((SubPlan 12)), (1), (CASE WHEN (NOT $15) THEN true ELSE false END), (CASE WHEN ($18 AND ((SubPlan 15) = 1)) THEN true ELSE false END), (CASE WHEN (((SubPlan 16) = 1) AND $23) THEN true ELSE false END), (CASE WHEN (((SubPlan 18) = 1) AND $27) THEN true ELSE false END)
  • Buffers: shared hit=54378 read=18803 dirtied=1
  • I/O Timings: read=43288.367
2.          

Initplan (for Limit)

3. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.99..53.32 rows=1 width=1) (never executed)

  • Output: p_1.allowed
4. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.99..942.99 rows=18 width=1) (never executed)

  • Output: p_1.allowed
5. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.57..442.40 rows=67 width=4) (never executed)

  • Output: r.role_id
6. 0.000 0.000 ↓ 0.0 0

Index Scan using access_key_user_id_ix on sec.access_key ac (cost=0.28..124.72 rows=37 width=4) (never executed)

  • Output: ac.id, ac.type_id, ac.org_id, ac.empl_pos_id, ac.user_id, ac.name, ac.is_blocked, ac.aud_who, ac.aud_when, ac.aud_source, ac.aud_who_create, ac.aud_when_create, ac.aud_source_create
  • Index Cond: (ac.user_id = 1)
7. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_user_access_role_user_access_id on sec.access_key_role r (cost=0.29..8.57 rows=2 width=8) (never executed)

  • Output: r.id, r.role_id, r.user_access_id, r.aud_who, r.aud_when, r.aud_source, r.aud_who_create, r.aud_when_create, r.aud_source_create
  • Index Cond: (r.user_access_id = ac.id)
8. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_permission_ref_role_id on sec.permission_ref p_1 (cost=0.42..7.46 rows=1 width=5) (never executed)

  • Output: p_1.id, p_1.section_id, p_1.element_id, p_1.permission_id, p_1.allowed, p_1.role_id, p_1.aud_who, p_1.aud_when, p_1.aud_source, p_1.aud_who_create, p_1.aud_when_create, p_1.aud_source_create, p_1.section_name, p_1.element_name, p_1.permission_name
  • Index Cond: (p_1.role_id = r.role_id)
  • Filter: (p_1.permission_id = 'ownUpdate'::text)
9. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.99..53.32 rows=1 width=1) (never executed)

  • Output: p_2.allowed
10. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.99..942.99 rows=18 width=1) (never executed)

  • Output: p_2.allowed
11. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.57..442.40 rows=67 width=4) (never executed)

  • Output: r_1.role_id
12. 0.000 0.000 ↓ 0.0 0

Index Scan using access_key_user_id_ix on sec.access_key ac_1 (cost=0.28..124.72 rows=37 width=4) (never executed)

  • Output: ac_1.id, ac_1.type_id, ac_1.org_id, ac_1.empl_pos_id, ac_1.user_id, ac_1.name, ac_1.is_blocked, ac_1.aud_who, ac_1.aud_when, ac_1.aud_source, ac_1.aud_who_create, ac_1.aud_when_create, ac_1.aud_source_create
  • Index Cond: (ac_1.user_id = 1)
13. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_user_access_role_user_access_id on sec.access_key_role r_1 (cost=0.29..8.57 rows=2 width=8) (never executed)

  • Output: r_1.id, r_1.role_id, r_1.user_access_id, r_1.aud_who, r_1.aud_when, r_1.aud_source, r_1.aud_who_create, r_1.aud_when_create, r_1.aud_source_create
  • Index Cond: (r_1.user_access_id = ac_1.id)
14. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_permission_ref_role_id on sec.permission_ref p_2 (cost=0.42..7.46 rows=1 width=5) (never executed)

  • Output: p_2.id, p_2.section_id, p_2.element_id, p_2.permission_id, p_2.allowed, p_2.role_id, p_2.aud_who, p_2.aud_when, p_2.aud_source, p_2.aud_who_create, p_2.aud_when_create, p_2.aud_source_create, p_2.section_name, p_2.element_name, p_2.permission_name
  • Index Cond: (p_2.role_id = r_1.role_id)
  • Filter: (p_2.permission_id = 'ownUpdate'::text)
15. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.99..53.32 rows=1 width=1) (never executed)

  • Output: p_3.allowed
16. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.99..942.99 rows=18 width=1) (never executed)

  • Output: p_3.allowed
17. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.57..442.40 rows=67 width=4) (never executed)

  • Output: r_2.role_id
18. 0.000 0.000 ↓ 0.0 0

Index Scan using access_key_user_id_ix on sec.access_key ac_2 (cost=0.28..124.72 rows=37 width=4) (never executed)

  • Output: ac_2.id, ac_2.type_id, ac_2.org_id, ac_2.empl_pos_id, ac_2.user_id, ac_2.name, ac_2.is_blocked, ac_2.aud_who, ac_2.aud_when, ac_2.aud_source, ac_2.aud_who_create, ac_2.aud_when_create, ac_2.aud_source_create
  • Index Cond: (ac_2.user_id = 1)
19. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_user_access_role_user_access_id on sec.access_key_role r_2 (cost=0.29..8.57 rows=2 width=8) (never executed)

  • Output: r_2.id, r_2.role_id, r_2.user_access_id, r_2.aud_who, r_2.aud_when, r_2.aud_source, r_2.aud_who_create, r_2.aud_when_create, r_2.aud_source_create
  • Index Cond: (r_2.user_access_id = ac_2.id)
20. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_permission_ref_role_id on sec.permission_ref p_3 (cost=0.42..7.46 rows=1 width=5) (never executed)

  • Output: p_3.id, p_3.section_id, p_3.element_id, p_3.permission_id, p_3.allowed, p_3.role_id, p_3.aud_who, p_3.aud_when, p_3.aud_source, p_3.aud_who_create, p_3.aud_when_create, p_3.aud_source_create, p_3.section_name, p_3.element_name, p_3.permission_name
  • Index Cond: (p_3.role_id = r_2.role_id)
  • Filter: (p_3.permission_id = 'ownUpdate'::text)
21. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.99..53.32 rows=1 width=1) (never executed)

  • Output: p_4.allowed
22. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.99..942.99 rows=18 width=1) (never executed)

  • Output: p_4.allowed
23. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.57..442.40 rows=67 width=4) (never executed)

  • Output: r_3.role_id
24. 0.000 0.000 ↓ 0.0 0

Index Scan using access_key_user_id_ix on sec.access_key ac_3 (cost=0.28..124.72 rows=37 width=4) (never executed)

  • Output: ac_3.id, ac_3.type_id, ac_3.org_id, ac_3.empl_pos_id, ac_3.user_id, ac_3.name, ac_3.is_blocked, ac_3.aud_who, ac_3.aud_when, ac_3.aud_source, ac_3.aud_who_create, ac_3.aud_when_create, ac_3.aud_source_create
  • Index Cond: (ac_3.user_id = 1)
25. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_user_access_role_user_access_id on sec.access_key_role r_3 (cost=0.29..8.57 rows=2 width=8) (never executed)

  • Output: r_3.id, r_3.role_id, r_3.user_access_id, r_3.aud_who, r_3.aud_when, r_3.aud_source, r_3.aud_who_create, r_3.aud_when_create, r_3.aud_source_create
  • Index Cond: (r_3.user_access_id = ac_3.id)
26. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_permission_ref_role_id on sec.permission_ref p_4 (cost=0.42..7.46 rows=1 width=5) (never executed)

  • Output: p_4.id, p_4.section_id, p_4.element_id, p_4.permission_id, p_4.allowed, p_4.role_id, p_4.aud_who, p_4.aud_when, p_4.aud_source, p_4.aud_who_create, p_4.aud_when_create, p_4.aud_source_create, p_4.section_name, p_4.element_name, p_4.permission_name
  • Index Cond: (p_4.role_id = r_3.role_id)
  • Filter: (p_4.permission_id = 'ownUpdate'::text)
27. 0.000 0.000 ↓ 0.0 0

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

  • Output: md_age_group.from_dt
  • Filter: (md_age_group.id = 1)
28. 0.000 0.000 ↓ 0.0 0

Seq Scan on public.md_age_group md_age_group_1 (cost=0.00..1.07 rows=1 width=4) (never executed)

  • Output: md_age_group_1.to_dt
  • Filter: (md_age_group_1.id = 1)
29. 0.041 43,773.980 ↓ 0.0 0 1

Sort (cost=5,525.82..5,525.82 rows=1 width=276) (actual time=43,773.980..43,773.980 rows=0 loops=1)

  • Output: mc.id, c.id, mc.uid, mc.open_date, mc.close_date, laststepdep.id, mcd.diagnos_id, rend.id, (concat_ws(' '::text, diag.code, diag.name)), mct.id, mct.name, ((alternatives: SubPlan 1 or hashed SubPlan 2)), ((alternatives: SubPlan 3 or hashed SubPlan 4)), ((alternatives: SubPlan 5 or hashed SubPlan 6)), i.id, (concat(((i.surname)::text || ' '::text), ("substring"((i.name)::text, 1, 1) || '.'::text), ("substring"((i.patr_name)::text, 1, 1) || '.'::text))), (date_part('year'::text, age(now(), (i.birth_dt)::timestamp with time zone))), ((SubPlan 7)), ((SubPlan 8)), ((SubPlan 9)), ((SubPlan 10)), ((SubPlan 11)), ((SubPlan 12)), (1), (CASE WHEN (NOT $15) THEN true ELSE false END), (CASE WHEN ($18 AND ((SubPlan 15) = 1)) THEN true ELSE false END), (CASE WHEN (((SubPlan 16) = 1) AND $23) THEN true ELSE false END), (CASE WHEN (((SubPlan 18) = 1) AND $27) THEN true ELSE false END)
  • Sort Key: mc.close_date DESC, (concat(((i.surname)::text || ' '::text), ("substring"((i.name)::text, 1, 1) || '.'::text), ("substring"((i.patr_name)::text, 1, 1) || '.'::text)))
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=54378 read=18803 dirtied=1
  • I/O Timings: read=43288.367
30. 0.002 43,773.939 ↓ 0.0 0 1

Nested Loop Semi Join (cost=63.22..5,525.81 rows=1 width=276) (actual time=43,773.939..43,773.939 rows=0 loops=1)

  • Output: mc.id, c.id, mc.uid, mc.open_date, mc.close_date, laststepdep.id, mcd.diagnos_id, rend.id, concat_ws(' '::text, diag.code, diag.name), mct.id, mct.name, (alternatives: SubPlan 1 or hashed SubPlan 2), (alternatives: SubPlan 3 or hashed SubPlan 4), (alternatives: SubPlan 5 or hashed SubPlan 6), i.id, concat(((i.surname)::text || ' '::text), ("substring"((i.name)::text, 1, 1) || '.'::text), ("substring"((i.patr_name)::text, 1, 1) || '.'::text)), date_part('year'::text, age(now(), (i.birth_dt)::timestamp with time zone)), (SubPlan 7), (SubPlan 8), (SubPlan 9), (SubPlan 10), (SubPlan 11), (SubPlan 12), 1, CASE WHEN (NOT $15) THEN true ELSE false END, CASE WHEN ($18 AND ((SubPlan 15) = 1)) THEN true ELSE false END, CASE WHEN (((SubPlan 16) = 1) AND $23) THEN true ELSE false END, CASE WHEN (((SubPlan 18) = 1) AND $27) THEN true ELSE false END
  • Buffers: shared hit=54378 read=18803 dirtied=1
  • I/O Timings: read=43288.367
31. 0.000 43,773.937 ↓ 0.0 0 1

Nested Loop Semi Join (cost=59.24..3,212.17 rows=1 width=280) (actual time=43,773.937..43,773.937 rows=0 loops=1)

  • Output: mc.id, mc.uid, mc.open_date, mc.close_date, i.id, i.surname, i.name, i.patr_name, i.birth_dt, mct.id, mct.name, laststep.result_id, rend.id, laststepdep.id, mcd.diagnos_id, diag.code, diag.name, c.id, c.case_id
  • Join Filter: ((c1.close_date < mc.open_date) AND (date_part('month'::text, age((mc.open_date)::timestamp with time zone, (c1.close_date)::timestamp with time zone)) < '12'::double precision) AND (date_part('years'::text, age((mc.open_date)::timestamp with time zone, (c1.close_date)::timestamp with time zone)) = '0'::double precision))
  • Buffers: shared hit=54378 read=18803 dirtied=1
  • I/O Timings: read=43288.367
32. 0.001 43,773.937 ↓ 0.0 0 1

Nested Loop (cost=58.24..2,792.65 rows=1 width=296) (actual time=43,773.937..43,773.937 rows=0 loops=1)

  • Output: mc.id, mc.uid, mc.open_date, mc.close_date, mc.patient_id, mc.case_type_id, p.id, i.id, i.surname, i.name, i.patr_name, i.birth_dt, mct.id, mct.name, laststep.result_id, rend.id, laststepdep.id, mcd.diagnos_id, diag.code, diag.name, diag.id, c.id, c.case_id
  • Join Filter: (mc.id = c.case_id)
  • Buffers: shared hit=54378 read=18803 dirtied=1
  • I/O Timings: read=43288.367
33. 0.001 43,773.936 ↓ 0.0 0 1

Nested Loop (cost=58.24..2,791.56 rows=1 width=288) (actual time=43,773.936..43,773.936 rows=0 loops=1)

  • Output: mc.id, mc.uid, mc.open_date, mc.close_date, mc.patient_id, mc.case_type_id, p.id, i.id, i.surname, i.name, i.patr_name, i.birth_dt, mct.id, mct.name, laststep.result_id, rend.id, laststepdep.id, mcd.diagnos_id, diag.code, diag.name, diag.id
  • Buffers: shared hit=54378 read=18803 dirtied=1
  • I/O Timings: read=43288.367
34. 0.001 43,773.935 ↓ 0.0 0 1

Nested Loop (cost=57.96..2,783.24 rows=1 width=162) (actual time=43,773.935..43,773.935 rows=0 loops=1)

  • Output: mc.id, mc.uid, mc.open_date, mc.close_date, mc.patient_id, mc.case_type_id, p.id, i.id, i.surname, i.name, i.patr_name, i.birth_dt, mct.id, mct.name, laststep.result_id, rend.id, laststepdep.id, mcd.diagnos_id
  • Buffers: shared hit=54378 read=18803 dirtied=1
  • I/O Timings: read=43288.367
35. 0.001 43,773.934 ↓ 0.0 0 1

Nested Loop (cost=57.39..2,774.65 rows=1 width=162) (actual time=43,773.934..43,773.934 rows=0 loops=1)

  • Output: mc.id, mc.uid, mc.open_date, mc.close_date, mc.patient_id, mc.case_type_id, mc.main_diagnos_id, p.id, i.id, i.surname, i.name, i.patr_name, i.birth_dt, mct.id, mct.name, laststep.result_id, rend.id, laststepdep.id
  • Join Filter: (((laststepdep.id = laststepresgroup.department_id) AND (mc.case_type_id = 1)) OR ((laststepdep.id = hr_1.department_id) AND (mc.case_type_id = 2)))
  • Buffers: shared hit=54378 read=18803 dirtied=1
  • I/O Timings: read=43288.367
36. 0.001 43,773.933 ↓ 0.0 0 1

Nested Loop Left Join (cost=57.11..2,770.33 rows=1 width=166) (actual time=43,773.933..43,773.933 rows=0 loops=1)

  • Output: mc.id, mc.uid, mc.open_date, mc.close_date, mc.patient_id, mc.case_type_id, mc.main_diagnos_id, hr_1.department_id, p.id, i.id, i.surname, i.name, i.patr_name, i.birth_dt, mct.id, mct.name, laststep.result_id, laststepresgroup.department_id, rend.id
  • Buffers: shared hit=54378 read=18803 dirtied=1
  • I/O Timings: read=43288.367
37. 0.000 43,773.932 ↓ 0.0 0 1

Nested Loop Left Join (cost=56.54..2,518.27 rows=1 width=166) (actual time=43,773.932..43,773.932 rows=0 loops=1)

  • Output: mc.id, mc.uid, mc.open_date, mc.close_date, mc.patient_id, mc.case_type_id, mc.main_diagnos_id, hr_1.department_id, p.id, i.id, i.surname, i.name, i.patr_name, i.birth_dt, mct.id, mct.name, laststep.result_id, laststepresgroup.id, laststepresgroup.department_id
  • Filter: (47856 = (SubPlan 22))
  • Buffers: shared hit=54378 read=18803 dirtied=1
  • I/O Timings: read=43288.367
38. 0.002 43,773.932 ↓ 0.0 0 1

Nested Loop (cost=55.97..2,471.45 rows=1 width=162) (actual time=43,773.932..43,773.932 rows=0 loops=1)

  • Output: mc.id, mc.uid, mc.open_date, mc.close_date, mc.patient_id, mc.case_type_id, mc.main_diagnos_id, hr_1.department_id, p.id, i.id, i.surname, i.name, i.patr_name, i.birth_dt, mct.id, mct.name, laststep.result_id, laststep.res_group_id
  • Join Filter: (((laststep.id = lastclinicstep.id) AND (mc.case_type_id = 1)) OR ((laststep.id = s.id) AND (mc.case_type_id = 2)))
  • Buffers: shared hit=54378 read=18803 dirtied=1
  • I/O Timings: read=43288.367
39. 0.001 43,773.930 ↓ 0.0 0 1

Nested Loop (cost=2.59..604.37 rows=1 width=162) (actual time=43,773.930..43,773.930 rows=0 loops=1)

  • Output: mc.id, mc.uid, mc.open_date, mc.close_date, mc.patient_id, mc.case_type_id, mc.main_diagnos_id, hr_1.department_id, s.id, p.id, i.id, i.surname, i.name, i.patr_name, i.birth_dt, mct.id, mct.name, lastclinicstep.id
  • Buffers: shared hit=54378 read=18803 dirtied=1
  • I/O Timings: read=43288.367
40. 0.000 43,773.929 ↓ 0.0 0 1

Nested Loop (cost=2.16..595.91 rows=1 width=162) (actual time=43,773.929..43,773.929 rows=0 loops=1)

  • Output: mc.id, mc.uid, mc.open_date, mc.close_date, mc.patient_id, mc.case_type_id, mc.closing_step_id, mc.main_diagnos_id, hr_1.department_id, s.id, p.id, i.id, i.surname, i.name, i.patr_name, i.birth_dt, mct.id, mct.name
  • Buffers: shared hit=54378 read=18803 dirtied=1
  • I/O Timings: read=43288.367
41. 0.002 43,773.929 ↓ 0.0 0 1

Nested Loop (cost=2.16..594.81 rows=1 width=103) (actual time=43,773.929..43,773.929 rows=0 loops=1)

  • Output: mc.id, mc.uid, mc.open_date, mc.close_date, mc.patient_id, mc.case_type_id, mc.closing_step_id, mc.main_diagnos_id, hr_1.department_id, s.id, p.id, i.id, i.surname, i.name, i.patr_name, i.birth_dt
  • Buffers: shared hit=54378 read=18803 dirtied=1
  • I/O Timings: read=43288.367
42. 0.001 43,773.927 ↓ 0.0 0 1

Nested Loop (cost=1.73..587.00 rows=1 width=46) (actual time=43,773.927..43,773.927 rows=0 loops=1)

  • Output: mc.id, mc.uid, mc.open_date, mc.close_date, mc.patient_id, mc.case_type_id, mc.closing_step_id, mc.main_diagnos_id, hr_1.department_id, s.id, p.id
  • Buffers: shared hit=54378 read=18803 dirtied=1
  • I/O Timings: read=43288.367
43. 0.052 43,773.926 ↓ 0.0 0 1

Nested Loop Left Join (cost=1.30..578.55 rows=1 width=42) (actual time=43,773.926..43,773.926 rows=0 loops=1)

  • Output: mc.id, mc.uid, mc.open_date, mc.close_date, mc.patient_id, mc.case_type_id, mc.closing_step_id, mc.main_diagnos_id, hr_1.department_id, s.id
  • Join Filter: (mc.case_type_id = 2)
  • Filter: ((((mc.case_type_id = 2) AND ((SubPlan 25) <> (SubPlan 26))) OR ((mc.case_type_id = 1) AND ((SubPlan 27) <> (SubPlan 28)))) AND (((mc.case_type_id = 2) AND ((SubPlan 34) <> (SubPlan 35))) OR ((mc.case_type_id = 1) AND ((SubPlan 36) <> (SubPlan 37)))) AND (((mc.case_type_id = 2) AND ((SubPlan 30) <> (SubPlan 31))) OR ((mc.case_type_id = 1) AND ((SubPlan 32) <> (SubPlan 33)))))
  • Rows Removed by Filter: 1
  • Buffers: shared hit=54378 read=18803 dirtied=1
  • I/O Timings: read=43288.367
44. 43,708.145 43,708.145 ↑ 1.0 1 1

Index Scan using mc_case_close_date_idx on public.mc_case mc (cost=0.44..8.47 rows=1 width=34) (actual time=11,841.841..43,708.145 rows=1 loops=1)

  • Output: mc.id, mc.uid, mc.open_date, mc.close_date, mc.patient_id, mc.case_type_id, mc.closing_step_id, mc.main_diagnos_id
  • Index Cond: ((mc.close_date IS NOT NULL) AND (mc.close_date >= '2020-02-19'::date) AND (mc.close_date <= '2020-03-20'::date))
  • Filter: ((mc.case_type_id = ANY ('{1,2}'::integer[])) AND (mc.open_date <= '2020-03-20'::date) AND (mc.case_type_id = 2) AND (mc.repeat_count_id = 2) AND (mc.clinic_id = 1602743))
  • Rows Removed by Filter: 75683
  • Buffers: shared hit=54337 read=18796 dirtied=1
  • I/O Timings: read=43223.120
45. 0.026 10.377 ↑ 1.0 1 1

Nested Loop (cost=0.86..382.14 rows=1 width=12) (actual time=10.332..10.377 rows=1 loops=1)

  • Output: hr_1.department_id, s.id, s.case_id
  • Buffers: shared hit=37 read=1
  • I/O Timings: read=10.047
46. 10.141 10.141 ↑ 5.0 3 1

Index Scan using idx_mc_step on public.mc_step s (cost=0.44..11.58 rows=15 width=8) (actual time=10.127..10.141 rows=3 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.gestational_age, s.onko_stage, s.hsp_bed_profile_id, s.is_first_step
  • Index Cond: (s.case_id = mc.id)
  • Buffers: shared hit=5 read=1
  • I/O Timings: read=10.047
47. 0.066 0.210 ↓ 0.0 0 3

Index Scan using hsp_record_pk on public.hsp_record hr_1 (cost=0.42..24.69 rows=1 width=8) (actual time=0.070..0.070 rows=0 loops=3)

  • Output: hr_1.id, hr_1.is_admission_day_counts, hr_1.old_is_continue, hr_1.department_id, hr_1.funding_id, hr_1.mes_id, hr_1.previous_id, hr_1.is_set_diagnosis, hr_1.old_is_continue_edit, hr_1.is_diag_not_eq, hr_1.days_comp_algo_id, hr_1.missed_days_amount, hr_1.bed_days_amount, hr_1.issue_planned_date, hr_1.complexity_level_id, hr_1.bed_profile_id, hr_1.aud_who, hr_1.aud_when, hr_1.aud_source, hr_1.aud_who_create, hr_1.aud_when_create, hr_1.aud_source_create, hr_1.refusal_employee_id, hr_1.is_finance_type_control, hr_1.house_call_id, hr_1.action_allowed_result_id
  • Index Cond: (hr_1.id = s.id)
  • Filter: (NOT (SubPlan 20))
  • Rows Removed by Filter: 1
  • Buffers: shared hit=32
48.          

SubPlan (for Index Scan)

49. 0.023 0.144 ↑ 1.0 1 3

Nested Loop (cost=0.86..16.91 rows=1 width=0) (actual time=0.048..0.048 rows=1 loops=3)

  • Buffers: shared hit=20
50. 0.033 0.033 ↑ 1.0 1 3

Index Scan using hsp_record_previous_id_idx on public.hsp_record h2 (cost=0.42..8.44 rows=1 width=4) (actual time=0.011..0.011 rows=1 loops=3)

  • 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_1.id)
  • Buffers: shared hit=11
51. 0.088 0.088 ↑ 1.0 1 2

Index Only Scan using mc_step_pk on public.mc_step s2 (cost=0.44..8.46 rows=1 width=4) (actual time=0.044..0.044 rows=1 loops=2)

  • Output: s2.id
  • Index Cond: (s2.id = h2.id)
  • Heap Fetches: 2
  • Buffers: shared hit=9
52.          

SubPlan (for Nested Loop Left Join)

53. 0.005 39.453 ↑ 1.0 1 1

Limit (cost=0.56..1.30 rows=1 width=4) (actual time=39.452..39.453 rows=1 loops=1)

  • Output: mc_diagnosis.diagnos_id
  • Buffers: shared hit=2 read=3
  • I/O Timings: read=39.371
54. 39.448 39.448 ↑ 15.0 1 1

Index Scan using mc_diagnosis_case_id_idx on public.mc_diagnosis (cost=0.56..11.56 rows=15 width=4) (actual time=39.448..39.448 rows=1 loops=1)

  • Output: mc_diagnosis.diagnos_id
  • Index Cond: (mc_diagnosis.case_id = mc.id)
  • Filter: (mc_diagnosis.is_main AND (mc_diagnosis.stage_id = 4))
  • Buffers: shared hit=2 read=3
  • I/O Timings: read=39.371
55. 0.006 15.899 ↑ 1.0 1 1

Limit (cost=0.56..0.81 rows=1 width=4) (actual time=15.898..15.899 rows=1 loops=1)

  • Output: mc_diagnosis_1.diagnos_id
  • Buffers: shared hit=2 read=3
  • I/O Timings: read=15.829
56. 15.893 15.893 ↑ 330.0 1 1

Index Scan using mc_diagnosis_step_id_idx on public.mc_diagnosis mc_diagnosis_1 (cost=0.56..82.02 rows=330 width=4) (actual time=15.893..15.893 rows=1 loops=1)

  • Output: mc_diagnosis_1.diagnos_id
  • Index Cond: (mc_diagnosis_1.step_id = s.id)
  • Filter: (mc_diagnosis_1.is_main AND (mc_diagnosis_1.stage_id = 3))
  • Buffers: shared hit=2 read=3
  • I/O Timings: read=15.829
57. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.56..1.30 rows=1 width=4) (never executed)

  • Output: mc_diagnosis_2.diagnos_id
58. 0.000 0.000 ↓ 0.0 0

Index Scan using mc_diagnosis_case_id_idx on public.mc_diagnosis mc_diagnosis_2 (cost=0.56..11.56 rows=15 width=4) (never executed)

  • Output: mc_diagnosis_2.diagnos_id
  • Index Cond: (mc_diagnosis_2.case_id = mc.id)
  • Filter: (mc_diagnosis_2.is_main AND (mc_diagnosis_2.stage_id = 4))
59. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.56..1.14 rows=1 width=4) (never executed)

  • Output: mc_diagnosis_3.diagnos_id
60. 0.000 0.000 ↓ 0.0 0

Index Scan using mc_diagnosis_case_id_idx on public.mc_diagnosis mc_diagnosis_3 (cost=0.56..11.56 rows=19 width=4) (never executed)

  • Output: mc_diagnosis_3.diagnos_id
  • Index Cond: (mc_diagnosis_3.case_id = mc.id)
  • Filter: (mc_diagnosis_3.is_main AND (mc_diagnosis_3.stage_id = 3))
61. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.56..11.56 rows=1 width=4) (never executed)

  • Output: mc_diagnosis_8.diagnos_id
62. 0.000 0.000 ↓ 0.0 0

Index Scan using mc_diagnosis_case_id_idx on public.mc_diagnosis mc_diagnosis_8 (cost=0.56..11.56 rows=1 width=4) (never executed)

  • Output: mc_diagnosis_8.diagnos_id
  • Index Cond: (mc_diagnosis_8.case_id = mc.id)
  • Filter: (mc_diagnosis_8.is_main AND (mc_diagnosis_8.stage_id = 5))
63. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.56..0.81 rows=1 width=4) (never executed)

  • Output: mc_diagnosis_9.diagnos_id
64. 0.000 0.000 ↓ 0.0 0

Index Scan using mc_diagnosis_step_id_idx on public.mc_diagnosis mc_diagnosis_9 (cost=0.56..82.02 rows=330 width=4) (never executed)

  • Output: mc_diagnosis_9.diagnos_id
  • Index Cond: (mc_diagnosis_9.step_id = s.id)
  • Filter: (mc_diagnosis_9.is_main AND (mc_diagnosis_9.stage_id = 3))
65. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.56..11.56 rows=1 width=4) (never executed)

  • Output: mc_diagnosis_10.diagnos_id
66. 0.000 0.000 ↓ 0.0 0

Index Scan using mc_diagnosis_case_id_idx on public.mc_diagnosis mc_diagnosis_10 (cost=0.56..11.56 rows=1 width=4) (never executed)

  • Output: mc_diagnosis_10.diagnos_id
  • Index Cond: (mc_diagnosis_10.case_id = mc.id)
  • Filter: (mc_diagnosis_10.is_main AND (mc_diagnosis_10.stage_id = 5))
67. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.56..1.14 rows=1 width=4) (never executed)

  • Output: mc_diagnosis_11.diagnos_id
68. 0.000 0.000 ↓ 0.0 0

Index Scan using mc_diagnosis_case_id_idx on public.mc_diagnosis mc_diagnosis_11 (cost=0.56..11.56 rows=19 width=4) (never executed)

  • Output: mc_diagnosis_11.diagnos_id
  • Index Cond: (mc_diagnosis_11.case_id = mc.id)
  • Filter: (mc_diagnosis_11.is_main AND (mc_diagnosis_11.stage_id = 3))
69. 0.000 0.000 ↓ 0.0 0

Limit (cost=138.93..144.75 rows=1 width=4) (never executed)

  • Output: mc_diagnosis_4.diagnos_id
70.          

Initplan (for Limit)

71. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.86..138.37 rows=1 width=4) (never executed)

  • Output: s1.id
72. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.86..138.37 rows=1 width=4) (never executed)

  • Output: s1.id
73. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_mc_step on public.mc_step s1 (cost=0.44..11.58 rows=15 width=4) (never executed)

  • Output: s1.id, s1.admission_date, s1.admission_time, s1.death_date, s1.death_time, s1.outcome_date, s1.outcome_time, s1.death_employee_id, s1.main_diagnosis_id, s1.case_id, s1.outcome_id, s1.outcome_clinic_id, s1.outcome_regimen_id, s1.regimen_id, s1.res_group_id, s1.result_id, s1.reason_id, s1.profile_id, s1.mes_id, s1.mes_quality_criterion_id, s1.is_continue, s1.is_continue_editable, s1.standard_id, s1.csg_id, s1.vmp_type_id, s1.vmp_method_id, s1.deviation_reason_id, s1.aud_who, s1.aud_when, s1.aud_source, s1.aud_who_create, s1.aud_when_create, s1.aud_source_create, s1._clinic_id, s1._patient_id, s1.planned_date_closing_case, s1.gestational_age, s1.onko_stage, s1.hsp_bed_profile_id, s1.is_first_step
  • Index Cond: (s1.case_id = mc.id)
74. 0.000 0.000 ↓ 0.0 0

Index Scan using hsp_record_pk on public.hsp_record hr1 (cost=0.42..8.44 rows=1 width=4) (never executed)

  • Output: hr1.id, hr1.is_admission_day_counts, hr1.old_is_continue, hr1.department_id, hr1.funding_id, hr1.mes_id, hr1.previous_id, hr1.is_set_diagnosis, hr1.old_is_continue_edit, hr1.is_diag_not_eq, hr1.days_comp_algo_id, hr1.missed_days_amount, hr1.bed_days_amount, hr1.issue_planned_date, hr1.complexity_level_id, hr1.bed_profile_id, hr1.aud_who, hr1.aud_when, hr1.aud_source, hr1.aud_who_create, hr1.aud_when_create, hr1.aud_source_create, hr1.refusal_employee_id, hr1.is_finance_type_control, hr1.house_call_id, hr1.action_allowed_result_id
  • Index Cond: (hr1.id = s1.id)
  • Filter: (hr1.previous_id IS NULL)
75. 0.000 0.000 ↓ 0.0 0

Index Scan using mc_diagnosis_step_id_idx on public.mc_diagnosis mc_diagnosis_4 (cost=0.56..82.02 rows=14 width=4) (never executed)

  • Output: mc_diagnosis_4.diagnos_id
  • Index Cond: (mc_diagnosis_4.step_id = $42)
  • Filter: (mc_diagnosis_4.is_main AND (mc_diagnosis_4.stage_id = 2))
76. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.56..0.81 rows=1 width=4) (never executed)

  • Output: mc_diagnosis_5.diagnos_id
77. 0.000 0.000 ↓ 0.0 0

Index Scan using mc_diagnosis_step_id_idx on public.mc_diagnosis mc_diagnosis_5 (cost=0.56..82.02 rows=330 width=4) (never executed)

  • Output: mc_diagnosis_5.diagnos_id
  • Index Cond: (mc_diagnosis_5.step_id = s.id)
  • Filter: (mc_diagnosis_5.is_main AND (mc_diagnosis_5.stage_id = 3))
78. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.56..11.56 rows=1 width=4) (never executed)

  • Output: mc_diagnosis_6.diagnos_id
79. 0.000 0.000 ↓ 0.0 0

Index Scan using mc_diagnosis_case_id_idx on public.mc_diagnosis mc_diagnosis_6 (cost=0.56..11.56 rows=1 width=4) (never executed)

  • Output: mc_diagnosis_6.diagnos_id
  • Index Cond: (mc_diagnosis_6.case_id = mc.id)
  • Filter: (mc_diagnosis_6.is_main AND (mc_diagnosis_6.stage_id = 2))
80. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.56..1.14 rows=1 width=4) (never executed)

  • Output: mc_diagnosis_7.diagnos_id
81. 0.000 0.000 ↓ 0.0 0

Index Scan using mc_diagnosis_case_id_idx on public.mc_diagnosis mc_diagnosis_7 (cost=0.56..11.56 rows=19 width=4) (never executed)

  • Output: mc_diagnosis_7.diagnos_id
  • Index Cond: (mc_diagnosis_7.case_id = mc.id)
  • Filter: (mc_diagnosis_7.is_main AND (mc_diagnosis_7.stage_id = 3))
82. 0.000 0.000 ↓ 0.0 0

Index Only Scan using pci_patient_pk on public.pci_patient p (cost=0.43..8.45 rows=1 width=4) (never executed)

  • Output: p.id
  • Index Cond: (p.id = mc.patient_id)
  • Heap Fetches: 0
83. 0.000 0.000 ↓ 0.0 0

Index Scan using pim_individual_pk on public.pim_individual i (cost=0.43..7.80 rows=1 width=57) (never executed)

  • Output: i.id, i.birth_dt, i.death_dt, i.has_citizenship, i.name, i.patr_name, i.surname, i.gender_id, i.nationality_id, i.list_identity_doc, i.list_oms_doc, i.list_job_org, i.list_reg_name, i.list_snils, i.list_uid, i.aud_who, i.aud_when, i.aud_source, i.aud_who_create, i.aud_when_create, i.aud_source_create, i.birth_place, i.age_year, i.age_month, i.age_day, i.list_main_contact, i.is_only_birth_year
  • Index Cond: (i.id = p.id)
  • Filter: ((i.birth_dt >= $34) AND (i.birth_dt <= $35))
84. 0.000 0.000 ↓ 0.0 0

Seq Scan on public.mc_case_type mct (cost=0.00..1.09 rows=1 width=59) (never executed)

  • Output: mct.id, mct.case_mode_id, mct.code, mct.name, mct.default_regimen_id, mct.e_code, mct.aud_who, mct.aud_when, mct.aud_source, mct.aud_who_create, mct.aud_when_create, mct.aud_source_create, mct.from_dt, mct.to_dt, mct.billing_code
  • Filter: ((mct.id = 2) AND ((mct.name)::text = 'Случай госпитализации'::text))
85. 0.000 0.000 ↓ 0.0 0

Index Only Scan using mc_step_pk on public.mc_step lastclinicstep (cost=0.44..8.46 rows=1 width=4) (never executed)

  • Output: lastclinicstep.id
  • Index Cond: (lastclinicstep.id = mc.closing_step_id)
  • Heap Fetches: 0
86. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on public.mc_step laststep (cost=53.38..61.40 rows=90,284 width=20) (never executed)

  • Output: laststep.id, laststep.admission_date, laststep.admission_time, laststep.death_date, laststep.death_time, laststep.outcome_date, laststep.outcome_time, laststep.death_employee_id, laststep.main_diagnosis_id, laststep.case_id, laststep.outcome_id, laststep.outcome_clinic_id, laststep.outcome_regimen_id, laststep.regimen_id, laststep.res_group_id, laststep.result_id, laststep.reason_id, laststep.profile_id, laststep.mes_id, laststep.mes_quality_criterion_id, laststep.is_continue, laststep.is_continue_editable, laststep.standard_id, laststep.csg_id, laststep.vmp_type_id, laststep.vmp_method_id, laststep.deviation_reason_id, laststep.aud_who, laststep.aud_when, laststep.aud_source, laststep.aud_who_create, laststep.aud_when_create, laststep.aud_source_create, laststep._clinic_id, laststep._patient_id, laststep.planned_date_closing_case, laststep.gestational_age, laststep.onko_stage, laststep.hsp_bed_profile_id, laststep.is_first_step
  • Recheck Cond: ((laststep.id = lastclinicstep.id) OR (laststep.id = s.id))
  • Filter: ((laststep.result_id = 63) OR (laststep.result_id = 13))
87. 0.000 0.000 ↓ 0.0 0

BitmapOr (cost=53.38..53.38 rows=2 width=0) (never executed)

88. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on mc_step_pk (cost=0.00..4.12 rows=1 width=0) (never executed)

  • Index Cond: (laststep.id = lastclinicstep.id)
89. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on mc_step_pk (cost=0.00..4.12 rows=1 width=0) (never executed)

  • Index Cond: (laststep.id = s.id)
90. 0.000 0.000 ↓ 0.0 0

Index Scan using sr_res_group_pk on public.sr_res_group laststepresgroup (cost=0.57..8.20 rows=1 width=8) (never executed)

  • Output: laststepresgroup.id, laststepresgroup.bdate, laststepresgroup.edate, laststepresgroup.is_system, laststepresgroup.name, laststepresgroup.department_id, laststepresgroup.org_id, laststepresgroup.responsible_id, laststepresgroup.is_available_in_electronic_queue, laststepresgroup.label_id, laststepresgroup.ignore_regclinic_check, laststepresgroup.note, laststepresgroup.blocked, laststepresgroup.block_comment, laststepresgroup.template_res_group_id, laststepresgroup.aud_who, laststepresgroup.aud_when, laststepresgroup.aud_source, laststepresgroup.aud_who_create, laststepresgroup.aud_when_create, laststepresgroup.aud_source_create, laststepresgroup.emergency, laststepresgroup.ignore_districts, laststepresgroup.service_template_id
  • Index Cond: (laststepresgroup.id = laststep.res_group_id)
91.          

SubPlan (for Nested Loop Left Join)

92. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=30.44..38.60 rows=1 width=4) (never executed)

  • Output: epr.id
93. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=30.15..38.27 rows=1 width=4) (never executed)

  • Output: srr.id
94. 0.000 0.000 ↓ 0.0 0

Unique (cost=29.86..29.94 rows=1 width=12) (never executed)

  • Output: sr_res_group_relationship.group_id, sr_res_group_relationship.resource_id, sr_res_group_relationship.id
95.          

Initplan (for Unique)

96. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.00..1.35 rows=1 width=4) (never executed)

  • Output: sr_res_role.id
97. 0.000 0.000 ↓ 0.0 0

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

  • Output: sr_res_role.id
  • Filter: ((sr_res_role.code)::text = 'DOCTOR'::text)
98. 0.000 0.000 ↓ 0.0 0

Sort (cost=28.51..28.55 rows=16 width=12) (never executed)

  • Output: sr_res_group_relationship.group_id, sr_res_group_relationship.resource_id, sr_res_group_relationship.id
  • Sort Key: sr_res_group_relationship.id
99. 0.000 0.000 ↓ 0.0 0

Index Scan using sr_res_group_relationship__group_id_ix on public.sr_res_group_relationship (cost=0.57..28.19 rows=16 width=12) (never executed)

  • Output: sr_res_group_relationship.group_id, sr_res_group_relationship.resource_id, sr_res_group_relationship.id
  • Index Cond: (sr_res_group_relationship.group_id = laststepresgroup.id)
  • Filter: (sr_res_group_relationship.role_id = $31)
100. 0.000 0.000 ↓ 0.0 0

Index Only Scan using sr_resource_pk on public.sr_resource srr (cost=0.29..8.31 rows=1 width=4) (never executed)

  • Output: srr.id
  • Index Cond: (srr.id = sr_res_group_relationship.resource_id)
  • Heap Fetches: 0
101. 0.000 0.000 ↓ 0.0 0

Index Only Scan using pim_employee_position_resource_unq on public.pim_employee_position_resource epr (cost=0.29..0.32 rows=1 width=4) (never executed)

  • Output: epr.id, epr.employee_position_id
  • Index Cond: (epr.id = srr.id)
  • Heap Fetches: 0
102. 0.000 0.000 ↓ 0.0 0

Index Scan using sr_srv_rendered_res_group_id_idx on public.sr_srv_rendered rend (cost=0.57..249.46 rows=260 width=8) (never executed)

  • Output: rend.id, rend.bdate, rend.comment, rend.cost, rend.duration, rend.edate, rend.is_rendered, rend.quantity, rend.total_cost, rend.contract_id, rend.customer_id, rend.funding_id, rend.res_group_id, rend.service_id, rend.duration_measure_unit_id, rend.begin_time, rend.prototype_id, rend.org_id, rend.price_list_id, rend.cul, rend.parent_id, rend.payment_status_id, rend.root_service_id, rend.is_wholly_rendered, rend.planned_date, rend.planned_time, rend.tooth_number, rend.is_refused, rend.aud_who, rend.aud_when, rend.aud_source, rend.aud_who_create, rend.aud_when_create, rend.aud_source_create, rend.is_amalgam_filling, rend.is_mobile_medical_teams, rend.close_date, rend.complex_srv_id, rend.for_upload, rend.uid, rend.is_need_consulting, rend.main_complex
  • Index Cond: (rend.res_group_id = laststepresgroup.id)
103. 0.000 0.000 ↓ 0.0 0

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

  • Output: laststepdep.id
  • Index Cond: (laststepdep.id = 5996)
  • Heap Fetches: 0
104. 0.000 0.000 ↓ 0.0 0

Index Scan using mc_diagnosis_pk on public.mc_diagnosis mcd (cost=0.56..8.58 rows=1 width=8) (never executed)

  • Output: mcd.diagnos_id, mcd.id
  • Index Cond: (mcd.id = mc.main_diagnos_id)
  • Filter: (mcd.diagnos_id = 19386)
105. 0.000 0.000 ↓ 0.0 0

Index Scan using md_diagnosis_pk on public.md_diagnosis diag (cost=0.29..8.31 rows=1 width=126) (never executed)

  • Output: diag.id, diag.code, diag.name, diag.parent_id, diag.is_injury, diag.level, diag.is_leaf, diag.e_code, diag.oms, diag.stomat, diag.aud_who, diag.aud_when, diag.aud_source, diag.aud_who_create, diag.aud_when_create, diag.aud_source_create, diag.from_dt, diag.to_dt
  • Index Cond: (diag.id = 19386)
  • Filter: (concat_ws(' '::text, diag.code, diag.name) = 'R46.1 Причудливый внешний вид'::text)
106. 0.000 0.000 ↓ 0.0 0

Seq Scan on supp.__ff_int_exam_case c (cost=0.00..1.04 rows=4 width=8) (never executed)

  • Output: c.id, c.case_id, c.group_id, c.level_id, c.expert_id
107. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.00..210.25 rows=1 width=16) (never executed)

  • Output: c1.case_type_id, c1.patient_id, c1.close_date, mcd1.diagnos_id
108. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_mc_case on public.mc_case c1 (cost=0.44..202.28 rows=1 width=16) (never executed)

  • Output: c1.main_diagnos_id, c1.case_type_id, c1.patient_id, c1.close_date
  • Index Cond: (c1.patient_id = p.id)
  • Filter: (c1.case_type_id = 2)
109. 0.000 0.000 ↓ 0.0 0

Index Scan using mc_diagnosis_pk on public.mc_diagnosis mcd1 (cost=0.56..7.96 rows=1 width=8) (never executed)

  • Output: mcd1.id, mcd1.diagnos_id
  • Index Cond: (mcd1.id = c1.main_diagnos_id)
  • Filter: (mcd1.diagnos_id = 19386)
110. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=3.97..349.78 rows=16 width=4) (never executed)

  • Output: step.case_id
  • Join Filter: (diag_1.diagnos_id <> nextdiag.diagnos_id)
111. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=3.41..242.20 rows=1 width=12) (never executed)

  • Output: step.case_id, diag_1.diagnos_id, nexthr.id
  • Join Filter: (step.id = nexthr.previous_id)
112. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=2.98..234.40 rows=1 width=24) (never executed)

  • Output: msr.step_id, step.id, step.case_id, hr.id, diag_1.step_id, diag_1.diagnos_id
113. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=2.42..127.37 rows=1 width=16) (never executed)

  • Output: msr.step_id, step.id, step.case_id, hr.id
  • Join Filter: (sr.type_id = sst.id)
114. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=2.42..126.09 rows=1 width=20) (never executed)

  • Output: msr.step_id, step.id, step.case_id, hr.id, sr.type_id
115. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=2.00..118.30 rows=1 width=20) (never executed)

  • Output: msr.step_id, step.id, step.case_id, hr.id, ssr.service_id
116. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.43..110.35 rows=1 width=20) (never executed)

  • Output: msr.step_id, msr.id, step.id, step.case_id, hr.id
117. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.00..106.17 rows=1 width=16) (never executed)

  • Output: msr.step_id, msr.id, step.id, step.case_id
118. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_mc_step on public.mc_step step (cost=0.44..11.62 rows=1 width=8) (never executed)

  • Output: step.id, step.admission_date, step.admission_time, step.death_date, step.death_time, step.outcome_date, step.outcome_time, step.death_employee_id, step.main_diagnosis_id, step.case_id, step.outcome_id, step.outcome_clinic_id, step.outcome_regimen_id, step.regimen_id, step.res_group_id, step.result_id, step.reason_id, step.profile_id, step.mes_id, step.mes_quality_criterion_id, step.is_continue, step.is_continue_editable, step.standard_id, step.csg_id, step.vmp_type_id, step.vmp_method_id, step.deviation_reason_id, step.aud_who, step.aud_when, step.aud_source, step.aud_who_create, step.aud_when_create, step.aud_source_create, step._clinic_id, step._patient_id, step.planned_date_closing_case, step.gestational_age, step.onko_stage, step.hsp_bed_profile_id, step.is_first_step
  • Index Cond: (step.case_id = mc.id)
  • Filter: (step.result_id = 5)
119. 0.000 0.000 ↓ 0.0 0

Index Scan using md_srv_rendered_step_id_idx on public.md_srv_rendered msr (cost=0.57..85.48 rows=907 width=8) (never executed)

  • 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.step_id = step.id)
120. 0.000 0.000 ↓ 0.0 0

Index Only Scan using hsp_record_pk on public.hsp_record hr (cost=0.42..4.17 rows=1 width=4) (never executed)

  • Output: hr.id
  • Index Cond: (hr.id = step.id)
  • Heap Fetches: 0
121. 0.000 0.000 ↓ 0.0 0

Index Scan using sr_srv_rendered_pk on public.sr_srv_rendered ssr (cost=0.57..7.94 rows=1 width=8) (never executed)

  • Output: ssr.id, ssr.bdate, ssr.comment, ssr.cost, ssr.duration, ssr.edate, ssr.is_rendered, ssr.quantity, ssr.total_cost, ssr.contract_id, ssr.customer_id, ssr.funding_id, ssr.res_group_id, ssr.service_id, ssr.duration_measure_unit_id, ssr.begin_time, ssr.prototype_id, ssr.org_id, ssr.price_list_id, ssr.cul, ssr.parent_id, ssr.payment_status_id, ssr.root_service_id, ssr.is_wholly_rendered, ssr.planned_date, ssr.planned_time, ssr.tooth_number, ssr.is_refused, ssr.aud_who, ssr.aud_when, ssr.aud_source, ssr.aud_who_create, ssr.aud_when_create, ssr.aud_source_create, ssr.is_amalgam_filling, ssr.is_mobile_medical_teams, ssr.close_date, ssr.complex_srv_id, ssr.for_upload, ssr.uid, ssr.is_need_consulting, ssr.main_complex
  • Index Cond: (ssr.id = msr.id)
122. 0.000 0.000 ↓ 0.0 0

Index Scan using sr_service_pk on public.sr_service sr (cost=0.42..7.78 rows=1 width=8) (never executed)

  • Output: sr.id, sr.code, sr.cul, sr.is_death, sr.duration, sr.is_fictitious, sr.is_independent, sr.is_multuplicity, sr.name, sr.terms, sr.org_id, sr.category_id, sr.duration_unit_id, sr.prototype_id, sr.type_id, sr.from_dt, sr.to_dt, sr.is_repeated, sr.is_inherit_protocol, sr.is_expendable_materials, sr.is_actual_cul, sr.is_paraclinical, sr.is_complex, sr.accounting_id, sr.is_fact, sr.is_autocopy_diagnoses, sr.is_stomat, sr.srg_dif_type_id, sr.srg_opr_kind_id, sr.is_need_anatomic_zone, sr.aud_who, sr.aud_when, sr.aud_source, sr.aud_who_create, sr.aud_when_create, sr.aud_source_create, sr.is_filling, sr.is_extraction, sr.is_need_close_date, sr.is_vmp, sr.short_name
  • Index Cond: (sr.id = ssr.service_id)
123. 0.000 0.000 ↓ 0.0 0

Seq Scan on public.sr_srv_type sst (cost=0.00..1.25 rows=2 width=4) (never executed)

  • Output: sst.id, sst.code, sst.name, sst.priority, sst.e_code, sst.aud_who, sst.aud_when, sst.aud_source, sst.aud_who_create, sst.aud_when_create, sst.aud_source_create, sst.from_dt, sst.to_dt, sst.is_physical, sst.is_surgery, sst.app_code, sst.is_procedure, sst.is_require_evaluation, sst.billing_code
  • Filter: sst.is_surgery
124. 0.000 0.000 ↓ 0.0 0

Index Scan using mc_diagnosis_step_id_idx on public.mc_diagnosis diag_1 (cost=0.56..103.73 rows=330 width=8) (never executed)

  • Output: diag_1.step_id, diag_1.diagnos_id
  • Index Cond: (diag_1.step_id = step.id)
  • Filter: (diag_1.is_main AND (diag_1.stage_id = 3))
125. 0.000 0.000 ↓ 0.0 0

Index Scan using hsp_record_previous_id_idx on public.hsp_record nexthr (cost=0.42..7.79 rows=1 width=8) (never executed)

  • Output: nexthr.id, nexthr.is_admission_day_counts, nexthr.old_is_continue, nexthr.department_id, nexthr.funding_id, nexthr.mes_id, nexthr.previous_id, nexthr.is_set_diagnosis, nexthr.old_is_continue_edit, nexthr.is_diag_not_eq, nexthr.days_comp_algo_id, nexthr.missed_days_amount, nexthr.bed_days_amount, nexthr.issue_planned_date, nexthr.complexity_level_id, nexthr.bed_profile_id, nexthr.aud_who, nexthr.aud_when, nexthr.aud_source, nexthr.aud_who_create, nexthr.aud_when_create, nexthr.aud_source_create, nexthr.refusal_employee_id, nexthr.is_finance_type_control, nexthr.house_call_id, nexthr.action_allowed_result_id
  • Index Cond: (nexthr.previous_id = msr.step_id)
126. 0.000 0.000 ↓ 0.0 0

Index Scan using mc_diagnosis_step_id_idx on public.mc_diagnosis nextdiag (cost=0.56..103.45 rows=330 width=8) (never executed)

  • Output: nextdiag.step_id, nextdiag.diagnos_id
  • Index Cond: (nextdiag.step_id = nexthr.id)
  • Filter: (nextdiag.is_main AND (nextdiag.stage_id = 3))
127.          

SubPlan (for Nested Loop Semi Join)

128. 0.000 0.000 ↓ 0.0 0

Seq Scan on supp.__ff_int_exam_case (cost=0.00..1.06 rows=1 width=0) (never executed)

  • Filter: ((__ff_int_exam_case.level_id = 1) AND (__ff_int_exam_case.case_id = mc.id))
129. 0.000 0.000 ↓ 0.0 0

Seq Scan on supp.__ff_int_exam_case __ff_int_exam_case_1 (cost=0.00..1.05 rows=4 width=4) (never executed)

  • Output: __ff_int_exam_case_1.case_id
  • Filter: (__ff_int_exam_case_1.level_id = 1)
130. 0.000 0.000 ↓ 0.0 0

Seq Scan on supp.__ff_int_exam_case __ff_int_exam_case_2 (cost=0.00..1.06 rows=1 width=0) (never executed)

  • Filter: ((__ff_int_exam_case_2.level_id = 2) AND (__ff_int_exam_case_2.case_id = mc.id))
131. 0.000 0.000 ↓ 0.0 0

Seq Scan on supp.__ff_int_exam_case __ff_int_exam_case_3 (cost=0.00..1.05 rows=1 width=4) (never executed)

  • Output: __ff_int_exam_case_3.case_id
  • Filter: (__ff_int_exam_case_3.level_id = 2)
132. 0.000 0.000 ↓ 0.0 0

Seq Scan on supp.__ff_int_exam_case __ff_int_exam_case_4 (cost=0.00..1.06 rows=1 width=0) (never executed)

  • Filter: ((__ff_int_exam_case_4.level_id = 3) AND (__ff_int_exam_case_4.case_id = mc.id))
133. 0.000 0.000 ↓ 0.0 0

Seq Scan on supp.__ff_int_exam_case __ff_int_exam_case_5 (cost=0.00..1.05 rows=1 width=4) (never executed)

  • Output: __ff_int_exam_case_5.case_id
  • Filter: (__ff_int_exam_case_5.level_id = 3)
134. 0.000 0.000 ↓ 0.0 0

Index Scan using mc_step_result_pk on public.mc_step_result (cost=0.14..8.16 rows=1 width=158) (never executed)

  • Output: mc_step_result.name
  • Index Cond: (mc_step_result.id = laststep.result_id)
135. 0.000 0.000 ↓ 0.0 0

Limit (cost=1,264.38..1,264.38 rows=1 width=126) (never executed)

  • Output: (concat_ws(' '::text, dd.code, dd.name)), cd.id
136. 0.000 0.000 ↓ 0.0 0

Sort (cost=1,264.38..1,264.73 rows=141 width=126) (never executed)

  • Output: (concat_ws(' '::text, dd.code, dd.name)), cd.id
  • Sort Key: cd.id DESC
137. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.85..1,263.68 rows=141 width=126) (never executed)

  • Output: concat_ws(' '::text, dd.code, dd.name), cd.id
138. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_mc_diagnosis on public.mc_diagnosis cd (cost=0.56..567.26 rows=141 width=8) (never executed)

  • Output: cd.id, cd.diagnos_id
  • Index Cond: (cd.patient_id = i.id)
139. 0.000 0.000 ↓ 0.0 0

Index Scan using md_diagnosis_pk on public.md_diagnosis dd (cost=0.29..4.93 rows=1 width=126) (never executed)

  • Output: dd.id, dd.code, dd.name, dd.parent_id, dd.is_injury, dd.level, dd.is_leaf, dd.e_code, dd.oms, dd.stomat, dd.aud_who, dd.aud_when, dd.aud_source, dd.aud_who_create, dd.aud_when_create, dd.aud_source_create, dd.from_dt, dd.to_dt
  • Index Cond: (dd.id = cd.diagnos_id)
140. 0.000 0.000 ↓ 0.0 0

Limit (cost=335.77..335.78 rows=1 width=8) (never executed)

  • Output: s_1.admission_date, s_1.id
141. 0.000 0.000 ↓ 0.0 0

Sort (cost=335.77..335.98 rows=83 width=8) (never executed)

  • Output: s_1.admission_date, s_1.id
  • Sort Key: s_1.id DESC
142. 0.000 0.000 ↓ 0.0 0

Index Scan using mc_step_patient_id_ix on public.mc_step s_1 (cost=0.44..335.36 rows=83 width=8) (never executed)

  • Output: s_1.admission_date, s_1.id
  • Index Cond: (s_1._patient_id = i.id)
143. 0.000 0.000 ↓ 0.0 0

Seq Scan on supp.__ff_int_exam_case __ff_int_exam_case_6 (cost=0.00..1.06 rows=1 width=4) (never executed)

  • Output: __ff_int_exam_case_6.id
  • Filter: ((__ff_int_exam_case_6.level_id = 1) AND (__ff_int_exam_case_6.case_id = mc.id))
144. 0.000 0.000 ↓ 0.0 0

Seq Scan on supp.__ff_int_exam_case __ff_int_exam_case_7 (cost=0.00..1.06 rows=1 width=4) (never executed)

  • Output: __ff_int_exam_case_7.id
  • Filter: ((__ff_int_exam_case_7.level_id = 2) AND (__ff_int_exam_case_7.case_id = mc.id))
145. 0.000 0.000 ↓ 0.0 0

Seq Scan on supp.__ff_int_exam_case __ff_int_exam_case_8 (cost=0.00..1.06 rows=1 width=4) (never executed)

  • Output: __ff_int_exam_case_8.id
  • Filter: ((__ff_int_exam_case_8.level_id = 3) AND (__ff_int_exam_case_8.case_id = mc.id))
146. 0.000 0.000 ↓ 0.0 0

Seq Scan on supp.__ff_int_exam_case __ff_int_exam_case_9 (cost=0.00..1.06 rows=1 width=4) (never executed)

  • Output: __ff_int_exam_case_9.expert_id
  • Filter: ((__ff_int_exam_case_9.level_id = 1) AND (__ff_int_exam_case_9.case_id = mc.id))
147. 0.000 0.000 ↓ 0.0 0

Seq Scan on supp.__ff_int_exam_case __ff_int_exam_case_10 (cost=0.00..1.06 rows=1 width=4) (never executed)

  • Output: __ff_int_exam_case_10.expert_id
  • Filter: ((__ff_int_exam_case_10.level_id = 2) AND (__ff_int_exam_case_10.case_id = mc.id))
148. 0.000 0.000 ↓ 0.0 0

Seq Scan on supp.__ff_int_exam_case __ff_int_exam_case_11 (cost=0.00..1.06 rows=1 width=4) (never executed)

  • Output: __ff_int_exam_case_11.expert_id
  • Filter: ((__ff_int_exam_case_11.level_id = 3) AND (__ff_int_exam_case_11.case_id = mc.id))
Planning time : 211.411 ms
Execution time : 43,777.600 ms