explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ZTPc

Settings
# exclusive inclusive rows x rows loops node
1. 5.311 56,491.330 ↓ 0.0 0 1

GroupAggregate (cost=21,105,868.23..21,105,868.27 rows=1 width=597) (actual time=56,491.330..56,491.330 rows=0 loops=1)

  • Output: array_agg(t.id ORDER BY t.close_date DESC, t.sid DESC), t.spec, ("substring"((t.code)::text, 1, 3)), t.patient_id, t.exeption_flag, t.goal_id_arr
  • Group Key: t.spec, ("substring"((t.code)::text, 1, 3)), t.patient_id, t.exeption_flag, t.goal_id_arr
  • Filter: (count(t.id) > 1)
  • Rows Removed by Filter: 1
  • Buffers: shared hit=1285468 read=1 dirtied=149, temp read=63446 written=221955
  • I/O Timings: read=4.149
2.          

CTE prm

3. 0.012 0.670 ↑ 1.0 1 1

Index Scan using fin_bill_main_pkey on public.fin_bill_main (cost=0.54..8.56 rows=1 width=12) (actual time=0.668..0.670 rows=1 loops=1)

  • Output: fin_bill_main.from_date, fin_bill_main.to_date, fin_bill_main.clinic_id
  • Index Cond: (fin_bill_main.id = $0)
  • Buffers: shared hit=35
4.          

Initplan (forIndex Scan)

5. 0.658 0.658 ↑ 1.0 1 1

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

  • Output: fin_bill__get_main_bill(31)
  • Buffers: shared hit=32
6.          

CTE x

7. 0.009 0.781 ↑ 5,710.8 4 1

Nested Loop (cost=1,207.95..121,890.91 rows=22,843 width=16) (actual time=0.741..0.781 rows=4 loops=1)

  • Output: c.id, c.closing_step_id, c.patient_id, c.close_date
  • Buffers: shared hit=46
8. 0.675 0.675 ↑ 1.0 1 1

CTE Scan on prm (cost=0.00..0.02 rows=1 width=12) (actual time=0.671..0.675 rows=1 loops=1)

  • Output: prm.bd, prm.ed, prm.cln
  • Buffers: shared hit=35
9. 0.061 0.097 ↑ 5,710.8 4 1

Bitmap Heap Scan on public.mc_case c (cost=1,207.95..121,662.46 rows=22,843 width=20) (actual time=0.063..0.097 rows=4 loops=1)

  • Output: c.id, c.closing_step_id, c.patient_id, c.close_date, c.clinic_id
  • Recheck Cond: ((c.clinic_id = prm.cln) AND (c.close_date >= prm.bd) AND (c.close_date <= prm.ed) AND (c.closing_step_id IS NOT NULL))
  • Filter: ((c.care_regimen_id <> ALL ('{3,5}'::integer[])) AND (c.init_goal_id = 1) AND (c.case_type_id = 1))
  • Rows Removed by Filter: 5
  • Heap Blocks: exact=7
  • Buffers: shared hit=11
10. 0.036 0.036 ↑ 4,139.3 9 1

Bitmap Index Scan on mc_case_clinic_id_close_date_idx (cost=0.00..1,202.24 rows=37,254 width=0) (actual time=0.036..0.036 rows=9 loops=1)

  • Index Cond: ((c.clinic_id = prm.cln) AND (c.close_date >= prm.bd) AND (c.close_date <= prm.ed))
  • Buffers: shared hit=4
11.          

CTE y

12. 0.317 56,481.141 ↑ 571.2 4 1

HashAggregate (cost=20,983,614.41..20,983,682.96 rows=2,285 width=158) (actual time=56,481.123..56,481.141 rows=4 loops=1)

  • Output: x.id, x.closing_step_id, x.patient_id, x.close_date, array_agg(m.id), array_agg(v.code), array_agg(CASE WHEN ((v.name)::text ~ 'аппаратное лечение|сурдолога-отор'::text) THEN '1'::text ELSE '0'::text END), array_agg(COALESCE(v.type_id, 2)), array_cat(array_agg(s.res_group_id), array_agg(ms.res_group_id)), array_agg(ms.id)
  • Group Key: x.id, x.closing_step_id, x.patient_id, x.close_date
  • Buffers: shared hit=1283973 dirtied=149, temp read=63446 written=221955
13. 0.058 56,480.824 ↑ 21,132,127.0 9 1

Merge Join (cost=11,018,515.20..15,277,940.12 rows=190,189,143 width=158) (actual time=56,480.772..56,480.824 rows=9 loops=1)

  • Output: x.id, x.closing_step_id, x.patient_id, x.close_date, m.id, s.res_group_id, v.code, v.name, v.type_id, ms.res_group_id, ms.id
  • Merge Cond: (ms.case_id = m.case_id)
  • Buffers: shared hit=1283973 dirtied=149, temp read=63446 written=221955
14. 0.166 0.166 ↑ 192,446.2 148 1

Index Scan using idx_mc_step on public.mc_step ms (cost=0.44..1,479,481.34 rows=28,482,036 width=12) (actual time=0.029..0.166 rows=148 loops=1)

  • Output: ms.id, ms.admission_date, ms.admission_time, ms.death_date, ms.death_time, ms.outcome_date, ms.outcome_time, ms.death_employee_id, ms.main_diagnosis_id, ms.case_id, ms.outcome_id, ms.outcome_clinic_id, ms.outcome_regimen_id, ms.regimen_id, ms.res_group_id, ms.result_id, ms.reason_id, ms.profile_id, ms.mes_id, ms.mes_quality_criterion_id, ms.is_continue, ms.is_continue_editable, ms.standard_id, ms.csg_id, ms.vmp_type_id, ms.vmp_method_id, ms.deviation_reason_id, ms.aud_who, ms.aud_when, ms.aud_source, ms.aud_who_create, ms.aud_when_create, ms.aud_source_create, ms._clinic_id, ms._patient_id, ms.planned_date_closing_case, ms.gestational_age, ms.onko_stage, ms.hsp_bed_profile_id, ms.is_first_step
  • Buffers: shared hit=100
15. 0.012 56,480.600 ↑ 2,167,454.3 9 1

Materialize (cost=11,018,321.81..11,115,857.26 rows=19,507,089 width=154) (actual time=56,480.593..56,480.600 rows=9 loops=1)

  • Output: x.id, x.closing_step_id, x.patient_id, x.close_date, m.id, m.case_id, s.res_group_id, v.code, v.name, v.type_id
  • Buffers: shared hit=1283873 dirtied=149, temp read=63446 written=221955
16. 0.046 56,480.588 ↑ 3,251,181.5 6 1

Sort (cost=11,018,321.81..11,067,089.54 rows=19,507,089 width=154) (actual time=56,480.586..56,480.588 rows=6 loops=1)

  • Output: x.id, x.closing_step_id, x.patient_id, x.close_date, m.id, m.case_id, s.res_group_id, v.code, v.name, v.type_id
  • Sort Key: x.id
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=1283873 dirtied=149, temp read=63446 written=221955
17. 2.821 56,480.542 ↑ 3,251,181.5 6 1

Hash Join (cost=2,223,796.04..7,122,739.65 rows=19,507,089 width=154) (actual time=3,562.609..56,480.542 rows=6 loops=1)

  • Output: x.id, x.closing_step_id, x.patient_id, x.close_date, m.id, m.case_id, s.res_group_id, v.code, v.name, v.type_id
  • Hash Cond: (s.service_id = v.id)
  • Buffers: shared hit=1283873 dirtied=149, temp read=63446 written=221955
18. 37,354.081 56,112.362 ↑ 3,259,438.7 6 1

Hash Join (cost=2,180,828.89..6,811,364.24 rows=19,556,632 width=32) (actual time=3,194.496..56,112.362 rows=6 loops=1)

  • Output: x.id, x.closing_step_id, x.patient_id, x.close_date, m.id, m.case_id, s.res_group_id, s.service_id
  • Hash Cond: (s.id = m.id)
  • Buffers: shared hit=1250474 dirtied=149, temp read=63446 written=221955
19. 18,123.882 18,123.882 ↓ 1.0 64,969,440 1

Seq Scan on public.sr_srv_rendered s (cost=0.00..1,899,918.54 rows=64,951,254 width=12) (actual time=0.006..18,123.882 rows=64,969,440 loops=1)

  • Output: s.res_group_id, s.id, s.service_id
  • Buffers: shared hit=1250406 dirtied=149
20. 633.529 634.399 ↑ 3,259,749.2 6 1

Hash (cost=1,821,746.71..1,821,746.71 rows=19,558,495 width=24) (actual time=634.399..634.399 rows=6 loops=1)

  • Output: x.id, x.closing_step_id, x.patient_id, x.close_date, m.id, m.case_id
  • Buckets: 4194304 Batches: 8 Memory Usage: 32769kB
  • Buffers: shared hit=68
21. 0.018 0.870 ↑ 3,259,749.2 6 1

Nested Loop (cost=0.56..1,821,746.71 rows=19,558,495 width=24) (actual time=0.765..0.870 rows=6 loops=1)

  • Output: x.id, x.closing_step_id, x.patient_id, x.close_date, m.id, m.case_id
  • Buffers: shared hit=68
22. 0.788 0.788 ↑ 5,710.8 4 1

CTE Scan on x (cost=0.00..456.86 rows=22,843 width=16) (actual time=0.744..0.788 rows=4 loops=1)

  • Output: x.id, x.closing_step_id, x.patient_id, x.close_date
  • Buffers: shared hit=46
23. 0.064 0.064 ↑ 428.0 2 4

Index Scan using md_srv_rendered_case_id_idx on public.md_srv_rendered m (cost=0.56..71.17 rows=856 width=8) (actual time=0.011..0.016 rows=2 loops=4)

  • Output: m.id, m.is_urgent, m.is_use_cryogenic, m.is_use_endoscopic, m.is_use_laser, m.anesthesia_type_id, m.step_id, m.complication_type_id, m.diagnosis_id, m.case_id, m.referral_id, m.result_category_id, m.patient_prescription_id, m.health_group_id, m.vmp_type_id, m.vmp_method_id, m.anatomic_zone_id, m.aud_who, m.aud_when, m.aud_source, m.aud_who_create, m.aud_when_create, m.aud_source_create, m.prescription_id, m.by_standard, m.complicated_value, m.vmp_profile_id
  • Index Cond: (m.case_id = x.id)
  • Buffers: shared hit=22
24. 178.884 365.359 ↓ 1.0 426,040 1

Hash (cost=37,651.51..37,651.51 rows=425,251 width=130) (actual time=365.359..365.359 rows=426,040 loops=1)

  • Output: v.code, v.name, v.type_id, v.id
  • Buckets: 524288 Batches: 1 Memory Usage: 72546kB
  • Buffers: shared hit=33399
25. 186.475 186.475 ↓ 1.0 426,040 1

Seq Scan on public.sr_service v (cost=0.00..37,651.51 rows=425,251 width=130) (actual time=0.011..186.475 rows=426,040 loops=1)

  • Output: v.code, v.name, v.type_id, v.id
  • Buffers: shared hit=33399
26.          

CTE z

27. 0.034 56,481.415 ↑ 1.0 1 1

Nested Loop Anti Join (cost=1.31..86.93 rows=1 width=152) (actual time=56,481.366..56,481.415 rows=1 loops=1)

  • Output: y.id, s_1.id, y.patient_id, s_1.main_diagnosis_id, s_1.res_group_id, y.close_date, (('B01.001.003'::text = ANY ((array_remove(y.service_code_arr, NULL::character varying))::text[])) OR ('1'::text = ANY (y.service_name_arr))), y.s_res_group_id, y.sid_arr
  • Buffers: shared hit=1283997 dirtied=149, temp read=63446 written=221955
28. 0.028 56,481.349 ↑ 1.0 1 1

Nested Loop Semi Join (cost=0.88..86.26 rows=1 width=152) (actual time=56,481.301..56,481.349 rows=1 loops=1)

  • Output: y.id, y.patient_id, y.close_date, y.service_code_arr, y.service_name_arr, y.s_res_group_id, y.sid_arr, s_1.id, s_1.main_diagnosis_id, s_1.res_group_id
  • Join Filter: (t_1.id = ANY (y.type_id_arr))
  • Rows Removed by Join Filter: 15
  • Buffers: shared hit=1283993 dirtied=149, temp read=63446 written=221955
29. 0.016 56,481.304 ↑ 1.0 1 1

Nested Loop Anti Join (cost=0.88..84.48 rows=1 width=184) (actual time=56,481.256..56,481.304 rows=1 loops=1)

  • Output: y.id, y.patient_id, y.close_date, y.service_code_arr, y.service_name_arr, y.s_res_group_id, y.sid_arr, y.type_id_arr, s_1.id, s_1.main_diagnosis_id, s_1.res_group_id
  • Buffers: shared hit=1283992 dirtied=149, temp read=63446 written=221955
30. 0.022 56,481.271 ↑ 1.0 1 1

Nested Loop (cost=0.44..71.31 rows=1 width=216) (actual time=56,481.223..56,481.271 rows=1 loops=1)

  • Output: y.id, y.patient_id, y.close_date, y.service_code_arr, y.service_name_arr, y.s_res_group_id, y.sid_arr, y.srv_rendered_id_arr, y.type_id_arr, s_1.id, s_1.main_diagnosis_id, s_1.res_group_id
  • Buffers: shared hit=1283989 dirtied=149, temp read=63446 written=221955
31. 56,481.209 56,481.209 ↓ 4.0 4 1

CTE Scan on y (cost=0.00..62.84 rows=1 width=208) (actual time=56,481.175..56,481.209 rows=4 loops=1)

  • Output: y.id, y.closing_step_id, y.patient_id, y.close_date, y.srv_rendered_id_arr, y.service_code_arr, y.service_name_arr, y.type_id_arr, y.s_res_group_id, y.sid_arr
  • Filter: ((NOT ('{B01.070.06,B01.070.04,B01.070.03,B01.069.008,B01.031.006,B01.008.01.02,B01.029.01.01,B01.015.03,B01.058.03,B01.023.03,B01.057.03,B01.053.03,B01.001.06,B01.028.03,B01.031.009,B01.031.011,B01.069.002,B01.031.010}'::character varying[] && y.service_code_arr)) AND (array_to_string(y.service_code_arr, ','::text) !~~ '%A%'::text))
  • Buffers: shared hit=1283973 dirtied=149, temp read=63446 written=221955
32. 0.040 0.040 ↓ 0.0 0 4

Index Scan using mc_step_pk on public.mc_step s_1 (cost=0.44..8.46 rows=1 width=16) (actual time=0.010..0.010 rows=0 loops=4)

  • Output: s_1.id, s_1.admission_date, s_1.admission_time, s_1.death_date, s_1.death_time, s_1.outcome_date, s_1.outcome_time, s_1.death_employee_id, s_1.main_diagnosis_id, s_1.case_id, s_1.outcome_id, s_1.outcome_clinic_id, s_1.outcome_regimen_id, s_1.regimen_id, s_1.res_group_id, s_1.result_id, s_1.reason_id, s_1.profile_id, s_1.mes_id, s_1.mes_quality_criterion_id, s_1.is_continue, s_1.is_continue_editable, s_1.standard_id, s_1.csg_id, s_1.vmp_type_id, s_1.vmp_method_id, s_1.deviation_reason_id, s_1.aud_who, s_1.aud_when, s_1.aud_source, s_1.aud_who_create, s_1.aud_when_create, s_1.aud_source_create, s_1._clinic_id, s_1._patient_id, s_1.planned_date_closing_case, s_1.gestational_age, s_1.onko_stage, s_1.hsp_bed_profile_id, s_1.is_first_step
  • Index Cond: (s_1.id = y.closing_step_id)
  • Filter: ((y.close_date = s_1.admission_date) AND (s_1.profile_id <> ALL ('{34,35,36,37,38,39}'::integer[])))
  • Rows Removed by Filter: 1
  • Buffers: shared hit=16
33. 0.017 0.017 ↓ 0.0 0 1

Index Scan using fin_bill_spec_item_service_id_idx on public.fin_bill_spec_item i (cost=0.44..56.96 rows=8 width=4) (actual time=0.017..0.017 rows=0 loops=1)

  • Output: i.id, i.price, i.tariff, i.bill_id, i.service_id, i.number, i.is_deleted, i.comment, i.doc_id, i.status_id, i.correctional_bill_id
  • Index Cond: (i.service_id = ANY (y.srv_rendered_id_arr))
  • Filter: (i.status_id = ANY ('{1,2,3}'::integer[]))
  • Buffers: shared hit=3
34. 0.017 0.017 ↑ 1.4 16 1

Seq Scan on public.sr_srv_type t_1 (cost=0.00..1.30 rows=23 width=4) (actual time=0.014..0.017 rows=16 loops=1)

  • Output: t_1.id, t_1.code, t_1.name, t_1.priority, t_1.e_code, t_1.aud_who, t_1.aud_when, t_1.aud_source, t_1.aud_who_create, t_1.aud_when_create, t_1.aud_source_create, t_1.from_dt, t_1.to_dt, t_1.is_physical, t_1.is_surgery, t_1.app_code, t_1.is_procedure, t_1.is_require_evaluation
  • Filter: ((COALESCE(t_1.code, ''::character varying))::text <> 'APPOINTMENT'::text)
  • Rows Removed by Filter: 1
  • Buffers: shared hit=1
35. 0.032 0.032 ↓ 0.0 0 1

Index Scan using plc_visit_pk on public.plc_visit p (cost=0.44..0.54 rows=1 width=4) (actual time=0.032..0.032 rows=0 loops=1)

  • Output: p.id, p.duration, p.goal_id, p.initiator_id, p.place_id, p.type_id, p.is_viewed, p.is_needed, p.is_sanitized, p.aud_who, p.aud_when, p.aud_source, p.aud_who_create, p.aud_when_create, p.aud_source_create, p.dental_formula_id, p.appointment_id, p.planned_date
  • Index Cond: (p.id = s_1.id)
  • Filter: (((p.goal_id = 1) AND (p.place_id = 4)) OR ((p.goal_id = 5) AND (p.place_id = 2)) OR ((p.goal_id = 5) AND (p.place_id = 4)))
  • Rows Removed by Filter: 1
  • Buffers: shared hit=4
36.          

CTE t

37. 0.009 56,485.935 ↑ 1.0 1 1

Nested Loop (cost=190.71..198.84 rows=1 width=158) (actual time=56,485.882..56,485.935 rows=1 loops=1)

  • Output: z.id, z.sid, z.patient_id, z.main_diagnosis_id, z.res_group_id, z.close_date, z.exeption_flag, z.s_res_group_id, z.sid_arr, (array_agg(DISTINCT btrim((ps.code)::text))), d.code, (array_agg(DISTINCT pv.goal_id ORDER BY pv.goal_id))
  • Buffers: shared hit=1284022 read=1 dirtied=149, temp read=63446 written=221955
  • I/O Timings: read=4.149
38. 0.012 56,481.558 ↑ 1.0 1 1

Nested Loop (cost=49.56..57.66 rows=1 width=126) (actual time=56,481.506..56,481.558 rows=1 loops=1)

  • Output: z.id, z.sid, z.patient_id, z.main_diagnosis_id, z.res_group_id, z.close_date, z.exeption_flag, z.s_res_group_id, z.sid_arr, d.code, (array_agg(DISTINCT pv.goal_id ORDER BY pv.goal_id))
  • Buffers: shared hit=1284009 dirtied=149, temp read=63446 written=221955
39. 0.018 56,481.493 ↑ 1.0 1 1

Nested Loop (cost=0.85..8.93 rows=1 width=94) (actual time=56,481.441..56,481.493 rows=1 loops=1)

  • Output: z.id, z.sid, z.patient_id, z.main_diagnosis_id, z.res_group_id, z.close_date, z.exeption_flag, z.s_res_group_id, z.sid_arr, d.code
  • Buffers: shared hit=1284005 dirtied=149, temp read=63446 written=221955
40. 0.016 56,481.457 ↑ 1.0 1 1

Nested Loop (cost=0.56..8.61 rows=1 width=93) (actual time=56,481.407..56,481.457 rows=1 loops=1)

  • Output: z.id, z.sid, z.patient_id, z.main_diagnosis_id, z.res_group_id, z.close_date, z.exeption_flag, z.s_res_group_id, z.sid_arr, md.diagnos_id
  • Buffers: shared hit=1284002 dirtied=149, temp read=63446 written=221955
41. 56,481.420 56,481.420 ↑ 1.0 1 1

CTE Scan on z (cost=0.00..0.02 rows=1 width=89) (actual time=56,481.371..56,481.420 rows=1 loops=1)

  • Output: z.id, z.sid, z.patient_id, z.main_diagnosis_id, z.res_group_id, z.close_date, z.exeption_flag, z.s_res_group_id, z.sid_arr
  • Buffers: shared hit=1283997 dirtied=149, temp read=63446 written=221955
42. 0.021 0.021 ↑ 1.0 1 1

Index Scan using mc_diagnosis_pk on public.mc_diagnosis md (cost=0.56..8.58 rows=1 width=8) (actual time=0.021..0.021 rows=1 loops=1)

  • Output: md.id, md.diagnos_id
  • Index Cond: (md.id = z.main_diagnosis_id)
  • Buffers: shared hit=5
43. 0.018 0.018 ↑ 1.0 1 1

Index Scan using md_diagnosis_pk on public.md_diagnosis d (cost=0.29..0.30 rows=1 width=9) (actual time=0.018..0.018 rows=1 loops=1)

  • Output: d.id, d.code, d.name, d.parent_id, d.is_injury, d.level, d.is_leaf, d.e_code, d.oms, d.stomat, d.aud_who, d.aud_when, d.aud_source, d.aud_who_create, d.aud_when_create, d.aud_source_create, d.from_dt, d.to_dt
  • Index Cond: (d.id = md.diagnos_id)
  • Buffers: shared hit=3
44. 0.049 0.053 ↑ 1.0 1 1

Aggregate (cost=48.71..48.72 rows=1 width=4) (actual time=0.053..0.053 rows=1 loops=1)

  • Output: array_agg(DISTINCT pv.goal_id ORDER BY pv.goal_id)
  • Buffers: shared hit=4
45. 0.004 0.004 ↑ 10.0 1 1

Index Scan using plc_visit_pk on public.plc_visit pv (cost=0.44..48.68 rows=10 width=4) (actual time=0.004..0.004 rows=1 loops=1)

  • Output: pv.id, pv.duration, pv.goal_id, pv.initiator_id, pv.place_id, pv.type_id, pv.is_viewed, pv.is_needed, pv.is_sanitized, pv.aud_who, pv.aud_when, pv.aud_source, pv.aud_who_create, pv.aud_when_create, pv.aud_source_create, pv.dental_formula_id, pv.appointment_id, pv.planned_date
  • Index Cond: (pv.id = ANY (z.sid_arr))
  • Buffers: shared hit=4
46. 0.056 4.368 ↑ 1.0 1 1

Aggregate (cost=141.15..141.16 rows=1 width=7) (actual time=4.367..4.368 rows=1 loops=1)

  • Output: array_agg(DISTINCT btrim((ps.code)::text))
  • Filter: ('{040122,040110,040200}'::text[] && array_agg(DISTINCT btrim((ps.code)::text)))
  • Buffers: shared hit=13 read=1
  • I/O Timings: read=4.149
47. 0.011 4.312 ↑ 6.0 1 1

Nested Loop (cost=1.41..141.08 rows=6 width=7) (actual time=4.309..4.312 rows=1 loops=1)

  • Output: ps.code
  • Buffers: shared hit=13 read=1
  • I/O Timings: read=4.149
48. 0.012 4.287 ↑ 10.0 1 1

Nested Loop (cost=1.14..138.08 rows=10 width=4) (actual time=4.285..4.287 rows=1 loops=1)

  • Output: pp.speciality_id
  • Buffers: shared hit=10 read=1
  • I/O Timings: read=4.149
49. 0.032 4.235 ↑ 10.0 1 1

Nested Loop (cost=0.85..134.52 rows=10 width=4) (actual time=4.233..4.235 rows=1 loops=1)

  • Output: pep.position_id
  • Buffers: shared hit=7 read=1
  • I/O Timings: read=4.149
50. 4.182 4.182 ↑ 10.0 1 1

Index Scan using sr_res_group_pk on public.sr_res_group srg (cost=0.56..51.34 rows=10 width=4) (actual time=4.181..4.182 rows=1 loops=1)

  • Output: srg.id, srg.bdate, srg.edate, srg.is_system, srg.name, srg.department_id, srg.org_id, srg.responsible_id, srg.is_available_in_electronic_queue, srg.label_id, srg.ignore_regclinic_check, srg.note, srg.blocked, srg.block_comment, srg.template_res_group_id, srg.aud_who, srg.aud_when, srg.aud_source, srg.aud_who_create, srg.aud_when_create, srg.aud_source_create, srg.emergency, srg.ignore_districts, srg.service_template_id
  • Index Cond: (srg.id = ANY (z.s_res_group_id))
  • Buffers: shared hit=4 read=1
  • I/O Timings: read=4.149
51. 0.021 0.021 ↑ 1.0 1 1

Index Scan using pim_employee_position_pk on public.pim_employee_position pep (cost=0.29..8.31 rows=1 width=8) (actual time=0.021..0.021 rows=1 loops=1)

  • Output: pep.id, pep.dismissal_order_code, pep.start_date, pep.hiring_order_code, pep.rate, pep.end_date, pep.dismissal_reason_id, pep.employee_id, pep.employment_type_id, pep.hiring_type_id, pep.position_id, pep.position_type_id, pep.unit_id, pep.code, pep.aud_who, pep.aud_when, pep.aud_source, pep.aud_who_create, pep.aud_when_create, pep.aud_source_create, pep.pref_prescription, pep.extra_payment, pep.target_training, pep.leaving_reason_id
  • Index Cond: (pep.id = srg.responsible_id)
  • Buffers: shared hit=3
52. 0.040 0.040 ↑ 1.0 1 1

Index Scan using pim_position_pk on public.pim_position pp (cost=0.29..0.35 rows=1 width=8) (actual time=0.040..0.040 rows=1 loops=1)

  • Output: pp.id, pp.code, pp.start_date, pp.name, pp.end_date, pp.department_id, pp.organization_id, pp.role_id, pp.speciality_id, pp.rate, pp.aud_who, pp.aud_when, pp.aud_source, pp.aud_who_create, pp.aud_when_create, pp.aud_source_create, pp.pref_prescription, pp.payment_fond, pp.staff_event1, pp.staff_event2, pp.note, pp.fact_employment, pp.external_rate
  • Index Cond: (pp.id = pep.position_id)
  • Buffers: shared hit=3
53. 0.014 0.014 ↑ 1.0 1 1

Index Scan using pim_speciality_pk on public.pim_speciality ps (cost=0.27..0.29 rows=1 width=11) (actual time=0.013..0.014 rows=1 loops=1)

  • Output: ps.id, ps.code, ps.code_regional, ps.name, ps.sphere_id, ps.parent_id, ps.education_type_id, ps.e_code, ps.aud_who, ps.aud_when, ps.aud_source, ps.aud_who_create, ps.aud_when_create, ps.aud_source_create, ps.from_dt, ps.to_dt
  • Index Cond: (ps.id = pp.speciality_id)
  • Buffers: shared hit=3
54. 0.067 56,486.019 ↑ 1.0 1 1

Sort (cost=0.03..0.04 rows=1 width=597) (actual time=56,486.018..56,486.019 rows=1 loops=1)

  • Output: t.spec, ("substring"((t.code)::text, 1, 3)), t.patient_id, t.exeption_flag, t.goal_id_arr, t.id, t.close_date, t.sid
  • Sort Key: t.spec, ("substring"((t.code)::text, 1, 3)), t.patient_id, t.exeption_flag, t.goal_id_arr
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=1284035 read=1 dirtied=149, temp read=63446 written=221955
  • I/O Timings: read=4.149
55. 56,485.952 56,485.952 ↑ 1.0 1 1

CTE Scan on t (cost=0.00..0.02 rows=1 width=597) (actual time=56,485.899..56,485.952 rows=1 loops=1)

  • Output: t.spec, "substring"((t.code)::text, 1, 3), t.patient_id, t.exeption_flag, t.goal_id_arr, t.id, t.close_date, t.sid
  • Buffers: shared hit=1284022 read=1 dirtied=149, temp read=63446 written=221955
  • I/O Timings: read=4.149
Planning time : 20.254 ms
Execution time : 56,500.986 ms