explain.depesz.com

PostgreSQL's explain analyze made readable

Result: jBub

Settings
# exclusive inclusive rows x rows loops node
1. 0.106 50,821.488 ↑ 1.0 50 1

Limit (cost=193.26..21,821.19 rows=50 width=725) (actual time=46,796.730..50,821.488 rows=50 loops=1)

  • Output: c.id, o.short_name, ct.name, c.uid, (concat(i.surname, ' ', i.name, ' ', i.patr_name)), c.open_date, lst.outcome_date, (translate(concat(d.code, ' ', d.name), '[]'::text, '()'::text)), sr.name, cr.name, (CASE WHEN (sie.item_id IS NOT NULL) THEN true ELSE false END), sie.error, lst.csg_id, c.note, ((alternatives: SubPlan 1 or hashed SubPlan 2)), ((alternatives: SubPlan 3 or hashed SubPlan 4)), (concat(i2.surname, ' ', i2.name, ' ', i2.patr_name)), (sum(ssi.price)), (adr__get_element_as_text(ppa.addr_id, '(3,s,1)(4,s,1)(5,s,1)(6,s,1)(7,s,1)(8,s,1)'::text))
  • Buffers: shared hit=144615 read=80663 dirtied=10
  • I/O Timings: read=40858.246
2. 4,086.622 50,821.382 ↑ 513.8 50 1

Result (cost=193.26..11,111,761.39 rows=25,688 width=725) (actual time=46,796.721..50,821.382 rows=50 loops=1)

  • Output: c.id, o.short_name, ct.name, c.uid, (concat(i.surname, ' ', i.name, ' ', i.patr_name)), c.open_date, lst.outcome_date, (translate(concat(d.code, ' ', d.name), '[]'::text, '()'::text)), sr.name, cr.name, (CASE WHEN (sie.item_id IS NOT NULL) THEN true ELSE false END), sie.error, lst.csg_id, c.note, (alternatives: SubPlan 1 or hashed SubPlan 2), (alternatives: SubPlan 3 or hashed SubPlan 4), (concat(i2.surname, ' ', i2.name, ' ', i2.patr_name)), (sum(ssi.price)), adr__get_element_as_text(ppa.addr_id, '(3,s,1)(4,s,1)(5,s,1)(6,s,1)(7,s,1)(8,s,1)'::text)
  • Buffers: shared hit=144615 read=80663 dirtied=10
  • I/O Timings: read=40858.246
3. 0.183 2,632.798 ↑ 513.8 50 1

Unique (cost=193.26..9,574,933.49 rows=25,688 width=699) (actual time=14.392..2,632.798 rows=50 loops=1)

  • Output: c.id, o.short_name, ct.name, c.uid, (concat(i.surname, ' ', i.name, ' ', i.patr_name)), c.open_date, lst.outcome_date, (translate(concat(d.code, ' ', d.name), '[]'::text, '()'::text)), sr.name, cr.name, (CASE WHEN (sie.item_id IS NOT NULL) THEN true ELSE false END), sie.error, lst.csg_id, c.note, (concat(i2.surname, ' ', i2.name, ' ', i2.patr_name)), (sum(ssi.price)), i.id, ppa.addr_id
  • Buffers: shared hit=5117 read=2489
  • I/O Timings: read=2566.618
4. 1.728 2,632.615 ↑ 256.9 100 1

Nested Loop Left Join (cost=193.26..9,574,869.27 rows=25,688 width=699) (actual time=14.390..2,632.615 rows=100 loops=1)

  • Output: c.id, o.short_name, ct.name, c.uid, concat(i.surname, ' ', i.name, ' ', i.patr_name), c.open_date, lst.outcome_date, translate(concat(d.code, ' ', d.name), '[]'::text, '()'::text), sr.name, cr.name, CASE WHEN (sie.item_id IS NOT NULL) THEN true ELSE false END, sie.error, lst.csg_id, c.note, concat(i2.surname, ' ', i2.name, ' ', i2.patr_name), (sum(ssi.price)), i.id, ppa.addr_id
  • Buffers: shared hit=5117 read=2489
  • I/O Timings: read=2566.618
5. 0.204 2,627.487 ↑ 256.9 100 1

Nested Loop Left Join (cost=6.14..4,767,266.85 rows=25,688 width=751) (actual time=14.348..2,627.487 rows=100 loops=1)

  • Output: c.id, c.uid, c.open_date, c.note, o.short_name, ct.name, i.surname, i.name, i.patr_name, i.id, ppa.addr_id, lst.outcome_date, lst.csg_id, d.code, d.name, sr.name, cr.name, sie.item_id, sie.error, i2.surname, i2.name, i2.patr_name
  • Buffers: shared hit=4305 read=2487
  • I/O Timings: read=2564.553
6. 0.217 2,627.283 ↑ 256.9 100 1

Nested Loop Left Join (cost=5.72..4,595,964.40 rows=25,688 width=706) (actual time=14.347..2,627.283 rows=100 loops=1)

  • Output: c.id, c.uid, c.open_date, c.note, o.short_name, ct.name, i.surname, i.name, i.patr_name, i.id, ppa.addr_id, lst.outcome_date, lst.csg_id, d.code, d.name, sr.name, cr.name, sie.item_id, sie.error, e.individual_id
  • Buffers: shared hit=4305 read=2487
  • I/O Timings: read=2564.553
7. 0.204 2,627.066 ↑ 256.9 100 1

Nested Loop Left Join (cost=5.43..4,463,949.79 rows=25,688 width=706) (actual time=14.345..2,627.066 rows=100 loops=1)

  • Output: c.id, c.uid, c.open_date, c.note, o.short_name, ct.name, i.surname, i.name, i.patr_name, i.id, ppa.addr_id, lst.outcome_date, lst.csg_id, d.code, d.name, sr.name, cr.name, sie.item_id, sie.error, pep.employee_id
  • Buffers: shared hit=4305 read=2487
  • I/O Timings: read=2564.553
8. 0.212 2,626.862 ↑ 256.9 100 1

Nested Loop Left Join (cost=5.15..4,331,675.72 rows=25,688 width=706) (actual time=14.342..2,626.862 rows=100 loops=1)

  • Output: c.id, c.uid, c.open_date, c.note, o.short_name, ct.name, i.surname, i.name, i.patr_name, i.id, ppa.addr_id, lst.outcome_date, lst.csg_id, d.code, d.name, sr.name, cr.name, sie.item_id, sie.error, srg.responsible_id
  • Buffers: shared hit=4305 read=2487
  • I/O Timings: read=2564.553
9. 0.179 2,626.650 ↑ 256.9 100 1

Nested Loop Left Join (cost=4.71..4,190,834.35 rows=25,688 width=706) (actual time=14.341..2,626.650 rows=100 loops=1)

  • Output: c.id, c.uid, c.open_date, c.note, o.short_name, ct.name, i.surname, i.name, i.patr_name, i.id, ppa.addr_id, lst.outcome_date, lst.csg_id, lst.res_group_id, d.code, d.name, sr.name, cr.name, sie.item_id, sie.error
  • Buffers: shared hit=4305 read=2487
  • I/O Timings: read=2564.553
10. 0.166 2,626.471 ↑ 256.9 100 1

Nested Loop Left Join (cost=4.28..4,004,288.42 rows=25,688 width=607) (actual time=14.339..2,626.471 rows=100 loops=1)

  • Output: c.id, c.uid, c.open_date, c.note, o.short_name, ct.name, i.surname, i.name, i.patr_name, i.id, ppa.addr_id, lst.outcome_date, lst.csg_id, lst.res_group_id, d.code, d.name, sr.name, cr.name, si.id
  • Buffers: shared hit=4305 read=2487
  • I/O Timings: read=2564.553
11. 0.207 2,624.105 ↑ 256.9 100 1

Nested Loop Left Join (cost=3.85..3,864,443.11 rows=25,688 width=607) (actual time=14.326..2,624.105 rows=100 loops=1)

  • Output: c.id, c.uid, c.open_date, c.note, o.short_name, ct.name, i.surname, i.name, i.patr_name, i.id, ppa.addr_id, lst.outcome_date, lst.csg_id, lst.res_group_id, d.code, d.name, sr.name, cr.name, mr.id
  • Buffers: shared hit=4017 read=2478
  • I/O Timings: read=2563.095
12. 1.934 2,505.416 ↑ 89.3 98 1

Nested Loop Left Join (cost=3.28..3,803,852.64 rows=8,751 width=603) (actual time=14.303..2,505.416 rows=98 loops=1)

  • Output: c.id, c.uid, c.open_date, c.note, o.short_name, ct.name, i.surname, i.name, i.patr_name, i.id, ppa.addr_id, lst.outcome_date, lst.csg_id, lst.res_group_id, d.code, d.name, sr.name, cr.name
  • Join Filter: (cr.id = lst.outcome_id)
  • Rows Removed by Join Filter: 10094
  • Buffers: shared hit=3595 read=2407
  • I/O Timings: read=2445.882
13. 3.884 2,502.012 ↑ 89.3 98 1

Nested Loop Left Join (cost=3.28..3,790,328.06 rows=8,751 width=489) (actual time=14.177..2,502.012 rows=98 loops=1)

  • Output: c.id, c.uid, c.open_date, c.note, o.short_name, ct.name, i.surname, i.name, i.patr_name, i.id, ppa.addr_id, lst.outcome_date, lst.csg_id, lst.outcome_id, lst.res_group_id, d.code, d.name, sr.name
  • Join Filter: (sr.id = lst.result_id)
  • Rows Removed by Join Filter: 17346
  • Buffers: shared hit=3592 read=2407
  • I/O Timings: read=2445.882
14. 0.264 2,495.776 ↑ 89.3 98 1

Nested Loop Left Join (cost=3.28..3,767,083.94 rows=8,751 width=389) (actual time=13.972..2,495.776 rows=98 loops=1)

  • Output: c.id, c.uid, c.open_date, c.note, o.short_name, ct.name, i.surname, i.name, i.patr_name, i.id, ppa.addr_id, lst.outcome_date, lst.csg_id, lst.result_id, lst.outcome_id, lst.res_group_id, d.code, d.name
  • Buffers: shared hit=3584 read=2407
  • I/O Timings: read=2445.882
15. 0.230 2,477.088 ↑ 89.3 98 1

Nested Loop Left Join (cost=3.00..3,721,742.94 rows=8,751 width=314) (actual time=13.958..2,477.088 rows=98 loops=1)

  • Output: c.id, c.uid, c.open_date, c.note, o.short_name, ct.name, i.surname, i.name, i.patr_name, i.id, ppa.addr_id, lst.outcome_date, lst.csg_id, lst.result_id, lst.outcome_id, lst.res_group_id, md.diagnos_id
  • Buffers: shared hit=3310 read=2393
  • I/O Timings: read=2428.541
16. 0.155 2,426.192 ↑ 89.3 98 1

Nested Loop Left Join (cost=2.56..3,667,545.55 rows=8,751 width=314) (actual time=13.939..2,426.192 rows=98 loops=1)

  • Output: c.id, c.uid, c.open_date, c.note, c.main_diagnos_id, o.short_name, ct.name, i.surname, i.name, i.patr_name, i.id, ppa.addr_id, lst.outcome_date, lst.csg_id, lst.result_id, lst.outcome_id, lst.res_group_id
  • Buffers: shared hit=2978 read=2341
  • I/O Timings: read=2379.269
17. 0.129 1,944.387 ↑ 115.4 50 1

Nested Loop (cost=1.71..3,591,876.63 rows=5,772 width=310) (actual time=13.898..1,944.387 rows=50 loops=1)

  • Output: c.id, c.uid, c.open_date, c.note, c.main_diagnos_id, o.short_name, ct.name, i.surname, i.name, i.patr_name, i.id, lst.outcome_date, lst.csg_id, lst.result_id, lst.outcome_id, lst.res_group_id
  • Buffers: shared hit=2746 read=2128
  • I/O Timings: read=1900.552
18. 0.188 1,896.608 ↑ 115.4 50 1

Nested Loop (cost=1.28..3,560,333.43 rows=5,772 width=261) (actual time=13.803..1,896.608 rows=50 loops=1)

  • Output: c.id, c.uid, c.open_date, c.note, c.patient_id, c.main_diagnos_id, o.short_name, ct.name, lst.outcome_date, lst.csg_id, lst.result_id, lst.outcome_id, lst.res_group_id
  • Join Filter: (c.case_type_id = ct.id)
  • Rows Removed by Join Filter: 449
  • Buffers: shared hit=2638 read=2035
  • I/O Timings: read=1854.096
19. 0.133 1,896.270 ↑ 115.4 50 1

Nested Loop (cost=1.28..3,559,466.51 rows=5,772 width=206) (actual time=13.783..1,896.270 rows=50 loops=1)

  • Output: c.id, c.uid, c.open_date, c.note, c.case_type_id, c.patient_id, c.main_diagnos_id, o.short_name, lst.outcome_date, lst.csg_id, lst.result_id, lst.outcome_id, lst.res_group_id
  • Buffers: shared hit=2637 read=2035
  • I/O Timings: read=1854.096
20. 1.265 1,896.087 ↑ 115.4 50 1

Nested Loop Left Join (cost=1.00..3,559,386.05 rows=5,772 width=159) (actual time=13.764..1,896.087 rows=50 loops=1)

  • Output: c.id, c.uid, c.open_date, c.note, c.clinic_id, c.case_type_id, c.patient_id, c.main_diagnos_id, lst.outcome_date, lst.csg_id, lst.result_id, lst.outcome_id, lst.res_group_id
  • Filter: (((lst.outcome_date >= COALESCE(to_date('01.06.2019'::text, 'dd.mm.yyyy'::text), to_date('1000-01-01'::text, 'yyyy-mm-dd'::text))) AND (lst.outcome_date <= COALESCE(to_date('01.07.2019'::text, 'dd.mm.yyyy'::text), to_date('3000-01-01'::text, 'yyyy-mm-dd'::text)))) OR (lst.outcome_date IS NULL))
  • Rows Removed by Filter: 90
  • Buffers: shared hit=2634 read=2035
  • I/O Timings: read=1854.096
21. 1,749.782 1,749.782 ↑ 1,551.7 140 1

Index Scan Backward using mc_case_pk on public.mc_case c (cost=0.43..2,166,772.16 rows=217,238 width=143) (actual time=2.808..1,749.782 rows=140 loops=1)

  • Output: c.id, c.uid, c.open_date, c.note, c.clinic_id, c.case_type_id, c.patient_id, c.closing_step_id, c.main_diagnos_id
  • Filter: ((c.clinic_id = 3311049) AND (c.open_date >= COALESCE(to_date('1000-01-01'::text, 'yyyy-mm-dd'::text))) AND (c.open_date <= COALESCE(to_date('3000-01-01'::text, 'yyyy-mm-dd'::text))))
  • Rows Removed by Filter: 3995
  • Buffers: shared hit=2282 read=1929
  • I/O Timings: read=1711.451
22. 145.040 145.040 ↑ 1.0 1 140

Index Scan using mc_step_pk on public.mc_step lst (cost=0.56..6.39 rows=1 width=24) (actual time=0.982..1.036 rows=1 loops=140)

  • Output: lst.id, lst.admission_date, lst.admission_time, lst.death_date, lst.death_time, lst.outcome_date, lst.outcome_time, lst.death_employee_id, lst.main_diagnosis_id, lst.case_id, lst.outcome_id, lst.outcome_clinic_id, lst.outcome_regimen_id, lst.regimen_id, lst.res_group_id, lst.result_id, lst.reason_id, lst.profile_id, lst.mes_id, lst.mes_quality_criterion_id, lst.is_continue, lst.is_continue_editable, lst.standard_id, lst.csg_id, lst.vmp_type_id, lst.vmp_method_id, lst.deviation_reason_id, lst.aud_who, lst.aud_when, lst.aud_source, lst.aud_who_create, lst.aud_when_create, lst.aud_source_create, lst._clinic_id, lst._patient_id, lst._case_mode_id, lst._is_last, lst._responsible_id, lst._department_id, lst.hsp_bed_days_amount, lst.hsp_bed_profile_id, lst.hsp_complexity_level_id, lst.hsp_days_comp_algo_id, lst.hsp_department_id, lst.hsp_funding_id, lst.hsp_is_admission_day_counts, lst.hsp_is_diag_not_eq, lst.hsp_is_set_diagnosis, lst.hsp_issue_planned_date, lst.hsp_mes_id, lst.hsp_missed_days_amount, lst.hsp_plan_department_id, lst.hsp_previous_id, lst.hsp_refusal_employee_id, lst.plc_goal_id, lst.plc_initiator_id, lst.plc_is_needed, lst.plc_is_sanitized, lst.plc_is_viewed, lst.plc_place_id, lst.plc_type_id, lst.plc_appointment_id, lst.plc_planned_date, lst.is_autopsy, lst.action_allowed_result_id, lst.planned_date_closing_case, lst.gestational_age, lst.onko_stage, lst.temp
  • Index Cond: (lst.id = c.closing_step_id)
  • Buffers: shared hit=352 read=106
  • I/O Timings: read=142.645
23. 0.030 0.050 ↑ 1.0 1 50

Materialize (cost=0.29..8.31 rows=1 width=55) (actual time=0.001..0.001 rows=1 loops=50)

  • Output: o.short_name, o.id
  • Buffers: shared hit=3
24. 0.020 0.020 ↑ 1.0 1 1

Index Scan using pim_organization_pk on public.pim_organization o (cost=0.29..8.30 rows=1 width=55) (actual time=0.015..0.020 rows=1 loops=1)

  • Output: o.short_name, o.id
  • Index Cond: (o.id = 3311049)
  • Buffers: shared hit=3
25. 0.134 0.150 ↑ 1.0 10 50

Materialize (cost=0.00..1.15 rows=10 width=63) (actual time=0.001..0.003 rows=10 loops=50)

  • Output: ct.name, ct.id
  • Buffers: shared hit=1
26. 0.016 0.016 ↑ 1.0 10 1

Seq Scan on public.mc_case_type ct (cost=0.00..1.10 rows=10 width=63) (actual time=0.008..0.016 rows=10 loops=1)

  • Output: ct.name, ct.id
  • Buffers: shared hit=1
27. 47.650 47.650 ↑ 1.0 1 50

Index Scan using pim_individual_pk on public.pim_individual i (cost=0.42..5.45 rows=1 width=53) (actual time=0.927..0.953 rows=1 loops=50)

  • Output: i.surname, i.name, i.patr_name, i.id
  • Index Cond: (i.id = c.patient_id)
  • Buffers: shared hit=108 read=93
  • I/O Timings: read=46.456
28. 0.346 481.650 ↓ 2.0 2 50

Nested Loop Left Join (cost=0.85..13.10 rows=1 width=8) (actual time=8.693..9.633 rows=2 loops=50)

  • Output: ppa.addr_id, ppa.party_id
  • Buffers: shared hit=232 read=213
  • I/O Timings: read=478.717
29. 120.950 120.950 ↑ 1.0 1 50

Index Scan using pim_party_address_party_id_idx on public.pim_party_address ppa (cost=0.42..5.32 rows=1 width=12) (actual time=2.301..2.419 rows=1 loops=50)

  • Output: ppa.id, ppa.from_date, ppa.note, ppa.text_addr, ppa.to_date, ppa.is_valid, ppa.addr_id, ppa.party_id, ppa.register_type_id, ppa.aud_who, ppa.aud_when, ppa.aud_source, ppa.aud_who_create, ppa.aud_when_create, ppa.aud_source_create
  • Index Cond: (ppa.party_id = i.id)
  • Buffers: shared hit=107 read=98
  • I/O Timings: read=119.845
30. 360.354 360.354 ↑ 1.0 2 57

Index Scan using pim_party_addr_to_addr_type_party_address_id_idx on public.pim_party_addr_to_addr_type pata (cost=0.43..7.76 rows=2 width=8) (actual time=5.916..6.322 rows=2 loops=57)

  • Output: pata.id, pata.address_type_id, pata.party_address_id, pata.aud_who, pata.aud_when, pata.aud_source, pata.aud_who_create, pata.aud_when_create, pata.aud_source_create
  • Index Cond: (pata.party_address_id = ppa.id)
  • Buffers: shared hit=125 read=115
  • I/O Timings: read=358.872
31. 50.666 50.666 ↑ 1.0 1 98

Index Scan using mc_diagnosis_pk on public.mc_diagnosis md (cost=0.44..6.18 rows=1 width=8) (actual time=0.516..0.517 rows=1 loops=98)

  • Output: md.id, md.diagnos_id
  • Index Cond: (md.id = c.main_diagnos_id)
  • Buffers: shared hit=332 read=52
  • I/O Timings: read=49.272
32. 18.424 18.424 ↑ 1.0 1 98

Index Scan using md_diagnosis_pk on public.md_diagnosis d (cost=0.29..5.17 rows=1 width=83) (actual time=0.188..0.188 rows=1 loops=98)

  • Output: d.id, d.code, d.name, d.parent_id, d.is_injury, d.level, d.is_leaf, d.e_code, d.from_dt, d.to_dt, 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.gender_id
  • Index Cond: (d.id = md.diagnos_id)
  • Buffers: shared hit=274 read=14
  • I/O Timings: read=17.341
33. 2.247 2.352 ↑ 1.0 177 98

Materialize (cost=0.00..10.65 rows=177 width=108) (actual time=0.001..0.024 rows=177 loops=98)

  • Output: sr.name, sr.id
  • Buffers: shared hit=8
34. 0.105 0.105 ↑ 1.0 177 1

Seq Scan on public.mc_step_result sr (cost=0.00..9.77 rows=177 width=108) (actual time=0.009..0.105 rows=177 loops=1)

  • Output: sr.name, sr.id
  • Buffers: shared hit=8
35. 1.422 1.470 ↑ 1.0 103 98

Materialize (cost=0.00..4.54 rows=103 width=122) (actual time=0.000..0.015 rows=103 loops=98)

  • Output: cr.name, cr.id
  • Buffers: shared hit=3
36. 0.048 0.048 ↑ 1.0 103 1

Seq Scan on public.mc_step_care_result cr (cost=0.00..4.03 rows=103 width=122) (actual time=0.004..0.048 rows=103 loops=1)

  • Output: cr.name, cr.id
  • Buffers: shared hit=3
37. 118.482 118.482 ↑ 21.0 1 98

Index Scan using md_srv_rendered_case_id_idx on public.md_srv_rendered mr (cost=0.56..6.71 rows=21 width=8) (actual time=1.208..1.209 rows=1 loops=98)

  • Output: mr.id, mr.is_urgent, mr.is_use_cryogenic, mr.is_use_endoscopic, mr.is_use_laser, mr.anesthesia_type_id, mr.step_id, mr.complication_type_id, mr.diagnosis_id, mr.case_id, mr.referral_id, mr.result_category_id, mr.patient_prescription_id, mr.health_group_id, mr.vmp_type_id, mr.vmp_method_id, mr.anatomic_zone_id, mr.aud_who, mr.aud_when, mr.aud_source, mr.aud_who_create, mr.aud_when_create, mr.aud_source_create, mr.prescription_id, mr.entity_sync_num, mr.complicated_value, mr.by_standard, mr.vmp_profile_id
  • Index Cond: (mr.case_id = c.id)
  • Buffers: shared hit=422 read=71
  • I/O Timings: read=117.213
38. 2.200 2.200 ↓ 0.0 0 100

Index Scan using fin_bill_spec_item_service_id_idx on public.fin_bill_spec_item si (cost=0.44..5.43 rows=1 width=8) (actual time=0.022..0.022 rows=0 loops=100)

  • Output: si.id, si.price, si.tariff, si.bill_id, si.service_id, si.number, si.is_deleted, si.comment, si.doc_id, si.status_id, si.correctional_bill_id, si.aud_who, si.aud_when, si.aud_source, si.aud_who_create, si.aud_when_create, si.aud_source_create
  • Index Cond: (si.service_id = mr.id)
  • Buffers: shared hit=288 read=9
  • I/O Timings: read=1.458
39. 0.000 0.000 ↓ 0.0 0 100

Index Scan using fin_bill_spec_item_error_item_id_idx on public.fin_bill_spec_item_error sie (cost=0.42..7.24 rows=2 width=103) (actual time=0.000..0.000 rows=0 loops=100)

  • Output: sie.id, sie.error, sie.item_id, sie.code, sie.source_id
  • Index Cond: (sie.item_id = si.id)
40. 0.000 0.000 ↓ 0.0 0 100

Index Scan using sr_res_group_pk on public.sr_res_group srg (cost=0.44..5.47 rows=1 width=8) (actual time=0.000..0.000 rows=0 loops=100)

  • 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 = lst.res_group_id)
41. 0.000 0.000 ↓ 0.0 0 100

Index Scan using pim_employee_position_pk on public.pim_employee_position pep (cost=0.29..5.14 rows=1 width=8) (actual time=0.000..0.000 rows=0 loops=100)

  • 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.target_training, pep.leaving_reason_id, pep.pref_prescription, pep.extra_payment
  • Index Cond: (srg.responsible_id = pep.id)
42. 0.000 0.000 ↓ 0.0 0 100

Index Scan using pim_employee_pk on public.pim_employee e (cost=0.29..5.13 rows=1 width=8) (actual time=0.000..0.000 rows=0 loops=100)

  • Output: e.id, e.note, e.number, e.photo, e.callup_subject_id, e.individual_id, e.organization_id, e.is_dismissed, e.employment_dt, e.dismissal_dt, e.aud_who, e.aud_when, e.aud_source, e.aud_who_create, e.aud_when_create, e.aud_source_create, e.accreditation_id
  • Index Cond: (e.id = pep.employee_id)
43. 0.000 0.000 ↓ 0.0 0 100

Index Scan using pim_individual_pk on public.pim_individual i2 (cost=0.42..6.66 rows=1 width=53) (actual time=0.000..0.000 rows=0 loops=100)

  • Output: i2.surname, i2.name, i2.patr_name, i2.id
  • Index Cond: (i2.id = e.individual_id)
44. 0.500 3.400 ↑ 1.0 1 100

Aggregate (cost=187.11..187.12 rows=1 width=32) (actual time=0.034..0.034 rows=1 loops=100)

  • Output: sum(ssi.price)
  • Buffers: shared hit=812 read=2
  • I/O Timings: read=2.065
45. 0.194 2.900 ↓ 0.0 0 100

Nested Loop (cost=1.00..187.08 rows=14 width=5) (actual time=0.029..0.029 rows=0 loops=100)

  • Output: ssi.price
  • Buffers: shared hit=812 read=2
  • I/O Timings: read=2.065
46. 2.500 2.500 ↑ 21.0 1 100

Index Scan using md_srv_rendered_case_id_idx on public.md_srv_rendered smr (cost=0.56..9.31 rows=21 width=4) (actual time=0.004..0.025 rows=1 loops=100)

  • Output: smr.id, smr.is_urgent, smr.is_use_cryogenic, smr.is_use_endoscopic, smr.is_use_laser, smr.anesthesia_type_id, smr.step_id, smr.complication_type_id, smr.diagnosis_id, smr.case_id, smr.referral_id, smr.result_category_id, smr.patient_prescription_id, smr.health_group_id, smr.vmp_type_id, smr.vmp_method_id, smr.anatomic_zone_id, smr.aud_who, smr.aud_when, smr.aud_source, smr.aud_who_create, smr.aud_when_create, smr.aud_source_create, smr.prescription_id, smr.entity_sync_num, smr.complicated_value, smr.by_standard, smr.vmp_profile_id
  • Index Cond: (smr.case_id = c.id)
  • Buffers: shared hit=503 read=2
  • I/O Timings: read=2.065
47. 0.206 0.206 ↓ 0.0 0 103

Index Scan using fin_bill_spec_item_service_id_idx on public.fin_bill_spec_item ssi (cost=0.44..8.46 rows=1 width=9) (actual time=0.002..0.002 rows=0 loops=103)

  • Output: ssi.id, ssi.price, ssi.tariff, ssi.bill_id, ssi.service_id, ssi.number, ssi.is_deleted, ssi.comment, ssi.doc_id, ssi.status_id, ssi.correctional_bill_id, ssi.aud_who, ssi.aud_when, ssi.aud_source, ssi.aud_who_create, ssi.aud_when_create, ssi.aud_source_create
  • Index Cond: (ssi.service_id = smr.id)
  • Buffers: shared hit=309
48.          

SubPlan (forResult)

49. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.43..31.08 rows=1 width=0) (never executed)

  • Join Filter: (x.type_id = z.id)
50. 0.000 0.000 ↓ 0.0 0

Index Scan using pim_individual_doc_indiv_id_idx on public.pim_individual_doc x (cost=0.43..28.47 rows=1 width=4) (never executed)

  • Output: x.id, x.type_id, x.series, x.number, x.sha256, x.code_id, x.indiv_id, x.is_active, x.expire_dt, x.issue_dt, x.issuer_text, x.note, x.birth_dt, x.contract_number, x.name, x.patr_name, x.surname, x.issuer_id, x.verific_dt, x.birth_place, x.check_dt, x.check_status_id, x.aud_who, x.aud_when, x.aud_source, x.aud_who_create, x.aud_when_create, x.aud_source_create
  • Index Cond: (x.indiv_id = i.id)
  • Filter: ((now() >= COALESCE(x.issue_dt, to_date('1000-01-01'::text, 'yyyy-mm-dd'::text))) AND (now() <= COALESCE(x.expire_dt, to_date('3000-01-01'::text, 'yyyy-mm-dd'::text))))
51. 0.000 0.000 ↓ 0.0 0

Seq Scan on public.pim_doc_type z (cost=0.00..2.60 rows=1 width=4) (never executed)

  • Output: z.id, z.code, z.is_contract_permitted, z.from_dt, z.name, z.note, z.occurrence, z.priority, z.to_dt, z.party_type_id, z.code_type_id, z.e_code, z.aud_who, z.aud_when, z.aud_source, z.aud_who_create, z.aud_when_create, z.aud_source_create, z.is_series_hidden, z.is_number_hidden, z.series_format, z.series_message_pattern, z.number_format, z.number_message_pattern, z.enum_code, z.is_not_unique, z.scope_id
  • Filter: ((z.code)::text = 'MHI_UNIFORM'::text)
52. 224.823 40,060.585 ↓ 89.4 759,582 1

Nested Loop (cost=4,180.19..81,772.64 rows=8,497 width=4) (actual time=1,618.421..40,060.585 rows=759,582 loops=1)

  • Output: x_1.indiv_id
  • Buffers: shared hit=1486 read=75564 dirtied=8
  • I/O Timings: read=37247.447
53. 0.086 0.086 ↑ 1.0 1 1

Seq Scan on public.pim_doc_type z_1 (cost=0.00..2.60 rows=1 width=4) (actual time=0.027..0.086 rows=1 loops=1)

  • Output: z_1.id, z_1.code, z_1.is_contract_permitted, z_1.from_dt, z_1.name, z_1.note, z_1.occurrence, z_1.priority, z_1.to_dt, z_1.party_type_id, z_1.code_type_id, z_1.e_code, z_1.aud_who, z_1.aud_when, z_1.aud_source, z_1.aud_who_create, z_1.aud_when_create, z_1.aud_source_create, z_1.is_series_hidden, z_1.is_number_hidden, z_1.series_format, z_1.series_message_pattern, z_1.number_format, z_1.number_message_pattern, z_1.enum_code, z_1.is_not_unique, z_1.scope_id
  • Filter: ((z_1.code)::text = 'MHI_UNIFORM'::text)
  • Rows Removed by Filter: 47
  • Buffers: shared hit=2
54. 38,239.348 39,835.676 ↓ 39.1 759,582 1

Bitmap Heap Scan on public.pim_individual_doc x_1 (cost=4,180.19..81,575.83 rows=19,421 width=8) (actual time=1,618.389..39,835.676 rows=759,582 loops=1)

  • Output: x_1.id, x_1.type_id, x_1.series, x_1.number, x_1.sha256, x_1.code_id, x_1.indiv_id, x_1.is_active, x_1.expire_dt, x_1.issue_dt, x_1.issuer_text, x_1.note, x_1.birth_dt, x_1.contract_number, x_1.name, x_1.patr_name, x_1.surname, x_1.issuer_id, x_1.verific_dt, x_1.birth_place, x_1.check_dt, x_1.check_status_id, x_1.aud_who, x_1.aud_when, x_1.aud_source, x_1.aud_who_create, x_1.aud_when_create, x_1.aud_source_create
  • Recheck Cond: (x_1.type_id = z_1.id)
  • Filter: ((now() >= COALESCE(x_1.issue_dt, to_date('1000-01-01'::text, 'yyyy-mm-dd'::text))) AND (now() <= COALESCE(x_1.expire_dt, to_date('3000-01-01'::text, 'yyyy-mm-dd'::text))))
  • Rows Removed by Filter: 327679
  • Heap Blocks: exact=71882
  • Buffers: shared hit=1484 read=75564 dirtied=8
  • I/O Timings: read=37247.447
55. 1,596.328 1,596.328 ↓ 6.2 1,087,434 1

Bitmap Index Scan on fk_pim_doc_doc_type (cost=0.00..4,175.33 rows=174,787 width=0) (actual time=1,596.328..1,596.328 rows=1,087,434 loops=1)

  • Index Cond: (x_1.type_id = z_1.id)
  • Buffers: shared hit=1448 read=3718
  • I/O Timings: read=1388.025
56. 0.000 0.000 ↓ 0.0 0

Index Scan using pim_individual_doc_indiv_id_idx on public.pim_individual_doc x_2 (cost=0.43..28.47 rows=1 width=0) (never executed)

  • Index Cond: (x_2.indiv_id = i.id)
  • Filter: ((now() >= COALESCE(x_2.issue_dt, to_date('1000-01-01'::text, 'yyyy-mm-dd'::text))) AND (now() <= COALESCE(x_2.expire_dt, to_date('3000-01-01'::text, 'yyyy-mm-dd'::text))))
57. 4,041.377 4,041.377 ↓ 5.3 2,172,433 1

Seq Scan on public.pim_individual_doc x_3 (cost=0.00..164,351.95 rows=407,835 width=4) (actual time=0.126..4,041.377 rows=2,172,433 loops=1)

  • Output: x_3.indiv_id
  • Filter: ((now() >= COALESCE(x_3.issue_dt, to_date('1000-01-01'::text, 'yyyy-mm-dd'::text))) AND (now() <= COALESCE(x_3.expire_dt, to_date('3000-01-01'::text, 'yyyy-mm-dd'::text))))
  • Rows Removed by Filter: 1498736
  • Buffers: shared hit=71882 read=707 dirtied=2
  • I/O Timings: read=157.232
Planning time : 20.662 ms
Execution time : 50,829.930 ms