explain.depesz.com

PostgreSQL's explain analyze made readable

Result: nbRZ

Settings
# exclusive inclusive rows x rows loops node
1. 0.009 578,182.062 ↓ 50.0 50 1

Limit (cost=60,220.09..60,220.09 rows=1 width=4,105) (actual time=578,182.023..578,182.062 rows=50 loops=1)

  • Output: item.bill_id, item.id, ((SubPlan 9)), ((SubPlan 10)), ((SubPlan 1)), ((SubPlan 2)), (CASE WHEN ((c_1.case_type_code)::text = '2'::text) THEN (((s.hsp_department_code)::text || ', '::text) || (s.hsp_department_name)::text) ELSE (((pim_department.code)::text || ', '::text) || (pim_department.name)::text) END), item.tariff, s.tariff_code, (round(item.price, 2)), ((s.srv_rendered_quantity)::integer), s.patient_id, ((((((fin_bill_patients.pat_surname)::text || ' '::text) || (fin_bill_patients.pat_name)::text) || ' '::text) || (fin_bill_patients.pat_patr_name)::text)), item.service_id, s.service_name, fin_bill_patients.pat_birth_dt, ((COALESCE(((fin_bill_policy.series)::text || ' '::text), ''::text) || (COALESCE(fin_bill_policy.number, ''::character varying))::text)), (COALESCE(fin_bill_policy.issuer_short_name, ''::character varying)), s.case_id, c_1.uid, ((SubPlan 11)), s.step_admission_date, (COALESCE((SubPlan 3), ((SubPlan 12)))), (COALESCE((SubPlan 4), ((SubPlan 13)), ''::text)), ((c_1.region_data -> 'position_name'::text)), (((((((((n.surname)::text || ' '::text) || upper("left"((n.name)::text, 1))) || '.'::text) || COALESCE(((' '::text || upper("left"((n.patr_name)::text, 1))) || '.'::text), ''::text))) || ', '::text) || (pim_position.name)::text)), item.is_deleted, (COALESCE(((s.region_data -> 'is_exceeded'::text))::boolean, false)), (COALESCE(status.code, ''::character varying)), item.correctional_bill_id, item.comment, (CASE WHEN ((fbg.item_type)::text = 'dentist'::text) THEN s.cul ELSE NULL::numeric END), (CASE WHEN ((c.care_regimen_code)::text = ANY ('{3,4,5}'::text[])) THEN ((c.close_date - c.open_date) + 1) WHEN ((c.care_regimen_code)::text = '2'::text) THEN COALESCE(NULLIF((c.close_date - c.open_date), 0), 1) ELSE NULL::integer END), (CASE WHEN (SubPlan 5) THEN ((('Услуга добавлена в счет '::text || (add_case.add_date)::text) || ' пользователем '::text) || (add_case.user_login)::text) ELSE NULL::text END), (CASE WHEN (s.patient_id = (SubPlan 6)) THEN 'Да'::text ELSE 'Нет'::text END), s.step_outcome_date, bill.generated, ((s.region_data -> 'csg_id'::text)), ((fbg.region_data -> 'f_ksg_code'::text)), (CASE WHEN ((s.region_data -> 'prikrep'::text) = 'true'::text) THEN 'Да'::text ELSE 'Нет'::text END), ((SubPlan 8)), f.code, ((c_1.region_data -> '_bedn_prof_record'::text)), ((((COALESCE(mpm.code, ''::character varying))::text || ' '::text) || (COALESCE(mpm.name, ''::character varying))::text)), ((SubPlan 14))
  • Buffers: shared hit=2661421 read=151259
  • I/O Timings: read=553011.479
2. 317.064 578,182.053 ↓ 50.0 50 1

Sort (cost=60,220.09..60,220.09 rows=1 width=4,105) (actual time=578,182.022..578,182.053 rows=50 loops=1)

  • Output: item.bill_id, item.id, ((SubPlan 9)), ((SubPlan 10)), ((SubPlan 1)), ((SubPlan 2)), (CASE WHEN ((c_1.case_type_code)::text = '2'::text) THEN (((s.hsp_department_code)::text || ', '::text) || (s.hsp_department_name)::text) ELSE (((pim_department.code)::text || ', '::text) || (pim_department.name)::text) END), item.tariff, s.tariff_code, (round(item.price, 2)), ((s.srv_rendered_quantity)::integer), s.patient_id, ((((((fin_bill_patients.pat_surname)::text || ' '::text) || (fin_bill_patients.pat_name)::text) || ' '::text) || (fin_bill_patients.pat_patr_name)::text)), item.service_id, s.service_name, fin_bill_patients.pat_birth_dt, ((COALESCE(((fin_bill_policy.series)::text || ' '::text), ''::text) || (COALESCE(fin_bill_policy.number, ''::character varying))::text)), (COALESCE(fin_bill_policy.issuer_short_name, ''::character varying)), s.case_id, c_1.uid, ((SubPlan 11)), s.step_admission_date, (COALESCE((SubPlan 3), ((SubPlan 12)))), (COALESCE((SubPlan 4), ((SubPlan 13)), ''::text)), ((c_1.region_data -> 'position_name'::text)), (((((((((n.surname)::text || ' '::text) || upper("left"((n.name)::text, 1))) || '.'::text) || COALESCE(((' '::text || upper("left"((n.patr_name)::text, 1))) || '.'::text), ''::text))) || ', '::text) || (pim_position.name)::text)), item.is_deleted, (COALESCE(((s.region_data -> 'is_exceeded'::text))::boolean, false)), (COALESCE(status.code, ''::character varying)), item.correctional_bill_id, item.comment, (CASE WHEN ((fbg.item_type)::text = 'dentist'::text) THEN s.cul ELSE NULL::numeric END), (CASE WHEN ((c.care_regimen_code)::text = ANY ('{3,4,5}'::text[])) THEN ((c.close_date - c.open_date) + 1) WHEN ((c.care_regimen_code)::text = '2'::text) THEN COALESCE(NULLIF((c.close_date - c.open_date), 0), 1) ELSE NULL::integer END), (CASE WHEN (SubPlan 5) THEN ((('Услуга добавлена в счет '::text || (add_case.add_date)::text) || ' пользователем '::text) || (add_case.user_login)::text) ELSE NULL::text END), (CASE WHEN (s.patient_id = (SubPlan 6)) THEN 'Да'::text ELSE 'Нет'::text END), s.step_outcome_date, bill.generated, ((s.region_data -> 'csg_id'::text)), ((fbg.region_data -> 'f_ksg_code'::text)), (CASE WHEN ((s.region_data -> 'prikrep'::text) = 'true'::text) THEN 'Да'::text ELSE 'Нет'::text END), ((SubPlan 8)), f.code, ((c_1.region_data -> '_bedn_prof_record'::text)), ((((COALESCE(mpm.code, ''::character varying))::text || ' '::text) || (COALESCE(mpm.name, ''::character varying))::text)), ((SubPlan 14))
  • Sort Key: s.service_name, item.id
  • Sort Method: top-N heapsort Memory: 81kB
  • Buffers: shared hit=2661421 read=151259
  • I/O Timings: read=553011.479
3. 5,226.821 577,864.989 ↓ 29,363.0 29,363 1

Nested Loop Left Join (cost=11,069.25..60,220.08 rows=1 width=4,105) (actual time=4,205.753..577,864.989 rows=29,363 loops=1)

  • Output: item.bill_id, item.id, ((SubPlan 9)), ((SubPlan 10)), (SubPlan 1), (SubPlan 2), CASE WHEN ((c_1.case_type_code)::text = '2'::text) THEN (((s.hsp_department_code)::text || ', '::text) || (s.hsp_department_name)::text) ELSE (((pim_department.code)::text || ', '::text) || (pim_department.name)::text) END, item.tariff, s.tariff_code, round(item.price, 2), (s.srv_rendered_quantity)::integer, s.patient_id, ((((((fin_bill_patients.pat_surname)::text || ' '::text) || (fin_bill_patients.pat_name)::text) || ' '::text) || (fin_bill_patients.pat_patr_name)::text)), item.service_id, s.service_name, fin_bill_patients.pat_birth_dt, (COALESCE(((fin_bill_policy.series)::text || ' '::text), ''::text) || (COALESCE(fin_bill_policy.number, ''::character varying))::text), COALESCE(fin_bill_policy.issuer_short_name, ''::character varying), s.case_id, c_1.uid, ((SubPlan 11)), s.step_admission_date, COALESCE((SubPlan 3), ((SubPlan 12))), COALESCE((SubPlan 4), ((SubPlan 13)), ''::text), ((c_1.region_data -> 'position_name'::text)), ((((((((n.surname)::text || ' '::text) || upper("left"((n.name)::text, 1))) || '.'::text) || COALESCE(((' '::text || upper("left"((n.patr_name)::text, 1))) || '.'::text), ''::text))) || ', '::text) || (pim_position.name)::text), item.is_deleted, COALESCE(((s.region_data -> 'is_exceeded'::text))::boolean, false), COALESCE(status.code, ''::character varying), item.correctional_bill_id, item.comment, CASE WHEN ((fbg.item_type)::text = 'dentist'::text) THEN s.cul ELSE NULL::numeric END, CASE WHEN ((c.care_regimen_code)::text = ANY ('{3,4,5}'::text[])) THEN ((c.close_date - c.open_date) + 1) WHEN ((c.care_regimen_code)::text = '2'::text) THEN COALESCE(NULLIF((c.close_date - c.open_date), 0), 1) ELSE NULL::integer END, CASE WHEN (SubPlan 5) THEN ((('Услуга добавлена в счет '::text || (add_case.add_date)::text) || ' пользователем '::text) || (add_case.user_login)::text) ELSE NULL::text END, CASE WHEN (s.patient_id = (SubPlan 6)) THEN 'Да'::text ELSE 'Нет'::text END, s.step_outcome_date, bill.generated, (s.region_data -> 'csg_id'::text), (fbg.region_data -> 'f_ksg_code'::text), CASE WHEN ((s.region_data -> 'prikrep'::text) = 'true'::text) THEN 'Да'::text ELSE 'Нет'::text END, (SubPlan 8), f.code, ((c_1.region_data -> '_bedn_prof_record'::text)), ((((COALESCE(mpm.code, ''::character varying))::text || ' '::text) || (COALESCE(mpm.name, ''::character varying))::text)), ((SubPlan 14))
  • Buffers: shared hit=2661415 read=151259
  • I/O Timings: read=553011.479
4. 79.146 241,805.247 ↓ 29,363.0 29,363 1

Nested Loop Left Join (cost=11,069.25..60,145.64 rows=1 width=4,074) (actual time=3,928.547..241,805.247 rows=29,363 loops=1)

  • Output: item.bill_id, item.id, item.tariff, item.price, item.service_id, item.is_deleted, item.correctional_bill_id, item.comment, bill.generated, status.code, s.hsp_department_code, s.hsp_department_name, s.tariff_code, s.srv_rendered_quantity, s.patient_id, s.service_name, s.case_id, s.step_admission_date, s.step_id, s.step_main_diagnosis_id, s.region_data, s.cul, s.step_outcome_date, c.care_regimen_code, c.close_date, c.open_date, fbg.item_type, fbg.region_data, add_case.add_date, add_case.user_login, ((SubPlan 9)), ((SubPlan 10)), c_1.case_type_code, c_1.uid, ((SubPlan 11)), ((SubPlan 12)), ((SubPlan 13)), ((c_1.region_data -> 'position_name'::text)), ((c_1.region_data -> '_bedn_prof_record'::text)), ((SubPlan 14)), c_1.payment_method_code, ((((((fin_bill_patients.pat_surname)::text || ' '::text) || (fin_bill_patients.pat_name)::text) || ' '::text) || (fin_bill_patients.pat_patr_name)::text)), fin_bill_patients.pat_birth_dt, fin_bill_policy.series, fin_bill_policy.number, fin_bill_policy.issuer_short_name, pim_position.name, pim_department.code, pim_department.name, ((((((n.surname)::text || ' '::text) || upper("left"((n.name)::text, 1))) || '.'::text) || COALESCE(((' '::text || upper("left"((n.patr_name)::text, 1))) || '.'::text), ''::text))), f.code
  • Buffers: shared hit=1618470 read=84847
  • I/O Timings: read=228650.113
5. 87.762 240,551.581 ↓ 29,363.0 29,363 1

Nested Loop Left Join (cost=11,069.25..60,135.41 rows=1 width=4,074) (actual time=3,928.404..240,551.581 rows=29,363 loops=1)

  • Output: item.bill_id, item.id, item.tariff, item.price, item.service_id, item.is_deleted, item.correctional_bill_id, item.comment, bill.generated, status.code, s.hsp_department_code, s.hsp_department_name, s.tariff_code, s.srv_rendered_quantity, s.patient_id, s.service_name, s.case_id, s.step_admission_date, s.step_id, s.step_main_diagnosis_id, s.region_data, s.cul, s.step_outcome_date, c.care_regimen_code, c.close_date, c.open_date, fbg.item_type, fbg.region_data, add_case.add_date, add_case.user_login, ((SubPlan 9)), ((SubPlan 10)), c_1.case_type_code, c_1.uid, ((SubPlan 11)), ((SubPlan 12)), ((SubPlan 13)), ((c_1.region_data -> 'position_name'::text)), ((c_1.region_data -> '_bedn_prof_record'::text)), ((SubPlan 14)), c_1.last_profile_code, c_1.payment_method_code, ((((((fin_bill_patients.pat_surname)::text || ' '::text) || (fin_bill_patients.pat_name)::text) || ' '::text) || (fin_bill_patients.pat_patr_name)::text)), fin_bill_patients.pat_birth_dt, fin_bill_policy.series, fin_bill_policy.number, fin_bill_policy.issuer_short_name, pim_position.name, pim_department.code, pim_department.name, ((((((n.surname)::text || ' '::text) || upper("left"((n.name)::text, 1))) || '.'::text) || COALESCE(((' '::text || upper("left"((n.patr_name)::text, 1))) || '.'::text), ''::text)))
  • Buffers: shared hit=1513115 read=84847
  • I/O Timings: read=228650.113
6. 61.516 239,348.025 ↓ 29,363.0 29,363 1

Nested Loop Left Join (cost=11,068.53..60,118.60 rows=1 width=4,047) (actual time=3,928.028..239,348.025 rows=29,363 loops=1)

  • Output: item.bill_id, item.id, item.tariff, item.price, item.service_id, item.is_deleted, item.correctional_bill_id, item.comment, bill.generated, status.code, s.hsp_department_code, s.hsp_department_name, s.tariff_code, s.srv_rendered_quantity, s.patient_id, s.service_name, s.case_id, s.step_admission_date, s.step_id, s.step_main_diagnosis_id, s.region_data, s.cul, s.step_outcome_date, s.doctor_code, c.care_regimen_code, c.close_date, c.open_date, fbg.item_type, fbg.region_data, add_case.add_date, add_case.user_login, ((SubPlan 9)), ((SubPlan 10)), c_1.case_type_code, c_1.uid, ((SubPlan 11)), ((SubPlan 12)), ((SubPlan 13)), ((c_1.region_data -> 'position_name'::text)), ((c_1.region_data -> '_bedn_prof_record'::text)), ((SubPlan 14)), c_1.last_profile_code, c_1.payment_method_code, ((((((fin_bill_patients.pat_surname)::text || ' '::text) || (fin_bill_patients.pat_name)::text) || ' '::text) || (fin_bill_patients.pat_patr_name)::text)), fin_bill_patients.pat_birth_dt, fin_bill_policy.series, fin_bill_policy.number, fin_bill_policy.issuer_short_name, pim_position.name, pim_department.code, pim_department.name
  • Buffers: shared hit=1307719 read=84845
  • I/O Timings: read=228642.465
7. 60.311 238,992.879 ↓ 29,363.0 29,363 1

Nested Loop Left Join (cost=11,068.25..60,110.28 rows=1 width=3,990) (actual time=3,918.576..238,992.879 rows=29,363 loops=1)

  • Output: item.bill_id, item.id, item.tariff, item.price, item.service_id, item.is_deleted, item.correctional_bill_id, item.comment, bill.generated, status.code, s.hsp_department_code, s.hsp_department_name, s.tariff_code, s.srv_rendered_quantity, s.patient_id, s.service_name, s.case_id, s.step_admission_date, s.step_id, s.step_main_diagnosis_id, s.region_data, s.cul, s.step_outcome_date, s.doctor_code, c.care_regimen_code, c.close_date, c.open_date, fbg.item_type, fbg.region_data, add_case.add_date, add_case.user_login, ((SubPlan 9)), ((SubPlan 10)), c_1.case_type_code, c_1.uid, ((SubPlan 11)), ((SubPlan 12)), ((SubPlan 13)), ((c_1.region_data -> 'position_name'::text)), ((c_1.region_data -> '_bedn_prof_record'::text)), ((SubPlan 14)), c_1.last_profile_code, c_1.payment_method_code, ((((((fin_bill_patients.pat_surname)::text || ' '::text) || (fin_bill_patients.pat_name)::text) || ' '::text) || (fin_bill_patients.pat_patr_name)::text)), fin_bill_patients.pat_birth_dt, fin_bill_policy.series, fin_bill_policy.number, fin_bill_policy.issuer_short_name, pim_position.name, pim_position.department_id
  • Buffers: shared hit=1219713 read=84843
  • I/O Timings: read=228633.081
8. 76.633 238,521.486 ↓ 29,363.0 29,363 1

Nested Loop Left Join (cost=11,067.82..60,101.82 rows=1 width=3,994) (actual time=3,918.415..238,521.486 rows=29,363 loops=1)

  • Output: item.bill_id, item.id, item.tariff, item.price, item.service_id, item.is_deleted, item.correctional_bill_id, item.comment, bill.generated, status.code, s.hsp_department_code, s.hsp_department_name, s.tariff_code, s.srv_rendered_quantity, s.patient_id, s.service_name, s.case_id, s.step_admission_date, s.step_id, s.step_main_diagnosis_id, s.region_data, s.cul, s.step_outcome_date, s.service_id, s.doctor_code, c.care_regimen_code, c.close_date, c.open_date, fbg.item_type, fbg.region_data, add_case.add_date, add_case.user_login, ((SubPlan 9)), ((SubPlan 10)), c_1.case_type_code, c_1.uid, ((SubPlan 11)), ((SubPlan 12)), ((SubPlan 13)), ((c_1.region_data -> 'position_name'::text)), ((c_1.region_data -> '_bedn_prof_record'::text)), ((SubPlan 14)), c_1.last_profile_code, c_1.payment_method_code, ((((((fin_bill_patients.pat_surname)::text || ' '::text) || (fin_bill_patients.pat_name)::text) || ' '::text) || (fin_bill_patients.pat_patr_name)::text)), fin_bill_patients.pat_birth_dt, fin_bill_policy.series, fin_bill_policy.number, fin_bill_policy.issuer_short_name, pim_position.name, pim_position.department_id
  • Buffers: shared hit=1112662 read=84833
  • I/O Timings: read=228594.056
9. 92.503 238,063.134 ↓ 29,363.0 29,363 1

Nested Loop Left Join (cost=11,067.54..60,093.49 rows=1 width=3,944) (actual time=3,918.336..238,063.134 rows=29,363 loops=1)

  • Output: item.bill_id, item.id, item.tariff, item.price, item.service_id, item.is_deleted, item.correctional_bill_id, item.comment, bill.generated, status.code, s.hsp_department_code, s.hsp_department_name, s.tariff_code, s.srv_rendered_quantity, s.patient_id, s.service_name, s.case_id, s.step_admission_date, s.step_id, s.step_main_diagnosis_id, s.region_data, s.cul, s.step_outcome_date, s.position_id, s.service_id, s.doctor_code, c.care_regimen_code, c.close_date, c.open_date, fbg.item_type, fbg.region_data, add_case.add_date, add_case.user_login, ((SubPlan 9)), ((SubPlan 10)), c_1.case_type_code, c_1.uid, ((SubPlan 11)), ((SubPlan 12)), ((SubPlan 13)), ((c_1.region_data -> 'position_name'::text)), ((c_1.region_data -> '_bedn_prof_record'::text)), ((SubPlan 14)), c_1.last_profile_code, c_1.payment_method_code, ((((((fin_bill_patients.pat_surname)::text || ' '::text) || (fin_bill_patients.pat_name)::text) || ' '::text) || (fin_bill_patients.pat_patr_name)::text)), fin_bill_patients.pat_birth_dt, fin_bill_policy.series, fin_bill_policy.number, fin_bill_policy.issuer_short_name
  • Buffers: shared hit=1024673 read=84814
  • I/O Timings: read=228510.543
10. 86.957 236,796.111 ↓ 29,363.0 29,363 1

Nested Loop Left Join (cost=11,067.10..60,085.02 rows=1 width=3,891) (actual time=3,891.635..236,796.111 rows=29,363 loops=1)

  • Output: item.bill_id, item.id, item.tariff, item.price, item.service_id, item.is_deleted, item.correctional_bill_id, item.comment, bill.generated, status.code, s.hsp_department_code, s.hsp_department_name, s.tariff_code, s.srv_rendered_quantity, s.patient_id, s.service_name, s.case_id, s.step_admission_date, s.step_id, s.step_main_diagnosis_id, s.region_data, s.cul, s.step_outcome_date, s.position_id, s.service_id, s.doctor_code, c.care_regimen_code, c.close_date, c.open_date, fbg.item_type, fbg.region_data, add_case.add_date, add_case.user_login, ((SubPlan 9)), ((SubPlan 10)), c_1.case_type_code, c_1.uid, ((SubPlan 11)), ((SubPlan 12)), ((SubPlan 13)), ((c_1.region_data -> 'position_name'::text)), ((c_1.region_data -> '_bedn_prof_record'::text)), ((SubPlan 14)), c_1.active_policy_id, c_1.last_profile_code, c_1.payment_method_code, ((((((fin_bill_patients.pat_surname)::text || ' '::text) || (fin_bill_patients.pat_name)::text) || ' '::text) || (fin_bill_patients.pat_patr_name)::text)), fin_bill_patients.pat_birth_dt
  • Buffers: shared hit=907908 read=84363
  • I/O Timings: read=227804.138
11. 104.936 234,125.210 ↓ 29,363.0 29,363 1

Nested Loop Left Join (cost=11,066.54..60,076.41 rows=1 width=3,862) (actual time=3,833.452..234,125.210 rows=29,363 loops=1)

  • Output: item.bill_id, item.id, item.tariff, item.price, item.service_id, item.is_deleted, item.correctional_bill_id, item.comment, bill.generated, status.code, s.hsp_department_code, s.hsp_department_name, s.tariff_code, s.srv_rendered_quantity, s.patient_id, s.service_name, s.case_id, s.step_admission_date, s.step_id, s.step_main_diagnosis_id, s.region_data, s.cul, s.step_outcome_date, s.id_pac, s.position_id, s.service_id, s.doctor_code, c.care_regimen_code, c.close_date, c.open_date, fbg.item_type, fbg.region_data, add_case.add_date, add_case.user_login, ((SubPlan 9)), ((SubPlan 10)), c_1.case_type_code, c_1.uid, ((SubPlan 11)), ((SubPlan 12)), ((SubPlan 13)), ((c_1.region_data -> 'position_name'::text)), ((c_1.region_data -> '_bedn_prof_record'::text)), ((SubPlan 14)), c_1.active_policy_id, c_1.last_profile_code, c_1.payment_method_code
  • Buffers: shared hit=761772 read=83682
  • I/O Timings: read=226122.955
12. 713.310 231,230.789 ↓ 29,363.0 29,363 1

Nested Loop Left Join (cost=11,066.10..60,052.64 rows=1 width=1,170) (actual time=3,832.220..231,230.789 rows=29,363 loops=1)

  • Output: item.bill_id, item.id, item.tariff, item.price, item.service_id, item.is_deleted, item.correctional_bill_id, item.comment, bill.generated, status.code, s.hsp_department_code, s.hsp_department_name, s.tariff_code, s.srv_rendered_quantity, s.patient_id, s.service_name, s.case_id, s.step_admission_date, s.step_id, s.step_main_diagnosis_id, s.region_data, s.cul, s.step_outcome_date, s.id_pac, s.position_id, s.service_id, s.doctor_code, c.care_regimen_code, c.close_date, c.open_date, fbg.item_type, fbg.region_data, add_case.add_date, add_case.user_login
  • Join Filter: (s.case_id = add_case.case_id)
  • Rows Removed by Join Filter: 2495855
  • Buffers: shared hit=404127 read=83680
  • I/O Timings: read=226108.161
13. 85.573 229,871.493 ↓ 29,363.0 29,363 1

Nested Loop (cost=11,066.10..60,048.84 rows=1 width=1,155) (actual time=3,832.109..229,871.493 rows=29,363 loops=1)

  • Output: item.bill_id, item.id, item.tariff, item.price, item.service_id, item.is_deleted, item.correctional_bill_id, item.comment, bill.generated, status.code, s.hsp_department_code, s.hsp_department_name, s.tariff_code, s.srv_rendered_quantity, s.patient_id, s.service_name, s.case_id, s.step_admission_date, s.step_id, s.step_main_diagnosis_id, s.region_data, s.cul, s.step_outcome_date, s.id_pac, s.position_id, s.service_id, s.doctor_code, c.care_regimen_code, c.close_date, c.open_date, fbg.item_type, fbg.region_data
  • Buffers: shared hit=345402 read=83679
  • I/O Timings: read=226108.126
14. 218.717 130,803.247 ↓ 29,363.0 29,363 1

Nested Loop (cost=11,065.54..59,710.93 rows=1 width=1,096) (actual time=3,758.907..130,803.247 rows=29,363 loops=1)

  • Output: item.bill_id, item.id, item.tariff, item.price, item.service_id, item.is_deleted, item.correctional_bill_id, item.comment, bill.generated, status.code, s.hsp_department_code, s.hsp_department_name, s.tariff_code, s.srv_rendered_quantity, s.patient_id, s.service_name, s.case_id, s.step_admission_date, s.step_id, s.step_main_diagnosis_id, s.region_data, s.cul, s.step_outcome_date, s.id_pac, s.position_id, s.service_id, s.doctor_code, c.care_regimen_code, c.close_date, c.open_date
  • Join Filter: (item.status_id = status.id)
  • Rows Removed by Join Filter: 88089
  • Buffers: shared hit=232166 read=33403
  • I/O Timings: read=128688.551
15. 95.257 130,437.715 ↓ 29,363.0 29,363 1

Nested Loop (cost=11,065.54..59,709.84 rows=1 width=1,089) (actual time=3,758.876..130,437.715 rows=29,363 loops=1)

  • Output: item.bill_id, item.id, item.tariff, item.price, item.service_id, item.is_deleted, item.correctional_bill_id, item.comment, item.status_id, bill.generated, s.hsp_department_code, s.hsp_department_name, s.tariff_code, s.srv_rendered_quantity, s.patient_id, s.service_name, s.case_id, s.step_admission_date, s.step_id, s.step_main_diagnosis_id, s.region_data, s.cul, s.step_outcome_date, s.id_pac, s.position_id, s.service_id, s.doctor_code, c.care_regimen_code, c.close_date, c.open_date
  • Buffers: shared hit=202803 read=33403
  • I/O Timings: read=128688.551
16. 130.692 130,078.191 ↓ 29,363.0 29,363 1

Nested Loop (cost=11,065.26..59,701.53 rows=1 width=1,085) (actual time=3,758.788..130,078.191 rows=29,363 loops=1)

  • Output: item.bill_id, item.id, item.tariff, item.price, item.service_id, item.is_deleted, item.correctional_bill_id, item.comment, item.status_id, s.hsp_department_code, s.hsp_department_name, s.tariff_code, s.srv_rendered_quantity, s.patient_id, s.service_name, s.case_id, s.step_admission_date, s.step_id, s.step_main_diagnosis_id, s.region_data, s.cul, s.step_outcome_date, s.id_pac, s.position_id, s.service_id, s.doctor_code, c.care_regimen_code, c.close_date, c.open_date
  • Buffers: shared hit=114714 read=33403
  • I/O Timings: read=128688.551
17. 156.803 108,160.153 ↓ 4,893.8 29,363 1

Hash Join (cost=11,064.82..59,652.21 rows=6 width=1,079) (actual time=3,714.421..108,160.153 rows=29,363 loops=1)

  • Output: item.bill_id, item.id, item.tariff, item.price, item.service_id, item.is_deleted, item.correctional_bill_id, item.comment, item.status_id, s.hsp_department_code, s.hsp_department_name, s.tariff_code, s.srv_rendered_quantity, s.patient_id, s.service_name, s.case_id, s.step_admission_date, s.step_id, s.step_main_diagnosis_id, s.region_data, s.cul, s.step_outcome_date, s.id_pac, s.position_id, s.service_id, s.doctor_code, s.bill_id
  • Hash Cond: (s.srv_rendered_id = item.service_id)
  • Buffers: shared hit=3454 read=27195
  • I/O Timings: read=107533.748
18. 104,353.152 104,353.152 ↓ 2.3 29,363 1

Index Scan using fin_bill_steps_pk on billing.fin_bill_steps s (cost=0.56..48,539.10 rows=13,012 width=984) (actual time=63.996..104,353.152 rows=29,363 loops=1)

  • Output: s.hsp_department_code, s.hsp_department_name, s.tariff_code, s.srv_rendered_quantity, s.patient_id, s.service_name, s.case_id, s.step_admission_date, s.step_id, s.step_main_diagnosis_id, s.region_data, s.cul, s.step_outcome_date, s.id_pac, s.position_id, s.service_id, s.doctor_code, s.bill_id, s.srv_rendered_id
  • Index Cond: (s.bill_id = 6287)
  • Buffers: shared hit=3143 read=26376
  • I/O Timings: read=103946.786
19. 27.242 3,650.198 ↓ 2.2 29,363 1

Hash (cost=10,899.56..10,899.56 rows=13,176 width=99) (actual time=3,650.198..3,650.198 rows=29,363 loops=1)

  • Output: item.bill_id, item.id, item.tariff, item.price, item.service_id, item.is_deleted, item.correctional_bill_id, item.comment, item.status_id
  • Buckets: 32768 (originally 16384) Batches: 1 (originally 1) Memory Usage: 2607kB
  • Buffers: shared hit=311 read=819
  • I/O Timings: read=3586.962
20. 3,622.956 3,622.956 ↓ 2.2 29,363 1

Index Scan using fin_bill_spec_item_bill_id_idx on public.fin_bill_spec_item item (cost=0.56..10,899.56 rows=13,176 width=99) (actual time=43.552..3,622.956 rows=29,363 loops=1)

  • Output: item.bill_id, item.id, item.tariff, item.price, item.service_id, item.is_deleted, item.correctional_bill_id, item.comment, item.status_id
  • Index Cond: (item.bill_id = 6287)
  • Buffers: shared hit=311 read=819
  • I/O Timings: read=3586.962
21. 21,787.346 21,787.346 ↑ 1.0 1 29,363

Index Scan using fin_bill_cases_case_id_bill_id_idx on billing.fin_bill_cases c (cost=0.44..8.21 rows=1 width=18) (actual time=0.740..0.742 rows=1 loops=29,363)

  • Output: c.care_regimen_code, c.close_date, c.open_date, c.case_id, c.bill_id
  • Index Cond: ((c.case_id = s.case_id) AND (c.bill_id = 6287))
  • Buffers: shared hit=111260 read=6208
  • I/O Timings: read=21154.803
22. 264.267 264.267 ↑ 1.0 1 29,363

Index Scan using fin_bill_pkey on public.fin_bill bill (cost=0.28..8.30 rows=1 width=8) (actual time=0.008..0.009 rows=1 loops=29,363)

  • Output: bill.id, bill.comment, bill.date, bill.package_number, bill.status_id, bill.number, bill.generated, bill.task_id, bill.aud_who, bill.aud_when, bill.aud_source, bill.aud_who_create, bill.aud_when_create, bill.aud_source_create
  • Index Cond: (bill.id = 6287)
  • Buffers: shared hit=88089
23. 146.815 146.815 ↑ 1.0 4 29,363

Seq Scan on public.fin_bill_payment_status status (cost=0.00..1.04 rows=4 width=15) (actual time=0.003..0.005 rows=4 loops=29,363)

  • Output: status.id, status.code, status.name, status.e_code, status.aud_who, status.aud_when, status.aud_source, status.aud_who_create, status.aud_when_create, status.aud_source_create
  • Buffers: shared hit=29363
24. 117.452 98,982.673 ↑ 1.0 1 29,363

Subquery Scan on fbg (cost=0.56..337.90 rows=1 width=59) (actual time=2.394..3.371 rows=1 loops=29,363)

  • Output: fbg.id, fbg.bill_id, fbg.service_id, fbg.contract_id, fbg.customer_id, fbg.bdate, fbg.new_born, fbg.patient_id, fbg.active_policy_id, fbg.case_id, fbg.org_id, fbg.quantity, fbg.price_list_id, fbg.relative_id, fbg.to_date, fbg.res_group_id, fbg.fin_bill_spec_item_id, fbg.b_fin_bill_spec_item_id, fbg.role_code, fbg.step_id, fbg.rdd_cul, fbg.modifier_type, fbg.stand_mes_day, fbg.diff_proc, fbg.diff_date, fbg.step_edate, fbg.hsp_is_special, fbg.spec_price_id, fbg.step_diag_code, fbg.mes_id, fbg.care_regimen_id, fbg.duration, fbg.delta, fbg.dayover, fbg.is_sifted, fbg.sifting_cause, fbg.funding_id, fbg.attendant_id, fbg.case_open_date, fbg.tariff, fbg.step_cnt, fbg.item_type, fbg.closing_step_id, fbg.tariff_code, fbg.kdp, fbg.price_position_code, fbg.case_type_id, fbg.init_goal_id, fbg.service_code, fbg.belonging_type, fbg.is_deleted, fbg.case_close_date, fbg.price_pos_arr, fbg.active_policy_issuer_id, fbg.lpu_work_territory_id, fbg.smo_work_territory_id, fbg.srv_cul, fbg.service_type_id, fbg.edate, fbg.rdd_quantity, fbg.price_position_name, fbg.step_admission_date, fbg.step_outcome_date, fbg.csg_type_code, fbg.move_to_additional, fbg.service_name, fbg.from_date, fbg.provision_condition_id, fbg.comment, fbg.tooth_number, fbg.rdd_diagnosis_id, fbg.patient_age, fbg.patient_gender_id, fbg.file_type, fbg.id_pac, fbg.representative_id, fbg.care_level_id, fbg.tariff_name, fbg.item_comment, fbg.price, fbg.n_zap, fbg.payment_method_id, fbg.region_data, fbg.rn
  • Filter: (fbg.rn = 1)
  • Rows Removed by Filter: 0
  • Buffers: shared hit=113236 read=50276
  • I/O Timings: read=97419.575
25. 469.808 98,865.221 ↑ 49.0 1 29,363

WindowAgg (cost=0.56..337.29 rows=49 width=63) (actual time=2.391..3.367 rows=1 loops=29,363)

  • Output: NULL::integer, NULL::integer, NULL::integer, NULL::integer, NULL::integer, NULL::date, NULL::boolean, NULL::integer, NULL::integer, NULL::integer, NULL::integer, NULL::numeric(10,4), NULL::integer, NULL::integer, NULL::date, NULL::integer, NULL::integer, NULL::integer, NULL::character varying(50), fbg_1.step_id, NULL::numeric(10,2), NULL::integer, NULL::integer, NULL::numeric(10,2), NULL::integer, NULL::date, NULL::boolean, NULL::integer, NULL::character varying(50), NULL::integer, NULL::integer, NULL::numeric(19,2), NULL::numeric(19,2), NULL::numeric(19,2), NULL::boolean, NULL::text, NULL::integer, NULL::integer, NULL::date, NULL::numeric(19,2), NULL::integer, fbg_1.item_type, NULL::integer, NULL::character varying(60), NULL::numeric(19,2), NULL::character varying(100), NULL::integer, NULL::integer, NULL::character varying(255), NULL::character varying(20), NULL::boolean, NULL::date, NULL::integer[], NULL::integer, NULL::integer, NULL::integer, NULL::numeric(10,2), NULL::integer, NULL::date, NULL::numeric(10,2), NULL::character varying(255), NULL::date, NULL::date, NULL::character varying(2), NULL::boolean, NULL::character varying(500), NULL::date, NULL::integer, NULL::character varying(255), NULL::character varying(10), NULL::integer, NULL::integer, NULL::integer, NULL::boolean, NULL::character varying(255), NULL::integer, NULL::integer, NULL::text, NULL::text, NULL::numeric(23,6), NULL::integer, NULL::integer, fbg_1.region_data, row_number() OVER (?)
  • Buffers: shared hit=113236 read=50276
  • I/O Timings: read=97419.575
26. 98,395.413 98,395.413 ↑ 49.0 1 29,363

Index Scan using fin_bill_generate_step_id_bill_id_idx on billing.fin_bill_generate fbg_1 (cost=0.56..336.68 rows=49 width=63) (actual time=2.378..3.351 rows=1 loops=29,363)

  • Output: fbg_1.step_id, fbg_1.item_type, fbg_1.region_data
  • Index Cond: (fbg_1.step_id = s.step_id)
  • Filter: (NOT fbg_1.is_sifted)
  • Rows Removed by Filter: 1
  • Buffers: shared hit=113236 read=50276
  • I/O Timings: read=97419.575
27. 645.986 645.986 ↓ 1.1 85 29,363

Seq Scan on public.fin_bill_add_case add_case (cost=0.00..2.80 rows=80 width=19) (actual time=0.007..0.022 rows=85 loops=29,363)

  • Output: add_case.bill_id, add_case.case_id, add_case.add_date, add_case.user_login, add_case.aud_who, add_case.aud_when, add_case.aud_source, add_case.aud_who_create, add_case.aud_when_create, add_case.aud_source_create
  • Buffers: shared hit=58725 read=1
  • I/O Timings: read=0.035
28. 176.178 2,789.485 ↑ 1.0 1 29,363

Limit (cost=0.44..23.74 rows=1 width=377) (actual time=0.095..0.095 rows=1 loops=29,363)

  • Output: c_1.uid, c_1.active_policy_id, (NULL::integer), (NULL::integer), (NULL::integer), (NULL::integer), (NULL::integer), ((SubPlan 9)), ((SubPlan 10)), ((SubPlan 11)), ((SubPlan 12)), ((SubPlan 13)), (NULL::integer), c_1.case_type_code, c_1.last_profile_code, ((c_1.region_data -> '_bedn_prof_record'::text)), c_1.payment_method_code, (NULL::integer), (NULL::text), (NULL::text), ((c_1.region_data -> 'position_name'::text)), ((SubPlan 14)), (NULL::character varying(255))
  • Buffers: shared hit=357645 read=2
  • I/O Timings: read=14.794
29. 880.890 2,613.307 ↑ 1.0 1 29,363

Index Scan using fin_bill_cases_case_id_bill_id_idx on billing.fin_bill_cases c_1 (cost=0.44..23.74 rows=1 width=377) (actual time=0.089..0.089 rows=1 loops=29,363)

  • Output: c_1.uid, c_1.active_policy_id, NULL::integer, NULL::integer, NULL::integer, NULL::integer, NULL::integer, (SubPlan 9), (SubPlan 10), (SubPlan 11), (SubPlan 12), (SubPlan 13), NULL::integer, c_1.case_type_code, c_1.last_profile_code, (c_1.region_data -> '_bedn_prof_record'::text), c_1.payment_method_code, NULL::integer, NULL::text, NULL::text, (c_1.region_data -> 'position_name'::text), (SubPlan 14), NULL::character varying(255)
  • Index Cond: ((c_1.case_id = s.case_id) AND (c_1.bill_id = item.bill_id))
  • Buffers: shared hit=357645 read=2
  • I/O Timings: read=14.794
30.          

SubPlan (for Index Scan)

31. 264.267 264.267 ↑ 1.0 1 29,363

Seq Scan on public.mc_care_level (cost=0.00..1.14 rows=1 width=73) (actual time=0.008..0.009 rows=1 loops=29,363)

  • Output: mc_care_level.name
  • Filter: ((mc_care_level.code)::text = (c_1.care_level_code)::text)
  • Rows Removed by Filter: 11
  • Buffers: shared hit=29363
32. 117.452 117.452 ↑ 1.0 1 29,363

Seq Scan on public.md_care_providing_form (cost=0.00..1.04 rows=1 width=19) (actual time=0.004..0.004 rows=1 loops=29,363)

  • Output: md_care_providing_form.name
  • Filter: ((md_care_providing_form.code)::text = (c_1.care_providing_form_code)::text)
  • Rows Removed by Filter: 2
  • Buffers: shared hit=29363
33. 88.089 234.904 ↑ 1.0 1 29,363

Limit (cost=0.00..2.41 rows=1 width=76) (actual time=0.008..0.008 rows=1 loops=29,363)

  • Output: mc_case_init_goal.name
  • Buffers: shared hit=34018
34. 146.815 146.815 ↑ 1.0 1 29,363

Seq Scan on public.mc_case_init_goal (cost=0.00..2.41 rows=1 width=76) (actual time=0.005..0.005 rows=1 loops=29,363)

  • Output: mc_case_init_goal.name
  • Filter: (mc_case_init_goal.id = c_1.init_goal_id)
  • Rows Removed by Filter: 5
  • Buffers: shared hit=34018
35. 88.089 264.267 ↑ 1.0 1 29,363

Limit (cost=0.00..1.23 rows=1 width=23) (actual time=0.009..0.009 rows=1 loops=29,363)

  • Output: mc_step_care_result.name
  • Buffers: shared hit=29363
36. 176.178 176.178 ↑ 1.0 1 29,363

Seq Scan on public.mc_step_care_result (cost=0.00..1.23 rows=1 width=23) (actual time=0.006..0.006 rows=1 loops=29,363)

  • Output: mc_step_care_result.name
  • Filter: (mc_step_care_result.id = c_1.last_outcome_id)
  • Rows Removed by Filter: 12
  • Buffers: shared hit=29363
37. 58.726 411.082 ↑ 1.0 1 29,363

Limit (cost=0.29..8.31 rows=1 width=122) (actual time=0.014..0.014 rows=1 loops=29,363)

  • Output: ((((md_diagnosis.code)::text || ' '::text) || (md_diagnosis.name)::text))
  • Buffers: shared hit=88723 read=2
  • I/O Timings: read=14.794
38. 352.356 352.356 ↑ 1.0 1 29,363

Index Scan using md_diagnosis_pk on public.md_diagnosis (cost=0.29..8.31 rows=1 width=122) (actual time=0.012..0.012 rows=1 loops=29,363)

  • Output: (((md_diagnosis.code)::text || ' '::text) || (md_diagnosis.name)::text)
  • Index Cond: (md_diagnosis.id = c_1.main_diagnosis_id)
  • Buffers: shared hit=88723 read=2
  • I/O Timings: read=14.794
39. 440.445 440.445 ↑ 1.0 1 29,363

Seq Scan on public.mc_disease_type d_1 (cost=0.00..1.16 rows=1 width=39) (actual time=0.012..0.015 rows=1 loops=29,363)

  • Output: d_1.name
  • Filter: (((d_1.code)::text = (c_1.disease_type_code)::text) AND ((d_1.to_dt >= ('now'::cstring)::date) OR (d_1.to_dt IS NULL)))
  • Rows Removed by Filter: 7
  • Buffers: shared hit=29363
40. 88.089 2,583.944 ↑ 1.0 1 29,363

Limit (cost=0.56..8.59 rows=1 width=53) (actual time=0.088..0.088 rows=1 loops=29,363)

  • Output: ((((((fin_bill_patients.pat_surname)::text || ' '::text) || (fin_bill_patients.pat_name)::text) || ' '::text) || (fin_bill_patients.pat_patr_name)::text)), fin_bill_patients.pat_birth_dt, (NULL::character varying(255)), (NULL::character varying(255)), (NULL::character varying(255)), (NULL::integer)
  • Buffers: shared hit=146136 read=681
  • I/O Timings: read=1681.183
41. 2,495.855 2,495.855 ↑ 1.0 1 29,363

Index Scan using fin_bill_patients_pk on billing.fin_bill_patients (cost=0.56..8.59 rows=1 width=53) (actual time=0.085..0.085 rows=1 loops=29,363)

  • Output: (((((fin_bill_patients.pat_surname)::text || ' '::text) || (fin_bill_patients.pat_name)::text) || ' '::text) || (fin_bill_patients.pat_patr_name)::text), fin_bill_patients.pat_birth_dt, NULL::character varying(255), NULL::character varying(255), NULL::character varying(255), NULL::integer
  • Index Cond: ((fin_bill_patients.bill_id = item.bill_id) AND ((fin_bill_patients.id_pac)::text = (s.id_pac)::text))
  • Buffers: shared hit=146136 read=681
  • I/O Timings: read=1681.183
42. 58.726 1,174.520 ↑ 1.0 1 29,363

Limit (cost=0.43..8.46 rows=1 width=57) (actual time=0.040..0.040 rows=1 loops=29,363)

  • Output: fin_bill_policy.series, fin_bill_policy.number, fin_bill_policy.issuer_short_name, (NULL::integer), (NULL::integer)
  • Buffers: shared hit=116765 read=451
  • I/O Timings: read=706.405
43. 1,115.794 1,115.794 ↑ 1.0 1 29,363

Index Scan using fin_bill_policy_pk on billing.fin_bill_policy (cost=0.43..8.46 rows=1 width=57) (actual time=0.038..0.038 rows=1 loops=29,363)

  • Output: fin_bill_policy.series, fin_bill_policy.number, fin_bill_policy.issuer_short_name, NULL::integer, NULL::integer
  • Index Cond: ((fin_bill_policy.bill_id = item.bill_id) AND (fin_bill_policy.id = c_1.active_policy_id))
  • Buffers: shared hit=116765 read=451
  • I/O Timings: read=706.405
44. 58.726 381.719 ↑ 1.0 1 29,363

Limit (cost=0.29..8.30 rows=1 width=54) (actual time=0.013..0.013 rows=1 loops=29,363)

  • Output: pim_position.department_id, pim_position.name
  • Buffers: shared hit=87989 read=19
  • I/O Timings: read=83.513
45. 322.993 322.993 ↑ 1.0 1 29,363

Index Scan using pim_position_pk on public.pim_position (cost=0.29..8.30 rows=1 width=54) (actual time=0.011..0.011 rows=1 loops=29,363)

  • Output: pim_position.department_id, pim_position.name
  • Index Cond: (pim_position.id = s.position_id)
  • Buffers: shared hit=87989 read=19
  • I/O Timings: read=83.513
46. 58.726 411.082 ↑ 1.0 1 29,363

Limit (cost=0.42..8.44 rows=1 width=0) (actual time=0.014..0.014 rows=1 loops=29,363)

  • Output: (NULL::integer), (NULL::integer), (NULL::integer)
  • Buffers: shared hit=107051 read=10
  • I/O Timings: read=39.025
47. 352.356 352.356 ↑ 1.0 1 29,363

Index Only Scan using sr_service_pk on public.sr_service (cost=0.42..8.44 rows=1 width=0) (actual time=0.012..0.012 rows=1 loops=29,363)

  • Output: NULL::integer, NULL::integer, NULL::integer
  • Index Cond: (sr_service.id = s.service_id)
  • Heap Fetches: 18971
  • Buffers: shared hit=107051 read=10
  • I/O Timings: read=39.025
48. 58.726 293.630 ↑ 1.0 1 29,363

Limit (cost=0.28..8.30 rows=1 width=61) (actual time=0.009..0.010 rows=1 loops=29,363)

  • Output: pim_department.code, pim_department.name
  • Buffers: shared hit=88006 read=2
  • I/O Timings: read=9.384
49. 234.904 234.904 ↑ 1.0 1 29,363

Index Scan using pim_department_pk on public.pim_department (cost=0.28..8.30 rows=1 width=61) (actual time=0.008..0.008 rows=1 loops=29,363)

  • Output: pim_department.code, pim_department.name
  • Index Cond: (pim_department.id = pim_position.department_id)
  • Buffers: shared hit=88006 read=2
  • I/O Timings: read=9.384
50. 29.363 1,115.794 ↑ 1.0 1 29,363

Limit (cost=0.72..16.80 rows=1 width=49) (actual time=0.038..0.038 rows=1 loops=29,363)

  • Output: (NULL::integer), ((((((n.surname)::text || ' '::text) || upper("left"((n.name)::text, 1))) || '.'::text) || COALESCE(((' '::text || upper("left"((n.patr_name)::text, 1))) || '.'::text), ''::text)))
  • Buffers: shared hit=205396 read=2
  • I/O Timings: read=7.648
51. 528.831 1,086.431 ↑ 1.0 1 29,363

Nested Loop (cost=0.72..16.80 rows=1 width=49) (actual time=0.037..0.037 rows=1 loops=29,363)

  • Output: NULL::integer, (((((n.surname)::text || ' '::text) || upper("left"((n.name)::text, 1))) || '.'::text) || COALESCE(((' '::text || upper("left"((n.patr_name)::text, 1))) || '.'::text), ''::text))
  • Buffers: shared hit=205396 read=2
  • I/O Timings: read=7.648
52. 234.904 234.904 ↑ 1.0 1 29,363

Index Scan using pim_employee_pk on public.pim_employee e (cost=0.30..8.31 rows=1 width=4) (actual time=0.008..0.008 rows=1 loops=29,363)

  • 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 = (NULLIF((s.doctor_code)::text, ''::text))::integer)
  • Buffers: shared hit=88007 read=1
  • I/O Timings: read=7.430
53. 322.696 322.696 ↑ 1.0 1 29,336

Index Scan using pim_individual_id_birth_dt_gender_id_idx on public.pim_individual n (cost=0.43..8.45 rows=1 width=53) (actual time=0.011..0.011 rows=1 loops=29,336)

  • Output: n.id, n.birth_dt, n.death_dt, n.has_citizenship, n.name, n.patr_name, n.surname, n.gender_id, n.nationality_id, n.list_identity_doc, n.list_oms_doc, n.list_job_org, n.list_reg_name, n.list_snils, n.list_uid, n.aud_who, n.aud_when, n.aud_source, n.aud_who_create, n.aud_when_create, n.aud_source_create, n.birth_place, n.age_year, n.age_month, n.age_day, n.list_main_contact, n.is_only_birth_year
  • Index Cond: (n.id = e.individual_id)
  • Buffers: shared hit=117389 read=1
  • I/O Timings: read=0.218
54. 117.452 1,174.520 ↑ 1.0 1 29,363

Limit (cost=0.00..10.21 rows=1 width=3) (actual time=0.040..0.040 rows=1 loops=29,363)

  • Output: f.code, (NULL::text)
  • Buffers: shared hit=105355
55. 1,057.068 1,057.068 ↑ 1.0 1 29,363

Seq Scan on public.md_profile f (cost=0.00..10.21 rows=1 width=3) (actual time=0.036..0.036 rows=1 loops=29,363)

  • Output: f.code, NULL::text
  • Filter: ((f.code)::text = (c_1.last_profile_code)::text)
  • Rows Removed by Filter: 112
  • Buffers: shared hit=105355
56. 88.089 411.082 ↑ 1.0 1 29,363

Limit (cost=0.00..3.67 rows=1 width=134) (actual time=0.014..0.014 rows=1 loops=29,363)

  • Output: (NULL::character varying(255)), ((((COALESCE(mpm.code, ''::character varying))::text || ' '::text) || (COALESCE(mpm.name, ''::character varying))::text))
  • Buffers: shared hit=30545
57. 322.993 322.993 ↑ 1.0 1 29,363

Seq Scan on public.mc_payment_method mpm (cost=0.00..3.67 rows=1 width=134) (actual time=0.011..0.011 rows=1 loops=29,363)

  • Output: NULL::character varying(255), (((COALESCE(mpm.code, ''::character varying))::text || ' '::text) || (COALESCE(mpm.name, ''::character varying))::text)
  • Filter: ((mpm.code)::text = (c_1.payment_method_code)::text)
  • Rows Removed by Filter: 26
  • Buffers: shared hit=30545
58.          

SubPlan (for Nested Loop Left Join)

59. 3,024.389 3,024.389 ↑ 1.0 1 29,363

Result (cost=0.00..0.26 rows=1 width=0) (actual time=0.102..0.103 rows=1 loops=29,363)

  • Output: billing.fin_bill__get_item_warning(item.id)
  • Buffers: shared hit=88663 read=41
  • I/O Timings: read=342.737
60. 2,642.670 2,642.670 ↑ 1.0 1 29,363

Result (cost=0.00..0.26 rows=1 width=0) (actual time=0.090..0.090 rows=1 loops=29,363)

  • Output: fin_bill__get_item_errors(item.id)
  • Buffers: shared hit=89802 read=128
  • I/O Timings: read=1253.522
61. 176.178 48,125.957 ↑ 1.0 1 29,363

Limit (cost=8.47..9.72 rows=1 width=23) (actual time=1.639..1.639 rows=1 loops=29,363)

  • Output: n_1.name
  • Buffers: shared hit=121228 read=16259
  • I/O Timings: read=46788.095
62. 380.311 47,949.779 ↑ 1.0 1 29,363

Hash Join (cost=8.47..9.72 rows=1 width=23) (actual time=1.633..1.633 rows=1 loops=29,363)

  • Output: n_1.name
  • Hash Cond: (n_1.id = t.outcome_id)
  • Buffers: shared hit=121228 read=16259
  • I/O Timings: read=46788.095
63. 118.860 118.860 ↑ 1.4 13 19,810

Seq Scan on public.mc_step_care_result n_1 (cost=0.00..1.18 rows=18 width=27) (actual time=0.004..0.006 rows=13 loops=19,810)

  • Output: n_1.id, n_1.code, n_1.name, n_1.e_code, n_1.aud_who, n_1.aud_when, n_1.aud_source, n_1.aud_who_create, n_1.aud_when_create, n_1.aud_source_create, n_1.from_dt, n_1.to_dt, n_1.billing_code
  • Buffers: shared hit=19810
64. 117.452 47,450.608 ↑ 1.0 1 29,363

Hash (cost=8.46..8.46 rows=1 width=4) (actual time=1.616..1.616 rows=1 loops=29,363)

  • Output: t.outcome_id
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=101418 read=16259
  • I/O Timings: read=46788.095
65. 47,333.156 47,333.156 ↑ 1.0 1 29,363

Index Scan using mc_step_pk on public.mc_step t (cost=0.44..8.46 rows=1 width=4) (actual time=1.611..1.612 rows=1 loops=29,363)

  • Output: t.outcome_id
  • Index Cond: (t.id = s.step_id)
  • Buffers: shared hit=101418 read=16259
  • I/O Timings: read=46788.095
66. 29.363 102,388.781 ↑ 1.0 1 29,363

Limit (cost=0.85..16.90 rows=1 width=122) (actual time=3.487..3.487 rows=1 loops=29,363)

  • Output: ((((d.code)::text || ' '::text) || (d.name)::text))
  • Buffers: shared hit=213324 read=20975
  • I/O Timings: read=101243.278
67. 265.752 102,359.418 ↑ 1.0 1 29,363

Nested Loop (cost=0.85..16.90 rows=1 width=122) (actual time=3.486..3.486 rows=1 loops=29,363)

  • Output: (((d.code)::text || ' '::text) || (d.name)::text)
  • Buffers: shared hit=213324 read=20975
  • I/O Timings: read=101243.278
68. 101,830.884 101,830.884 ↑ 1.0 1 29,363

Index Scan using mc_diagnosis_pk on public.mc_diagnosis m (cost=0.56..8.58 rows=1 width=4) (actual time=3.468..3.468 rows=1 loops=29,363)

  • Output: m.diagnos_id
  • Index Cond: (m.id = s.step_main_diagnosis_id)
  • Buffers: shared hit=125093 read=20975
  • I/O Timings: read=101243.278
69. 262.782 262.782 ↑ 1.0 1 29,198

Index Scan using md_diagnosis_pk on public.md_diagnosis d (cost=0.29..8.30 rows=1 width=126) (actual time=0.009..0.009 rows=1 loops=29,198)

  • 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 = m.diagnos_id)
  • Buffers: shared hit=88231
70. 88.089 763.438 ↓ 0.0 0 29,363

Limit (cost=0.00..0.30 rows=1 width=4) (actual time=0.026..0.026 rows=0 loops=29,363)

  • Output: fin_bill_add_case.case_id
  • Buffers: shared hit=58726
71. 675.349 675.349 ↓ 0.0 0 29,363

Seq Scan on public.fin_bill_add_case (cost=0.00..3.00 rows=10 width=4) (actual time=0.023..0.023 rows=0 loops=29,363)

  • Output: fin_bill_add_case.case_id
  • Filter: (fin_bill_add_case.bill_id = item.bill_id)
  • Rows Removed by Filter: 85
  • Buffers: shared hit=58726
72. 58.726 9,660.427 ↓ 0.0 0 29,363

Limit (cost=1.27..17.33 rows=1 width=4) (actual time=0.329..0.329 rows=0 loops=29,363)

  • Output: pci.patient_id
  • Buffers: shared hit=179394 read=2657
  • I/O Timings: read=8923.532
73. 88.133 9,601.701 ↓ 0.0 0 29,363

Nested Loop (cost=1.27..33.39 rows=2 width=4) (actual time=0.327..0.327 rows=0 loops=29,363)

  • Output: pci.patient_id
  • Buffers: shared hit=179394 read=2657
  • I/O Timings: read=8923.532
74. 9,278.708 9,278.708 ↓ 0.0 0 29,363

Index Scan using pci_dispensary_patient_id_idx on public.pci_dispensary pci (cost=0.42..16.47 rows=2 width=4) (actual time=0.309..0.316 rows=0 loops=29,363)

  • Output: pci.id, pci.reg_in_dt, pci.reg_out_dt, pci.diagnosis_id, pci.reg_in_doctor_id, pci.reg_out_doctor_id, pci.med_case_in_id, pci.med_case_out_id, pci.patient_id, pci.reg_out_reason_id, pci.dispensary_group_id, pci.srv_rendered_id, pci.nosol_registr_id, pci.reg_stage_id, pci.clinic_id, pci.aud_who, pci.aud_when, pci.aud_source, pci.aud_who_create, pci.aud_when_create, pci.aud_source_create, pci.is_integrated, pci.periodicity_id
  • Index Cond: (pci.patient_id = s.patient_id)
  • Filter: (pci.reg_out_dt IS NULL)
  • Rows Removed by Filter: 0
  • Buffers: shared hit=97885 read=2657
  • I/O Timings: read=8923.532
75. 36.130 234.860 ↑ 1.0 1 11,743

Materialize (cost=0.85..16.90 rows=1 width=0) (actual time=0.020..0.020 rows=1 loops=11,743)

  • Buffers: shared hit=81509
76. 47.148 198.730 ↑ 1.0 1 11,690

Nested Loop (cost=0.85..16.90 rows=1 width=0) (actual time=0.017..0.017 rows=1 loops=11,690)

  • Buffers: shared hit=81509
77. 105.210 105.210 ↑ 1.0 1 11,690

Index Scan using mc_diagnosis_pk on public.mc_diagnosis mc (cost=0.56..8.58 rows=1 width=4) (actual time=0.009..0.009 rows=1 loops=11,690)

  • Output: mc.diagnos_id
  • Index Cond: (mc.id = s.step_main_diagnosis_id)
  • Buffers: shared hit=57993
78. 46.372 46.372 ↑ 1.0 1 11,593

Index Only Scan using md_diagnosis_pk on public.md_diagnosis md (cost=0.29..8.30 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=11,593)

  • Output: md.id
  • Index Cond: (md.id = mc.diagnos_id)
  • Heap Fetches: 228
  • Buffers: shared hit=23516
79. 0.000 163,816.177 ↓ 0.0 0 29,363

Limit (cost=3.91..26.04 rows=1 width=29) (actual time=5.579..5.579 rows=0 loops=29,363)

  • Output: ((((pi.surname)::text || ' '::text) || (pi.name)::text))
  • Buffers: shared hit=205831 read=24927
  • I/O Timings: read=162005.685
80.          

Initplan (for Limit)

81. 58.726 162,817.835 ↑ 1.0 1 29,363

Limit (cost=0.43..2.91 rows=1 width=18) (actual time=5.545..5.545 rows=1 loops=29,363)

  • Output: (upper((c_2.aud_who)::text)), c_2.aud_when
  • Buffers: shared hit=92570 read=24882
  • I/O Timings: read=161934.680
82. 162,759.109 162,759.109 ↑ 31.0 1 29,363

Index Scan Backward using audit_mc_case_id_aud_who_where_u_i_idx on audit."public$mc_case" c_2 (cost=0.43..77.30 rows=31 width=18) (actual time=5.543..5.543 rows=1 loops=29,363)

  • Output: upper((c_2.aud_who)::text), c_2.aud_when
  • Index Cond: (c_2.id = s.case_id)
  • Buffers: shared hit=92570 read=24882
  • I/O Timings: read=161934.680
83. 69.474 163,786.814 ↓ 0.0 0 29,363

Nested Loop (cost=0.99..23.12 rows=1 width=29) (actual time=5.578..5.578 rows=0 loops=29,363)

  • Output: (((pi.surname)::text || ' '::text) || (pi.name)::text)
  • Buffers: shared hit=205831 read=24927
  • I/O Timings: read=162005.685
84. 163,008.743 163,610.636 ↓ 0.0 0 29,363

Nested Loop (cost=0.56..16.61 rows=1 width=4) (actual time=5.572..5.572 rows=0 loops=29,363)

  • Output: sup.party_id
  • Buffers: shared hit=179168 read=24914
  • I/O Timings: read=161976.908
85. 528.534 528.534 ↓ 0.0 0 29,363

Index Scan using sec_user_login_uq on public.sec_user su (cost=0.28..8.30 rows=1 width=4) (actual time=0.018..0.018 rows=0 loops=29,363)

  • Output: su.id, su.close_dt, su.comment, su.cr_dt, su.email, su.login, su.password, su.version, su.blocked, su.scope_id, su.use_global_context, su.aud_who, su.aud_when, su.aud_source, su.aud_who_create, su.aud_when_create, su.aud_source_create
  • Index Cond: (upper((su.login)::text) = $11)
  • Buffers: shared hit=65379 read=22
  • I/O Timings: read=28.521
86. 73.359 73.359 ↑ 1.0 1 6,669

Index Scan using pk_sec_user_party on public.sec_user_party sup (cost=0.28..8.30 rows=1 width=8) (actual time=0.011..0.011 rows=1 loops=6,669)

  • Output: sup.id, sup.party_id, sup.aud_who, sup.aud_when, sup.aud_source, sup.aud_who_create, sup.aud_when_create, sup.aud_source_create
  • Index Cond: (sup.id = su.id)
  • Buffers: shared hit=21219 read=10
  • I/O Timings: read=13.707
87. 106.704 106.704 ↑ 1.0 1 6,669

Index Scan using pim_individual_pk on public.pim_individual pi (cost=0.43..6.50 rows=1 width=33) (actual time=0.016..0.016 rows=1 loops=6,669)

  • Output: pi.id, pi.birth_dt, pi.death_dt, pi.has_citizenship, pi.name, pi.patr_name, pi.surname, pi.gender_id, pi.nationality_id, pi.list_identity_doc, pi.list_oms_doc, pi.list_job_org, pi.list_reg_name, pi.list_snils, pi.list_uid, pi.aud_who, pi.aud_when, pi.aud_source, pi.aud_who_create, pi.aud_when_create, pi.aud_source_create, pi.birth_place, pi.age_year, pi.age_month, pi.age_day, pi.list_main_contact, pi.is_only_birth_year
  • Index Cond: (pi.id = sup.party_id)
  • Buffers: shared hit=26663 read=13
  • I/O Timings: read=28.777
Planning time : 1,161.370 ms
Execution time : 578,184.544 ms