explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Raa9

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

Limit (cost=204,292.62..204,292.63 rows=1 width=288) (actual time=1,337.492..1,337.501 rows=16 loops=1)

  • Output: mc.id, ec.id, mc.uid, mc.open_date, mc.close_date, pd.id, (5996), mcd.diagnos_id, ((SubPlan 5)), (concat_ws(' '::text, mdd.code, mdd.name)), mct.id, mct.name, ((alternatives: SubPlan 6 or hashed SubPlan 7)), ((alternatives: SubPlan 8 or hashed SubPlan 9)), ((alternatives: SubPlan 10 or hashed SubPlan 11)), 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 12)), (58710), ((closing_step.admission_date + COALESCE(closing_step.admission_time, '00:00:00'::time without time zone))), ((closing_step.admission_date + COALESCE(closing_step.admission_time, '00:00:00'::time without time zone))), ((SubPlan 13)), ((SubPlan 14)), ((SubPlan 15)), (1), (CASE WHEN (NOT $26) THEN true ELSE false END), (CASE WHEN ($29 AND ((SubPlan 18) = 1)) THEN true ELSE false END), (CASE WHEN (((SubPlan 19) = 1) AND $34) THEN true ELSE false END), (CASE WHEN (((SubPlan 21) = 1) AND $38) THEN true ELSE false END), (CASE WHEN (NOT $41) THEN true ELSE false END), (CASE WHEN (((SubPlan 24) = 1) AND $45) THEN true ELSE false END), (CASE WHEN (((SubPlan 26) = 1) AND $49) THEN true ELSE false END), (CASE WHEN (((SubPlan 28) = 1) AND $53) THEN true ELSE false END), (CASE WHEN (hashed SubPlan 31) THEN true ELSE false END)
  • Buffers: shared hit=35351 read=306
  • I/O Timings: read=1144.595
2.          

CTE prm

3. 0.005 0.005 ↑ 1.0 1 1

Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.005..0.005 rows=1 loops=1)

  • Output: 1, 1602743, NULL::date, '2020-03-24'::date, '2020-02-23'::date, '2020-03-24'::date, 58710, 5996
4.          

CTE user_rights_pattern

5. 0.060 7.162 ↓ 3.0 3 1

Nested Loop (cost=0.99..25.68 rows=1 width=19) (actual time=3.795..7.162 rows=3 loops=1)

  • Output: p_1.allowed, p_1.permission_id
  • Buffers: shared hit=302
6. 0.352 1.909 ↓ 4.5 9 1

Nested Loop (cost=0.57..8.77 rows=2 width=4) (actual time=1.549..1.909 rows=9 loops=1)

  • Output: r.role_id
  • Buffers: shared hit=52
7. 0.072 1.123 ↓ 7.0 7 1

Nested Loop (cost=0.28..8.33 rows=1 width=4) (actual time=0.908..1.123 rows=7 loops=1)

  • Output: ac.id
  • Buffers: shared hit=30
8. 0.003 0.003 ↑ 1.0 1 1

CTE Scan on prm prm_1 (cost=0.00..0.02 rows=1 width=8) (actual time=0.002..0.003 rows=1 loops=1)

  • Output: prm_1.user_id, prm_1.clinic_id, prm_1.open_date_begin, prm_1.open_date_end, prm_1.close_date_begin, prm_1.close_date_end, prm_1.emp_pos_context, prm_1.dep_context
9. 1.048 1.048 ↓ 7.0 7 1

Index Scan using access_key_user_id_ix on sec.access_key ac (cost=0.28..8.30 rows=1 width=12) (actual time=0.838..1.048 rows=7 loops=1)

  • 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 = prm_1.user_id)
  • Filter: (prm_1.clinic_id = ac.org_id)
  • Rows Removed by Filter: 30
  • Buffers: shared hit=30
10. 0.434 0.434 ↑ 2.0 1 7

Index Scan using idx_user_access_role_user_access_id on sec.access_key_role r (cost=0.29..0.42 rows=2 width=8) (actual time=0.059..0.062 rows=1 loops=7)

  • 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)
  • Buffers: shared hit=22
11. 5.193 5.193 ↓ 0.0 0 9

Index Scan using idx_permission_ref_role_id on sec.permission_ref p_1 (cost=0.42..8.44 rows=1 width=23) (actual time=0.344..0.577 rows=0 loops=9)

  • 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.allowed AND (p_1.element_id = 'internalExamination'::text) AND (p_1.permission_id = ANY ('{readLevel1,readLevel2,readLevel3}'::text[])))
  • Rows Removed by Filter: 369
  • Buffers: shared hit=250
12.          

CTE user_rights

13. 0.010 7.766 ↑ 3.0 1 1

HashAggregate (cost=0.11..0.14 rows=3 width=0) (actual time=7.766..7.766 rows=1 loops=1)

  • Output: (1)
  • Group Key: (1)
  • Buffers: shared hit=302
14. 0.005 7.756 ↑ 1.0 3 1

Append (cost=0.00..0.10 rows=3 width=0) (actual time=7.753..7.756 rows=3 loops=1)

  • Buffers: shared hit=302
15. 7.726 7.726 ↓ 0.0 0 1

CTE Scan on user_rights_pattern (cost=0.00..0.02 rows=1 width=0) (actual time=7.726..7.726 rows=0 loops=1)

  • Output: 1
  • Filter: (user_rights_pattern.allowed AND (user_rights_pattern.permission_id = 'readLevel1'::text))
  • Rows Removed by Filter: 3
  • Buffers: shared hit=302
16. 0.017 0.017 ↓ 0.0 0 1

CTE Scan on user_rights_pattern user_rights_pattern_1 (cost=0.00..0.02 rows=1 width=0) (actual time=0.017..0.017 rows=0 loops=1)

  • Output: 2
  • Filter: (user_rights_pattern_1.allowed AND (user_rights_pattern_1.permission_id = 'readLevel2'::text))
  • Rows Removed by Filter: 3
17. 0.008 0.008 ↓ 3.0 3 1

CTE Scan on user_rights_pattern user_rights_pattern_2 (cost=0.00..0.02 rows=1 width=0) (actual time=0.007..0.008 rows=3 loops=1)

  • Output: 3
  • Filter: (user_rights_pattern_2.allowed AND (user_rights_pattern_2.permission_id = 'readLevel3'::text))
18.          

CTE cases

19. 0.035 16.287 ↑ 32.6 68 1

Nested Loop (cost=73,824.45..203,202.24 rows=2,214 width=4) (actual time=15.780..16.287 rows=68 loops=1)

  • Output: c.id
  • Buffers: shared hit=356
20. 0.017 0.017 ↑ 1.0 1 1

CTE Scan on prm prm_2 (cost=0.00..0.02 rows=1 width=20) (actual time=0.016..0.017 rows=1 loops=1)

  • Output: prm_2.user_id, prm_2.clinic_id, prm_2.open_date_begin, prm_2.open_date_end, prm_2.close_date_begin, prm_2.close_date_end, prm_2.emp_pos_context, prm_2.dep_context
21. 0.541 16.235 ↑ 32.6 68 1

Bitmap Heap Scan on public.mc_case c (cost=73,824.45..203,180.08 rows=2,214 width=16) (actual time=15.753..16.235 rows=68 loops=1)

  • Output: c.id, c.clinic_id, c.open_date, c.close_date
  • Recheck Cond: ((c.case_type_id = ANY ('{1,2}'::integer[])) AND (c.clinic_id = prm_2.clinic_id) AND (c.close_date >= COALESCE(prm_2.close_date_begin, '-infinity'::date)) AND (c.close_date <= COALESCE(prm_2.close_date_end, 'infinity'::date)))
  • Filter: (CASE WHEN (c.case_type_id = 2) THEN (c.main_diagnos_id IS NOT NULL) ELSE true END AND (c.open_date >= COALESCE(prm_2.open_date_begin, '-infinity'::date)) AND (c.open_date <= COALESCE(prm_2.open_date_end, 'infinity'::date)))
  • Rows Removed by Filter: 3
  • Heap Blocks: exact=71
  • Buffers: shared hit=356
22. 1.023 15.694 ↓ 0.0 0 1

BitmapAnd (cost=73,824.45..73,824.45 rows=39,849 width=0) (actual time=15.694..15.694 rows=0 loops=1)

  • Buffers: shared hit=285
23. 1.754 1.754 ↑ 90.4 3,969 1

Bitmap Index Scan on mc_case_case_type_id_clinic_id_idx (cost=0.00..8,671.33 rows=358,645 width=0) (actual time=1.754..1.754 rows=3,969 loops=1)

  • Index Cond: ((c.case_type_id = ANY ('{1,2}'::integer[])) AND (c.clinic_id = prm_2.clinic_id))
  • Buffers: shared hit=22
24. 12.917 12.917 ↑ 89.7 28,369 1

Bitmap Index Scan on mc_case_close_date_idx (cost=0.00..65,151.76 rows=2,543,932 width=0) (actual time=12.917..12.917 rows=28,369 loops=1)

  • Index Cond: ((c.close_date >= COALESCE(prm_2.close_date_begin, '-infinity'::date)) AND (c.close_date <= COALESCE(prm_2.close_date_end, 'infinity'::date)))
  • Buffers: shared hit=260
25.          

Initplan (for Limit)

26. 0.002 4.021 ↑ 1.0 1 1

Limit (cost=0.99..53.32 rows=1 width=1) (actual time=4.021..4.021 rows=1 loops=1)

  • Output: p_2.allowed
  • Buffers: shared hit=411
27. 0.023 4.019 ↑ 18.0 1 1

Nested Loop (cost=0.99..943.01 rows=18 width=1) (actual time=4.019..4.019 rows=1 loops=1)

  • Output: p_2.allowed
  • Buffers: shared hit=411
28. 0.014 0.135 ↑ 5.2 13 1

Nested Loop (cost=0.57..442.40 rows=67 width=4) (actual time=0.036..0.135 rows=13 loops=1)

  • Output: r_1.role_id
  • Buffers: shared hit=29
29. 0.019 0.019 ↑ 6.2 6 1

Index Scan using access_key_user_id_ix on sec.access_key ac_1 (cost=0.28..124.72 rows=37 width=4) (actual time=0.009..0.019 rows=6 loops=1)

  • 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)
  • Buffers: shared hit=8
30. 0.102 0.102 ↑ 1.0 2 6

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) (actual time=0.013..0.017 rows=2 loops=6)

  • 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)
  • Buffers: shared hit=21
31. 3.861 3.861 ↓ 0.0 0 13

Index Scan using idx_permission_ref_role_id on sec.permission_ref p_2 (cost=0.42..7.46 rows=1 width=5) (actual time=0.297..0.297 rows=0 loops=13)

  • 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)
  • Rows Removed by Filter: 357
  • Buffers: shared hit=382
32. 0.002 2.455 ↑ 1.0 1 1

Limit (cost=0.99..53.32 rows=1 width=1) (actual time=2.454..2.455 rows=1 loops=1)

  • Output: p_3.allowed
  • Buffers: shared hit=411
33. 0.012 2.453 ↑ 18.0 1 1

Nested Loop (cost=0.99..943.01 rows=18 width=1) (actual time=2.453..2.453 rows=1 loops=1)

  • Output: p_3.allowed
  • Buffers: shared hit=411
34. 0.011 0.062 ↑ 5.2 13 1

Nested Loop (cost=0.57..442.40 rows=67 width=4) (actual time=0.017..0.062 rows=13 loops=1)

  • Output: r_2.role_id
  • Buffers: shared hit=29
35. 0.015 0.015 ↑ 6.2 6 1

Index Scan using access_key_user_id_ix on sec.access_key ac_2 (cost=0.28..124.72 rows=37 width=4) (actual time=0.008..0.015 rows=6 loops=1)

  • 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)
  • Buffers: shared hit=8
36. 0.036 0.036 ↑ 1.0 2 6

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) (actual time=0.005..0.006 rows=2 loops=6)

  • 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)
  • Buffers: shared hit=21
37. 2.379 2.379 ↓ 0.0 0 13

Index Scan using idx_permission_ref_role_id on sec.permission_ref p_3 (cost=0.42..7.46 rows=1 width=5) (actual time=0.183..0.183 rows=0 loops=13)

  • 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)
  • Rows Removed by Filter: 357
  • Buffers: shared hit=382
38. 0.002 2.429 ↑ 1.0 1 1

Limit (cost=0.99..53.32 rows=1 width=1) (actual time=2.428..2.429 rows=1 loops=1)

  • Output: p_4.allowed
  • Buffers: shared hit=411
39. 0.013 2.427 ↑ 18.0 1 1

Nested Loop (cost=0.99..943.01 rows=18 width=1) (actual time=2.427..2.427 rows=1 loops=1)

  • Output: p_4.allowed
  • Buffers: shared hit=411
40. 0.010 0.061 ↑ 5.2 13 1

Nested Loop (cost=0.57..442.40 rows=67 width=4) (actual time=0.016..0.061 rows=13 loops=1)

  • Output: r_3.role_id
  • Buffers: shared hit=29
41. 0.015 0.015 ↑ 6.2 6 1

Index Scan using access_key_user_id_ix on sec.access_key ac_3 (cost=0.28..124.72 rows=37 width=4) (actual time=0.008..0.015 rows=6 loops=1)

  • 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)
  • Buffers: shared hit=8
42. 0.036 0.036 ↑ 1.0 2 6

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) (actual time=0.004..0.006 rows=2 loops=6)

  • 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)
  • Buffers: shared hit=21
43. 2.353 2.353 ↓ 0.0 0 13

Index Scan using idx_permission_ref_role_id on sec.permission_ref p_4 (cost=0.42..7.46 rows=1 width=5) (actual time=0.181..0.181 rows=0 loops=13)

  • 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)
  • Rows Removed by Filter: 357
  • Buffers: shared hit=382
44. 0.003 2.596 ↑ 1.0 1 1

Limit (cost=0.99..53.32 rows=1 width=1) (actual time=2.595..2.596 rows=1 loops=1)

  • Output: p_5.allowed
  • Buffers: shared hit=411
45. 0.020 2.593 ↑ 18.0 1 1

Nested Loop (cost=0.99..943.01 rows=18 width=1) (actual time=2.593..2.593 rows=1 loops=1)

  • Output: p_5.allowed
  • Buffers: shared hit=411
46. 0.018 0.064 ↑ 5.2 13 1

Nested Loop (cost=0.57..442.40 rows=67 width=4) (actual time=0.017..0.064 rows=13 loops=1)

  • Output: r_4.role_id
  • Buffers: shared hit=29
47. 0.016 0.016 ↑ 6.2 6 1

Index Scan using access_key_user_id_ix on sec.access_key ac_4 (cost=0.28..124.72 rows=37 width=4) (actual time=0.008..0.016 rows=6 loops=1)

  • Output: ac_4.id, ac_4.type_id, ac_4.org_id, ac_4.empl_pos_id, ac_4.user_id, ac_4.name, ac_4.is_blocked, ac_4.aud_who, ac_4.aud_when, ac_4.aud_source, ac_4.aud_who_create, ac_4.aud_when_create, ac_4.aud_source_create
  • Index Cond: (ac_4.user_id = 1)
  • Buffers: shared hit=8
48. 0.030 0.030 ↑ 1.0 2 6

Index Scan using idx_user_access_role_user_access_id on sec.access_key_role r_4 (cost=0.29..8.57 rows=2 width=8) (actual time=0.004..0.005 rows=2 loops=6)

  • Output: r_4.id, r_4.role_id, r_4.user_access_id, r_4.aud_who, r_4.aud_when, r_4.aud_source, r_4.aud_who_create, r_4.aud_when_create, r_4.aud_source_create
  • Index Cond: (r_4.user_access_id = ac_4.id)
  • Buffers: shared hit=21
49. 2.509 2.509 ↓ 0.0 0 13

Index Scan using idx_permission_ref_role_id on sec.permission_ref p_5 (cost=0.42..7.46 rows=1 width=5) (actual time=0.193..0.193 rows=0 loops=13)

  • Output: p_5.id, p_5.section_id, p_5.element_id, p_5.permission_id, p_5.allowed, p_5.role_id, p_5.aud_who, p_5.aud_when, p_5.aud_source, p_5.aud_who_create, p_5.aud_when_create, p_5.aud_source_create, p_5.section_name, p_5.element_name, p_5.permission_name
  • Index Cond: (p_5.role_id = r_4.role_id)
  • Filter: (p_5.permission_id = 'ownUpdate'::text)
  • Rows Removed by Filter: 357
  • Buffers: shared hit=382
50. 0.003 2.419 ↑ 1.0 1 1

Limit (cost=0.99..53.32 rows=1 width=1) (actual time=2.418..2.419 rows=1 loops=1)

  • Output: p_6.allowed
  • Buffers: shared hit=408
51. 0.011 2.416 ↑ 18.0 1 1

Nested Loop (cost=0.99..943.01 rows=18 width=1) (actual time=2.416..2.416 rows=1 loops=1)

  • Output: p_6.allowed
  • Buffers: shared hit=408
52. 0.014 0.065 ↑ 5.2 13 1

Nested Loop (cost=0.57..442.40 rows=67 width=4) (actual time=0.018..0.065 rows=13 loops=1)

  • Output: r_5.role_id
  • Buffers: shared hit=29
53. 0.015 0.015 ↑ 6.2 6 1

Index Scan using access_key_user_id_ix on sec.access_key ac_5 (cost=0.28..124.72 rows=37 width=4) (actual time=0.008..0.015 rows=6 loops=1)

  • Output: ac_5.id, ac_5.type_id, ac_5.org_id, ac_5.empl_pos_id, ac_5.user_id, ac_5.name, ac_5.is_blocked, ac_5.aud_who, ac_5.aud_when, ac_5.aud_source, ac_5.aud_who_create, ac_5.aud_when_create, ac_5.aud_source_create
  • Index Cond: (ac_5.user_id = 1)
  • Buffers: shared hit=8
54. 0.036 0.036 ↑ 1.0 2 6

Index Scan using idx_user_access_role_user_access_id on sec.access_key_role r_5 (cost=0.29..8.57 rows=2 width=8) (actual time=0.005..0.006 rows=2 loops=6)

  • Output: r_5.id, r_5.role_id, r_5.user_access_id, r_5.aud_who, r_5.aud_when, r_5.aud_source, r_5.aud_who_create, r_5.aud_when_create, r_5.aud_source_create
  • Index Cond: (r_5.user_access_id = ac_5.id)
  • Buffers: shared hit=21
55. 2.340 2.340 ↓ 0.0 0 13

Index Scan using idx_permission_ref_role_id on sec.permission_ref p_6 (cost=0.42..7.46 rows=1 width=5) (actual time=0.180..0.180 rows=0 loops=13)

  • Output: p_6.id, p_6.section_id, p_6.element_id, p_6.permission_id, p_6.allowed, p_6.role_id, p_6.aud_who, p_6.aud_when, p_6.aud_source, p_6.aud_who_create, p_6.aud_when_create, p_6.aud_source_create, p_6.section_name, p_6.element_name, p_6.permission_name
  • Index Cond: (p_6.role_id = r_5.role_id)
  • Filter: (p_6.permission_id = 'ownDelete'::text)
  • Rows Removed by Filter: 356
  • Buffers: shared hit=379
56. 0.001 2.406 ↑ 1.0 1 1

Limit (cost=0.99..53.32 rows=1 width=1) (actual time=2.405..2.406 rows=1 loops=1)

  • Output: p_7.allowed
  • Buffers: shared hit=408
57. 0.006 2.405 ↑ 18.0 1 1

Nested Loop (cost=0.99..943.01 rows=18 width=1) (actual time=2.405..2.405 rows=1 loops=1)

  • Output: p_7.allowed
  • Buffers: shared hit=408
58. 0.008 0.059 ↑ 5.2 13 1

Nested Loop (cost=0.57..442.40 rows=67 width=4) (actual time=0.017..0.059 rows=13 loops=1)

  • Output: r_6.role_id
  • Buffers: shared hit=29
59. 0.015 0.015 ↑ 6.2 6 1

Index Scan using access_key_user_id_ix on sec.access_key ac_6 (cost=0.28..124.72 rows=37 width=4) (actual time=0.008..0.015 rows=6 loops=1)

  • Output: ac_6.id, ac_6.type_id, ac_6.org_id, ac_6.empl_pos_id, ac_6.user_id, ac_6.name, ac_6.is_blocked, ac_6.aud_who, ac_6.aud_when, ac_6.aud_source, ac_6.aud_who_create, ac_6.aud_when_create, ac_6.aud_source_create
  • Index Cond: (ac_6.user_id = 1)
  • Buffers: shared hit=8
60. 0.036 0.036 ↑ 1.0 2 6

Index Scan using idx_user_access_role_user_access_id on sec.access_key_role r_6 (cost=0.29..8.57 rows=2 width=8) (actual time=0.004..0.006 rows=2 loops=6)

  • Output: r_6.id, r_6.role_id, r_6.user_access_id, r_6.aud_who, r_6.aud_when, r_6.aud_source, r_6.aud_who_create, r_6.aud_when_create, r_6.aud_source_create
  • Index Cond: (r_6.user_access_id = ac_6.id)
  • Buffers: shared hit=21
61. 2.340 2.340 ↓ 0.0 0 13

Index Scan using idx_permission_ref_role_id on sec.permission_ref p_7 (cost=0.42..7.46 rows=1 width=5) (actual time=0.180..0.180 rows=0 loops=13)

  • Output: p_7.id, p_7.section_id, p_7.element_id, p_7.permission_id, p_7.allowed, p_7.role_id, p_7.aud_who, p_7.aud_when, p_7.aud_source, p_7.aud_who_create, p_7.aud_when_create, p_7.aud_source_create, p_7.section_name, p_7.element_name, p_7.permission_name
  • Index Cond: (p_7.role_id = r_6.role_id)
  • Filter: (p_7.permission_id = 'ownDelete'::text)
  • Rows Removed by Filter: 356
  • Buffers: shared hit=379
62. 0.000 2.391 ↑ 1.0 1 1

Limit (cost=0.99..53.32 rows=1 width=1) (actual time=2.391..2.391 rows=1 loops=1)

  • Output: p_8.allowed
  • Buffers: shared hit=408
63. 0.006 2.391 ↑ 18.0 1 1

Nested Loop (cost=0.99..943.01 rows=18 width=1) (actual time=2.391..2.391 rows=1 loops=1)

  • Output: p_8.allowed
  • Buffers: shared hit=408
64. 0.006 0.058 ↑ 5.2 13 1

Nested Loop (cost=0.57..442.40 rows=67 width=4) (actual time=0.015..0.058 rows=13 loops=1)

  • Output: r_7.role_id
  • Buffers: shared hit=29
65. 0.016 0.016 ↑ 6.2 6 1

Index Scan using access_key_user_id_ix on sec.access_key ac_7 (cost=0.28..124.72 rows=37 width=4) (actual time=0.008..0.016 rows=6 loops=1)

  • Output: ac_7.id, ac_7.type_id, ac_7.org_id, ac_7.empl_pos_id, ac_7.user_id, ac_7.name, ac_7.is_blocked, ac_7.aud_who, ac_7.aud_when, ac_7.aud_source, ac_7.aud_who_create, ac_7.aud_when_create, ac_7.aud_source_create
  • Index Cond: (ac_7.user_id = 1)
  • Buffers: shared hit=8
66. 0.036 0.036 ↑ 1.0 2 6

Index Scan using idx_user_access_role_user_access_id on sec.access_key_role r_7 (cost=0.29..8.57 rows=2 width=8) (actual time=0.004..0.006 rows=2 loops=6)

  • Output: r_7.id, r_7.role_id, r_7.user_access_id, r_7.aud_who, r_7.aud_when, r_7.aud_source, r_7.aud_who_create, r_7.aud_when_create, r_7.aud_source_create
  • Index Cond: (r_7.user_access_id = ac_7.id)
  • Buffers: shared hit=21
67. 2.327 2.327 ↓ 0.0 0 13

Index Scan using idx_permission_ref_role_id on sec.permission_ref p_8 (cost=0.42..7.46 rows=1 width=5) (actual time=0.179..0.179 rows=0 loops=13)

  • Output: p_8.id, p_8.section_id, p_8.element_id, p_8.permission_id, p_8.allowed, p_8.role_id, p_8.aud_who, p_8.aud_when, p_8.aud_source, p_8.aud_who_create, p_8.aud_when_create, p_8.aud_source_create, p_8.section_name, p_8.element_name, p_8.permission_name
  • Index Cond: (p_8.role_id = r_7.role_id)
  • Filter: (p_8.permission_id = 'ownDelete'::text)
  • Rows Removed by Filter: 356
  • Buffers: shared hit=379
68. 0.000 2.425 ↑ 1.0 1 1

Limit (cost=0.99..53.32 rows=1 width=1) (actual time=2.425..2.425 rows=1 loops=1)

  • Output: p_9.allowed
  • Buffers: shared hit=408
69. 0.016 2.425 ↑ 18.0 1 1

Nested Loop (cost=0.99..943.01 rows=18 width=1) (actual time=2.425..2.425 rows=1 loops=1)

  • Output: p_9.allowed
  • Buffers: shared hit=408
70. 0.012 0.056 ↑ 5.2 13 1

Nested Loop (cost=0.57..442.40 rows=67 width=4) (actual time=0.016..0.056 rows=13 loops=1)

  • Output: r_8.role_id
  • Buffers: shared hit=29
71. 0.014 0.014 ↑ 6.2 6 1

Index Scan using access_key_user_id_ix on sec.access_key ac_8 (cost=0.28..124.72 rows=37 width=4) (actual time=0.008..0.014 rows=6 loops=1)

  • Output: ac_8.id, ac_8.type_id, ac_8.org_id, ac_8.empl_pos_id, ac_8.user_id, ac_8.name, ac_8.is_blocked, ac_8.aud_who, ac_8.aud_when, ac_8.aud_source, ac_8.aud_who_create, ac_8.aud_when_create, ac_8.aud_source_create
  • Index Cond: (ac_8.user_id = 1)
  • Buffers: shared hit=8
72. 0.030 0.030 ↑ 1.0 2 6

Index Scan using idx_user_access_role_user_access_id on sec.access_key_role r_8 (cost=0.29..8.57 rows=2 width=8) (actual time=0.004..0.005 rows=2 loops=6)

  • Output: r_8.id, r_8.role_id, r_8.user_access_id, r_8.aud_who, r_8.aud_when, r_8.aud_source, r_8.aud_who_create, r_8.aud_when_create, r_8.aud_source_create
  • Index Cond: (r_8.user_access_id = ac_8.id)
  • Buffers: shared hit=21
73. 2.353 2.353 ↓ 0.0 0 13

Index Scan using idx_permission_ref_role_id on sec.permission_ref p_9 (cost=0.42..7.46 rows=1 width=5) (actual time=0.181..0.181 rows=0 loops=13)

  • Output: p_9.id, p_9.section_id, p_9.element_id, p_9.permission_id, p_9.allowed, p_9.role_id, p_9.aud_who, p_9.aud_when, p_9.aud_source, p_9.aud_who_create, p_9.aud_when_create, p_9.aud_source_create, p_9.section_name, p_9.element_name, p_9.permission_name
  • Index Cond: (p_9.role_id = r_8.role_id)
  • Filter: (p_9.permission_id = 'ownDelete'::text)
  • Rows Removed by Filter: 356
  • Buffers: shared hit=379
74. 7.775 7.775 ↑ 1.0 1 1

CTE Scan on user_rights (cost=0.00..0.07 rows=1 width=0) (actual time=7.775..7.775 rows=1 loops=1)

  • Filter: (user_rights.priv = 3)
  • Buffers: shared hit=302
75. 0.000 0.000 ↓ 0.0 0

CTE Scan on user_rights user_rights_1 (cost=0.00..0.07 rows=1 width=0) (never executed)

  • Filter: (user_rights_1.priv = 2)
76. 0.000 0.000 ↓ 0.0 0

CTE Scan on user_rights user_rights_2 (cost=0.00..0.07 rows=1 width=0) (never executed)

  • Filter: (user_rights_2.priv = 1)
77. 0.735 1,337.498 ↓ 16.0 16 1

Sort (cost=637.78..637.78 rows=1 width=288) (actual time=1,337.491..1,337.498 rows=16 loops=1)

  • Output: mc.id, ec.id, mc.uid, mc.open_date, mc.close_date, pd.id, (5996), mcd.diagnos_id, ((SubPlan 5)), (concat_ws(' '::text, mdd.code, mdd.name)), mct.id, mct.name, ((alternatives: SubPlan 6 or hashed SubPlan 7)), ((alternatives: SubPlan 8 or hashed SubPlan 9)), ((alternatives: SubPlan 10 or hashed SubPlan 11)), 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 12)), (58710), ((closing_step.admission_date + COALESCE(closing_step.admission_time, '00:00:00'::time without time zone))), ((closing_step.admission_date + COALESCE(closing_step.admission_time, '00:00:00'::time without time zone))), ((SubPlan 13)), ((SubPlan 14)), ((SubPlan 15)), (1), (CASE WHEN (NOT $26) THEN true ELSE false END), (CASE WHEN ($29 AND ((SubPlan 18) = 1)) THEN true ELSE false END), (CASE WHEN (((SubPlan 19) = 1) AND $34) THEN true ELSE false END), (CASE WHEN (((SubPlan 21) = 1) AND $38) THEN true ELSE false END), (CASE WHEN (NOT $41) THEN true ELSE false END), (CASE WHEN (((SubPlan 24) = 1) AND $45) THEN true ELSE false END), (CASE WHEN (((SubPlan 26) = 1) AND $49) THEN true ELSE false END), (CASE WHEN (((SubPlan 28) = 1) AND $53) THEN true ELSE false END), (CASE WHEN (hashed SubPlan 31) THEN true ELSE false END)
  • Sort Key: ((SubPlan 12)), mc.close_date DESC
  • Sort Method: top-N heapsort Memory: 31kB
  • Buffers: shared hit=35351 read=306
  • I/O Timings: read=1144.595
78. 26.427 1,336.763 ↓ 69.0 69 1

Nested Loop (cost=115.41..637.77 rows=1 width=288) (actual time=597.985..1,336.763 rows=69 loops=1)

  • Output: mc.id, ec.id, mc.uid, mc.open_date, mc.close_date, pd.id, 5996, mcd.diagnos_id, (SubPlan 5), concat_ws(' '::text, mdd.code, mdd.name), mct.id, mct.name, (alternatives: SubPlan 6 or hashed SubPlan 7), (alternatives: SubPlan 8 or hashed SubPlan 9), (alternatives: SubPlan 10 or hashed SubPlan 11), 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 12), 58710, (closing_step.admission_date + COALESCE(closing_step.admission_time, '00:00:00'::time without time zone)), (closing_step.admission_date + COALESCE(closing_step.admission_time, '00:00:00'::time without time zone)), (SubPlan 13), (SubPlan 14), (SubPlan 15), 1, CASE WHEN (NOT $26) THEN true ELSE false END, CASE WHEN ($29 AND ((SubPlan 18) = 1)) THEN true ELSE false END, CASE WHEN (((SubPlan 19) = 1) AND $34) THEN true ELSE false END, CASE WHEN (((SubPlan 21) = 1) AND $38) THEN true ELSE false END, CASE WHEN (NOT $41) THEN true ELSE false END, CASE WHEN (((SubPlan 24) = 1) AND $45) THEN true ELSE false END, CASE WHEN (((SubPlan 26) = 1) AND $49) THEN true ELSE false END, CASE WHEN (((SubPlan 28) = 1) AND $53) THEN true ELSE false END, CASE WHEN (hashed SubPlan 31) THEN true ELSE false END
  • Buffers: shared hit=35345 read=306
  • I/O Timings: read=1144.595
79. 0.178 834.495 ↓ 69.0 69 1

Nested Loop (cost=93.40..158.15 rows=1 width=166) (actual time=574.739..834.495 rows=69 loops=1)

  • Output: mc.id, mc.uid, mc.open_date, mc.close_date, mc.main_diagnos_id, mct.id, mct.name, i.id, i.surname, i.name, i.patr_name, i.birth_dt, closing_step.result_id, closing_step.admission_date, closing_step.admission_time, pd.id, mcd.diagnos_id, ec.id
  • Buffers: shared hit=30379 read=192
  • I/O Timings: read=676.383
80. 8.088 708.875 ↓ 69.0 69 1

Nested Loop Left Join (cost=92.83..149.55 rows=1 width=162) (actual time=574.711..708.875 rows=69 loops=1)

  • Output: mc.id, mc.uid, mc.open_date, mc.close_date, mc.main_diagnos_id, mct.id, mct.name, i.id, i.surname, i.name, i.patr_name, i.birth_dt, closing_step.result_id, closing_step.admission_date, closing_step.admission_time, pd.id, ec.id
  • Filter: CASE WHEN $57 THEN true ELSE CASE WHEN $58 THEN (SubPlan 35) ELSE CASE WHEN $62 THEN (pd.id = prm.dep_context) ELSE false END END END
  • Buffers: shared hit=30086 read=140
  • I/O Timings: read=552.249
81. 0.706 678.638 ↓ 69.0 69 1

Nested Loop Left Join (cost=92.55..132.03 rows=1 width=174) (actual time=566.484..678.638 rows=69 loops=1)

  • Output: prm.emp_pos_context, prm.dep_context, mc.id, mc.uid, mc.open_date, mc.close_date, mc.main_diagnos_id, mct.id, mct.name, i.id, i.surname, i.name, i.patr_name, i.birth_dt, closing_step.result_id, closing_step.admission_date, closing_step.admission_time, hsp.department_id, closing_res_group.department_id, ec.id
  • Buffers: shared hit=29591 read=135
  • I/O Timings: read=531.652
82. 0.345 566.083 ↓ 69.0 69 1

Hash Right Join (cost=91.98..125.37 rows=1 width=174) (actual time=565.912..566.083 rows=69 loops=1)

  • Output: prm.emp_pos_context, prm.dep_context, mc.id, mc.uid, mc.open_date, mc.close_date, mc.main_diagnos_id, mct.id, mct.name, i.id, i.surname, i.name, i.patr_name, i.birth_dt, closing_step.result_id, closing_step.admission_date, closing_step.admission_time, closing_step.res_group_id, hsp.department_id, ec.id
  • Hash Cond: (ec.case_id = mc.id)
  • Buffers: shared hit=29363 read=92
  • I/O Timings: read=421.113
83. 0.022 0.022 ↑ 283.3 6 1

Seq Scan on internal_examination."case" ec (cost=0.00..27.00 rows=1,700 width=8) (actual time=0.020..0.022 rows=6 loops=1)

  • Output: ec.id, ec.case_id, ec.group_id, ec.level_id, ec.expert_id
  • Buffers: shared hit=1
84. 0.252 565.716 ↓ 68.0 68 1

Hash (cost=91.97..91.97 rows=1 width=170) (actual time=565.716..565.716 rows=68 loops=1)

  • Output: prm.emp_pos_context, prm.dep_context, mc.id, mc.uid, mc.open_date, mc.close_date, mc.main_diagnos_id, mct.id, mct.name, i.id, i.surname, i.name, i.patr_name, i.birth_dt, closing_step.result_id, closing_step.admission_date, closing_step.admission_time, closing_step.res_group_id, hsp.department_id
  • Buckets: 1024 Batches: 1 Memory Usage: 23kB
  • Buffers: shared hit=29362 read=92
  • I/O Timings: read=421.113
85. 0.232 565.464 ↓ 68.0 68 1

Nested Loop Left Join (cost=10.19..91.97 rows=1 width=170) (actual time=149.571..565.464 rows=68 loops=1)

  • Output: prm.emp_pos_context, prm.dep_context, mc.id, mc.uid, mc.open_date, mc.close_date, mc.main_diagnos_id, mct.id, mct.name, i.id, i.surname, i.name, i.patr_name, i.birth_dt, closing_step.result_id, closing_step.admission_date, closing_step.admission_time, closing_step.res_group_id, hsp.department_id
  • Buffers: shared hit=29362 read=92
  • I/O Timings: read=421.113
86. 0.175 475.744 ↓ 68.0 68 1

Nested Loop (cost=9.77..85.56 rows=1 width=170) (actual time=149.552..475.744 rows=68 loops=1)

  • Output: prm.emp_pos_context, prm.dep_context, mc.id, mc.uid, mc.open_date, mc.close_date, mc.main_diagnos_id, mct.id, mct.name, i.id, i.surname, i.name, i.patr_name, i.birth_dt, closing_step.result_id, closing_step.admission_date, closing_step.admission_time, closing_step.id, closing_step.res_group_id
  • Buffers: shared hit=29160 read=70
  • I/O Timings: read=332.335
87. 0.140 288.841 ↓ 68.0 68 1

Nested Loop (cost=9.33..77.10 rows=1 width=150) (actual time=139.124..288.841 rows=68 loops=1)

  • Output: prm.emp_pos_context, prm.dep_context, mc.id, mc.uid, mc.open_date, mc.close_date, mc.main_diagnos_id, mc.closing_step_id, mct.id, mct.name, i.id, i.surname, i.name, i.patr_name, i.birth_dt
  • Join Filter: (mc.patient_id = p.id)
  • Buffers: shared hit=28928 read=29
  • I/O Timings: read=146.546
88. 0.165 287.817 ↓ 68.0 68 1

Nested Loop (cost=8.90..70.69 rows=1 width=154) (actual time=139.075..287.817 rows=68 loops=1)

  • Output: prm.emp_pos_context, prm.dep_context, mc.id, mc.uid, mc.open_date, mc.close_date, mc.main_diagnos_id, mc.patient_id, mc.closing_step_id, mct.id, mct.name, i.id, i.surname, i.name, i.patr_name, i.birth_dt
  • Buffers: shared hit=28656 read=29
  • I/O Timings: read=146.546
89. 0.263 140.024 ↓ 68.0 68 1

Nested Loop (cost=8.47..62.23 rows=1 width=97) (actual time=138.745..140.024 rows=68 loops=1)

  • Output: prm.emp_pos_context, prm.dep_context, mc.id, mc.uid, mc.open_date, mc.close_date, mc.main_diagnos_id, mc.patient_id, mc.closing_step_id, mct.id, mct.name
  • Join Filter: (mc.case_type_id = mct.id)
  • Rows Removed by Join Filter: 340
  • Buffers: shared hit=28413
90. 0.085 139.557 ↓ 68.0 68 1

Nested Loop (cost=8.47..61.10 rows=1 width=42) (actual time=138.732..139.557 rows=68 loops=1)

  • Output: prm.emp_pos_context, prm.dep_context, mc.id, mc.uid, mc.open_date, mc.close_date, mc.main_diagnos_id, mc.case_type_id, mc.patient_id, mc.closing_step_id
  • Buffers: shared hit=28345
91. 0.127 139.404 ↓ 68.0 68 1

Hash Join (cost=8.47..61.07 rows=1 width=34) (actual time=138.726..139.404 rows=68 loops=1)

  • Output: mc.id, mc.uid, mc.open_date, mc.close_date, mc.main_diagnos_id, mc.case_type_id, mc.patient_id, mc.closing_step_id
  • Hash Cond: (cases.id = mc.id)
  • Buffers: shared hit=28345
92. 16.359 16.359 ↑ 32.6 68 1

CTE Scan on cases (cost=0.00..44.28 rows=2,214 width=4) (actual time=15.783..16.359 rows=68 loops=1)

  • Output: cases.id
  • Buffers: shared hit=356
93. 0.062 122.918 ↓ 80.0 80 1

Hash (cost=8.46..8.46 rows=1 width=34) (actual time=122.918..122.918 rows=80 loops=1)

  • Output: mc.id, mc.uid, mc.open_date, mc.close_date, mc.main_diagnos_id, mc.case_type_id, mc.patient_id, mc.closing_step_id
  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
  • Buffers: shared hit=27989
94. 122.856 122.856 ↓ 80.0 80 1

Index Scan using mc_case_close_date_idx on public.mc_case mc (cost=0.44..8.46 rows=1 width=34) (actual time=40.916..122.856 rows=80 loops=1)

  • Output: mc.id, mc.uid, mc.open_date, mc.close_date, mc.main_diagnos_id, mc.case_type_id, mc.patient_id, mc.closing_step_id
  • Index Cond: ((mc.close_date >= '2020-02-23'::date) AND (mc.close_date <= '2020-03-24'::date))
  • Filter: ((mc.open_date <= '2020-03-24'::date) AND (mc.clinic_id = 1602743))
  • Rows Removed by Filter: 28289
  • Buffers: shared hit=27989
95. 0.068 0.068 ↑ 1.0 1 68

CTE Scan on prm (cost=0.00..0.02 rows=1 width=8) (actual time=0.000..0.001 rows=1 loops=68)

  • Output: prm.user_id, prm.clinic_id, prm.open_date_begin, prm.open_date_end, prm.close_date_begin, prm.close_date_end, prm.emp_pos_context, prm.dep_context
96. 0.204 0.204 ↑ 1.0 6 68

Seq Scan on public.mc_case_type mct (cost=0.00..1.06 rows=6 width=59) (actual time=0.001..0.003 rows=6 loops=68)

  • 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
  • Buffers: shared hit=68
97. 147.628 147.628 ↑ 1.0 1 68

Index Scan using pim_individual_id_birth_dt_gender_id_idx on public.pim_individual i (cost=0.43..8.45 rows=1 width=57) (actual time=2.171..2.171 rows=1 loops=68)

  • 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 = mc.patient_id)
  • Buffers: shared hit=243 read=29
  • I/O Timings: read=146.546
98. 0.884 0.884 ↑ 1.0 1 68

Index Only Scan using pci_patient_pk on public.pci_patient p (cost=0.43..6.40 rows=1 width=4) (actual time=0.012..0.013 rows=1 loops=68)

  • Output: p.id
  • Index Cond: (p.id = i.id)
  • Heap Fetches: 68
  • Buffers: shared hit=272
99. 186.728 186.728 ↑ 1.0 1 68

Index Scan using mc_step_pk on public.mc_step closing_step (cost=0.44..8.46 rows=1 width=24) (actual time=2.746..2.746 rows=1 loops=68)

  • Output: closing_step.id, closing_step.admission_date, closing_step.admission_time, closing_step.death_date, closing_step.death_time, closing_step.outcome_date, closing_step.outcome_time, closing_step.death_employee_id, closing_step.main_diagnosis_id, closing_step.case_id, closing_step.outcome_id, closing_step.outcome_clinic_id, closing_step.outcome_regimen_id, closing_step.regimen_id, closing_step.res_group_id, closing_step.result_id, closing_step.reason_id, closing_step.profile_id, closing_step.mes_id, closing_step.mes_quality_criterion_id, closing_step.is_continue, closing_step.is_continue_editable, closing_step.standard_id, closing_step.csg_id, closing_step.vmp_type_id, closing_step.vmp_method_id, closing_step.deviation_reason_id, closing_step.aud_who, closing_step.aud_when, closing_step.aud_source, closing_step.aud_who_create, closing_step.aud_when_create, closing_step.aud_source_create, closing_step._clinic_id, closing_step._patient_id, closing_step.planned_date_closing_case, closing_step.gestational_age, closing_step.onko_stage, closing_step.hsp_bed_profile_id, closing_step.is_first_step
  • Index Cond: (closing_step.id = mc.closing_step_id)
  • Buffers: shared hit=232 read=41
  • I/O Timings: read=185.789
100. 89.488 89.488 ↓ 0.0 0 68

Index Scan using hsp_record_pk on public.hsp_record hsp (cost=0.42..6.39 rows=1 width=8) (actual time=1.316..1.316 rows=0 loops=68)

  • Output: hsp.id, hsp.is_admission_day_counts, hsp.old_is_continue, hsp.department_id, hsp.funding_id, hsp.mes_id, hsp.previous_id, hsp.is_set_diagnosis, hsp.old_is_continue_edit, hsp.is_diag_not_eq, hsp.days_comp_algo_id, hsp.missed_days_amount, hsp.bed_days_amount, hsp.issue_planned_date, hsp.complexity_level_id, hsp.bed_profile_id, hsp.aud_who, hsp.aud_when, hsp.aud_source, hsp.aud_who_create, hsp.aud_when_create, hsp.aud_source_create, hsp.refusal_employee_id, hsp.is_finance_type_control, hsp.house_call_id, hsp.action_allowed_result_id
  • Index Cond: (hsp.id = closing_step.id)
  • Buffers: shared hit=202 read=22
  • I/O Timings: read=88.778
101. 111.849 111.849 ↑ 1.0 1 69

Index Scan using sr_res_group_pk on public.sr_res_group closing_res_group (cost=0.57..6.65 rows=1 width=8) (actual time=1.620..1.621 rows=1 loops=69)

  • Output: closing_res_group.id, closing_res_group.bdate, closing_res_group.edate, closing_res_group.is_system, closing_res_group.name, closing_res_group.department_id, closing_res_group.org_id, closing_res_group.responsible_id, closing_res_group.is_available_in_electronic_queue, closing_res_group.label_id, closing_res_group.ignore_regclinic_check, closing_res_group.note, closing_res_group.blocked, closing_res_group.block_comment, closing_res_group.template_res_group_id, closing_res_group.aud_who, closing_res_group.aud_when, closing_res_group.aud_source, closing_res_group.aud_who_create, closing_res_group.aud_when_create, closing_res_group.aud_source_create, closing_res_group.emergency, closing_res_group.ignore_districts, closing_res_group.service_template_id
  • Index Cond: (closing_res_group.id = closing_step.res_group_id)
  • Buffers: shared hit=228 read=43
  • I/O Timings: read=110.539
102. 22.149 22.149 ↑ 1.0 1 69

Index Only Scan using pim_department_pk on public.pim_department pd (cost=0.28..3.18 rows=1 width=4) (actual time=0.320..0.321 rows=1 loops=69)

  • Output: pd.id
  • Index Cond: (pd.id = COALESCE(closing_res_group.department_id, hsp.department_id))
  • Heap Fetches: 61
  • Buffers: shared hit=193 read=5
  • I/O Timings: read=20.597
103.          

SubPlan (for Nested Loop Left Join)

104. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.29..8.31 rows=1 width=4) (never executed)

  • Output: md_employee_position.profile_id
105. 0.000 0.000 ↓ 0.0 0

Index Scan using md_employee_position_pk on public.md_employee_position (cost=0.29..8.31 rows=1 width=4) (never executed)

  • Output: md_employee_position.profile_id
  • Index Cond: (md_employee_position.id = prm.emp_pos_context)
106. 0.000 0.000 ↓ 0.0 0

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

  • Output: mc_step.profile_id
  • Index Cond: (mc_step.case_id = mc.id)
107. 125.442 125.442 ↑ 1.0 1 69

Index Scan using mc_diagnosis_pk on public.mc_diagnosis mcd (cost=0.56..8.58 rows=1 width=8) (actual time=1.817..1.818 rows=1 loops=69)

  • Output: mcd.diagnos_id, mcd.id
  • Index Cond: (mcd.id = mc.main_diagnos_id)
  • Buffers: shared hit=293 read=52
  • I/O Timings: read=124.134
108. 27.186 27.186 ↑ 1.0 1 69

Index Scan using md_diagnosis_pk on public.md_diagnosis mdd (cost=0.29..6.16 rows=1 width=126) (actual time=0.394..0.394 rows=1 loops=69)

  • Output: mdd.id, mdd.code, mdd.name, mdd.parent_id, mdd.is_injury, mdd.level, mdd.is_leaf, mdd.e_code, mdd.oms, mdd.stomat, mdd.aud_who, mdd.aud_when, mdd.aud_source, mdd.aud_who_create, mdd.aud_when_create, mdd.aud_source_create, mdd.from_dt, mdd.to_dt
  • Index Cond: (mdd.id = mcd.diagnos_id)
  • Buffers: shared hit=163 read=44
  • I/O Timings: read=26.058
109.          

SubPlan (for Nested Loop)

110. 0.138 443.739 ↑ 1.0 1 69

Limit (cost=0.57..0.63 rows=1 width=4) (actual time=6.431..6.431 rows=1 loops=69)

  • Output: md_srv_rendered.id
  • Buffers: shared hit=275 read=67
  • I/O Timings: read=441.854
111. 443.601 443.601 ↑ 935.0 1 69

Index Scan using md_srv_rendered_case_id_idx on public.md_srv_rendered (cost=0.57..56.30 rows=935 width=4) (actual time=6.429..6.429 rows=1 loops=69)

  • Output: md_srv_rendered.id
  • Index Cond: (md_srv_rendered.case_id = mc.id)
  • Buffers: shared hit=275 read=67
  • I/O Timings: read=441.854
112. 0.000 0.000 ↓ 0.0 0

Seq Scan on internal_examination."case" (cost=0.00..35.50 rows=1 width=0) (never executed)

  • Filter: (("case".level_id = 1) AND ("case".case_id = mc.id))
113. 0.016 0.016 ↑ 2.7 3 1

Seq Scan on internal_examination."case" case_1 (cost=0.00..31.25 rows=8 width=4) (actual time=0.014..0.016 rows=3 loops=1)

  • Output: case_1.case_id
  • Filter: (case_1.level_id = 1)
  • Rows Removed by Filter: 3
  • Buffers: shared hit=1
114. 0.000 0.000 ↓ 0.0 0

Seq Scan on internal_examination."case" case_2 (cost=0.00..35.50 rows=1 width=0) (never executed)

  • Filter: ((case_2.level_id = 2) AND (case_2.case_id = mc.id))
115. 0.010 0.010 ↑ 4.0 2 1

Seq Scan on internal_examination."case" case_3 (cost=0.00..31.25 rows=8 width=4) (actual time=0.008..0.010 rows=2 loops=1)

  • Output: case_3.case_id
  • Filter: (case_3.level_id = 2)
  • Rows Removed by Filter: 4
  • Buffers: shared hit=1
116. 0.000 0.000 ↓ 0.0 0

Seq Scan on internal_examination."case" case_4 (cost=0.00..35.50 rows=1 width=0) (never executed)

  • Filter: ((case_4.level_id = 3) AND (case_4.case_id = mc.id))
117. 0.009 0.009 ↑ 8.0 1 1

Seq Scan on internal_examination."case" case_5 (cost=0.00..31.25 rows=8 width=4) (actual time=0.007..0.009 rows=1 loops=1)

  • Output: case_5.case_id
  • Filter: (case_5.level_id = 3)
  • Rows Removed by Filter: 5
  • Buffers: shared hit=1
118. 0.966 0.966 ↑ 1.0 1 69

Index Scan using mc_step_result_pk on public.mc_step_result (cost=0.14..8.16 rows=1 width=158) (actual time=0.013..0.014 rows=1 loops=69)

  • Output: mc_step_result.name
  • Index Cond: (mc_step_result.id = closing_step.result_id)
  • Buffers: shared hit=135 read=3
  • I/O Timings: read=0.300
119. 0.414 0.414 ↓ 0.0 0 69

Seq Scan on internal_examination."case" case_6 (cost=0.00..35.50 rows=1 width=4) (actual time=0.006..0.006 rows=0 loops=69)

  • Output: case_6.id
  • Filter: ((case_6.level_id = 1) AND (case_6.case_id = mc.id))
  • Rows Removed by Filter: 6
  • Buffers: shared hit=69
120. 0.207 0.207 ↓ 0.0 0 69

Seq Scan on internal_examination."case" case_7 (cost=0.00..35.50 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=69)

  • Output: case_7.id
  • Filter: ((case_7.level_id = 2) AND (case_7.case_id = mc.id))
  • Rows Removed by Filter: 6
  • Buffers: shared hit=69
121. 0.207 0.207 ↓ 0.0 0 69

Seq Scan on internal_examination."case" case_8 (cost=0.00..35.50 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=69)

  • Output: case_8.id
  • Filter: ((case_8.level_id = 3) AND (case_8.case_id = mc.id))
  • Rows Removed by Filter: 6
  • Buffers: shared hit=69
122. 0.207 0.207 ↓ 0.0 0 69

Seq Scan on internal_examination."case" case_9 (cost=0.00..35.50 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=69)

  • Output: case_9.expert_id
  • Filter: ((case_9.level_id = 1) AND (case_9.case_id = mc.id))
  • Rows Removed by Filter: 6
  • Buffers: shared hit=69
123. 0.207 0.207 ↓ 0.0 0 69

Seq Scan on internal_examination."case" case_10 (cost=0.00..35.50 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=69)

  • Output: case_10.expert_id
  • Filter: ((case_10.level_id = 2) AND (case_10.case_id = mc.id))
  • Rows Removed by Filter: 6
  • Buffers: shared hit=69
124. 0.207 0.207 ↓ 0.0 0 69

Seq Scan on internal_examination."case" case_11 (cost=0.00..35.50 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=69)

  • Output: case_11.expert_id
  • Filter: ((case_11.level_id = 3) AND (case_11.case_id = mc.id))
  • Rows Removed by Filter: 6
  • Buffers: shared hit=69
125. 0.276 0.276 ↓ 0.0 0 69

Seq Scan on internal_examination."case" case_12 (cost=0.00..35.50 rows=1 width=4) (actual time=0.003..0.004 rows=0 loops=69)

  • Output: case_12.expert_id
  • Filter: ((case_12.level_id = 1) AND (case_12.case_id = mc.id))
  • Rows Removed by Filter: 6
  • Buffers: shared hit=69
126. 0.276 0.276 ↓ 0.0 0 69

Seq Scan on internal_examination."case" case_13 (cost=0.00..35.50 rows=1 width=4) (actual time=0.003..0.004 rows=0 loops=69)

  • Output: case_13.expert_id
  • Filter: ((case_13.level_id = 2) AND (case_13.case_id = mc.id))
  • Rows Removed by Filter: 6
  • Buffers: shared hit=69
127. 0.207 0.207 ↓ 0.0 0 69

Seq Scan on internal_examination."case" case_14 (cost=0.00..35.50 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=69)

  • Output: case_14.expert_id
  • Filter: ((case_14.level_id = 3) AND (case_14.case_id = mc.id))
  • Rows Removed by Filter: 6
  • Buffers: shared hit=69
128. 0.207 1.311 ↑ 1.0 1 69

Nested Loop (cost=0.85..16.90 rows=1 width=4) (actual time=0.018..0.019 rows=1 loops=69)

  • Output: md.id
  • Buffers: shared hit=486
129. 0.690 0.690 ↑ 1.0 1 69

Index Scan using mc_diagnosis_pk on public.mc_diagnosis diag (cost=0.56..8.58 rows=1 width=4) (actual time=0.009..0.010 rows=1 loops=69)

  • Output: diag.diagnos_id
  • Index Cond: (diag.id = mc.main_diagnos_id)
  • Buffers: shared hit=345
130. 0.414 0.414 ↑ 1.0 1 69

Index Only Scan using md_diagnosis_pk on public.md_diagnosis md (cost=0.29..8.30 rows=1 width=4) (actual time=0.006..0.006 rows=1 loops=69)

  • Output: md.id
  • Index Cond: (md.id = diag.diagnos_id)
  • Heap Fetches: 2
  • Buffers: shared hit=141
131. 0.396 0.396 ↑ 1.0 1,178 1

Seq Scan on internal_examination.criteria_group_diagnosis (cost=0.00..18.78 rows=1,178 width=4) (actual time=0.033..0.396 rows=1,178 loops=1)

  • Output: criteria_group_diagnosis.diagnosis_id
  • Buffers: shared hit=7
Planning time : 406.407 ms
Execution time : 1,340.415 ms