explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Y1Gs

Settings
# exclusive inclusive rows x rows loops node
1. 0.007 9,542.160 ↓ 50.0 50 1

Limit (cost=60,239.42..60,239.43 rows=1 width=4,105) (actual time=9,542.146..9,542.160 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)), (get_service_name_by_rendered(item.service_id))
  • Buffers: shared hit=3076813
2. 129.756 9,542.153 ↓ 50.0 50 1

Sort (cost=60,239.42..60,239.43 rows=1 width=4,105) (actual time=9,542.144..9,542.153 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)), (get_service_name_by_rendered(item.service_id))
  • Sort Key: (get_service_name_by_rendered(item.service_id)), item.id
  • Sort Method: top-N heapsort Memory: 95kB
  • Buffers: shared hit=3076813
3. 1,199.891 9,412.397 ↓ 29,363.0 29,363 1

Nested Loop Left Join (cost=11,088.33..60,239.41 rows=1 width=4,105) (actual time=38.891..9,412.397 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)), get_service_name_by_rendered(item.service_id)
  • Buffers: shared hit=3076813
4. 33.048 4,747.672 ↓ 29,363.0 29,363 1

Nested Loop Left Join (cost=11,088.33..60,164.73 rows=1 width=4,074) (actual time=37.762..4,747.672 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=1703317
5. 18.669 4,186.090 ↓ 29,363.0 29,363 1

Nested Loop Left Join (cost=11,088.33..60,154.49 rows=1 width=4,074) (actual time=37.699..4,186.090 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=1597962
6. 18.520 3,756.339 ↓ 29,363.0 29,363 1

Nested Loop Left Join (cost=11,087.61..60,137.68 rows=1 width=4,047) (actual time=37.636..3,756.339 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=1392564
7. 31.825 3,620.367 ↓ 29,363.0 29,363 1

Nested Loop Left Join (cost=11,087.33..60,129.36 rows=1 width=3,990) (actual time=37.620..3,620.367 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=1304556
8. 22.896 3,471.090 ↓ 29,363.0 29,363 1

Nested Loop Left Join (cost=11,086.90..60,120.90 rows=1 width=3,994) (actual time=37.596..3,471.090 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=1197495
9. 32.608 3,330.742 ↓ 29,363.0 29,363 1

Nested Loop Left Join (cost=11,086.62..60,112.57 rows=1 width=3,944) (actual time=37.583..3,330.742 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=1109487
10. 19.766 3,121.956 ↓ 29,363.0 29,363 1

Nested Loop Left Join (cost=11,086.18..60,104.10 rows=1 width=3,891) (actual time=37.564..3,121.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, 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=992271
11. 26.690 2,720.471 ↓ 29,363.0 29,363 1

Nested Loop Left Join (cost=11,085.62..60,095.49 rows=1 width=3,862) (actual time=37.506..2,720.471 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=845454
12. 296.611 1,666.076 ↓ 29,363.0 29,363 1

Nested Loop Left Join (cost=11,085.18..60,071.73 rows=1 width=1,170) (actual time=37.384..1,666.076 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=487807
13. 20.659 1,105.198 ↓ 29,363.0 29,363 1

Nested Loop (cost=11,085.18..60,067.93 rows=1 width=1,155) (actual time=37.338..1,105.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, 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=429081
14. 71.202 644.094 ↓ 29,363.0 29,363 1

Nested Loop (cost=11,084.62..59,730.02 rows=1 width=1,096) (actual time=37.296..644.094 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=265569
15. 28.415 514.166 ↓ 29,363.0 29,363 1

Nested Loop (cost=11,084.62..59,728.93 rows=1 width=1,089) (actual time=37.282..514.166 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=236206
16. 43.820 397.662 ↓ 29,363.0 29,363 1

Nested Loop (cost=11,084.34..59,720.62 rows=1 width=1,085) (actual time=37.270..397.662 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=148117
17. 45.980 177.664 ↓ 4,893.8 29,363 1

Hash Join (cost=11,083.90..59,671.29 rows=6 width=1,079) (actual time=37.241..177.664 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=30649
18. 94.535 94.535 ↓ 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=0.036..94.535 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=29519
19. 15.612 37.149 ↓ 2.2 29,363 1

Hash (cost=10,918.34..10,918.34 rows=13,200 width=99) (actual time=37.149..37.149 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=1130
20. 21.537 21.537 ↓ 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,918.34 rows=13,200 width=99) (actual time=0.036..21.537 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=1130
21. 176.178 176.178 ↑ 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.006..0.006 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=117468
22. 88.089 88.089 ↑ 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.002..0.003 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. 58.726 58.726 ↑ 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.001..0.002 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. 58.726 440.445 ↑ 1.0 1 29,363

Subquery Scan on fbg (cost=0.56..337.90 rows=1 width=59) (actual time=0.012..0.015 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=163512
25. 117.452 381.719 ↑ 49.0 1 29,363

WindowAgg (cost=0.56..337.29 rows=49 width=63) (actual time=0.011..0.013 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=163512
26. 264.267 264.267 ↑ 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=0.007..0.009 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=163512
27. 264.267 264.267 ↓ 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.002..0.009 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=58726
28. 58.726 1,027.705 ↑ 1.0 1 29,363

Limit (cost=0.44..23.74 rows=1 width=377) (actual time=0.035..0.035 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=357647
29. 352.356 968.979 ↑ 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.033..0.033 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=357647
30.          

SubPlan (for Index Scan)

31. 88.089 88.089 ↑ 1.0 1 29,363

Seq Scan on public.mc_care_level (cost=0.00..1.14 rows=1 width=73) (actual time=0.003..0.003 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. 29.363 29.363 ↑ 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.001..0.001 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. 29.363 88.089 ↑ 1.0 1 29,363

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

  • Output: mc_case_init_goal.name
  • Buffers: shared hit=34018
34. 58.726 58.726 ↑ 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.002..0.002 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. 29.363 117.452 ↑ 1.0 1 29,363

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

  • Output: mc_step_care_result.name
  • Buffers: shared hit=29363
36. 88.089 88.089 ↑ 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.003..0.003 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. 29.363 146.815 ↑ 1.0 1 29,363

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

  • Output: ((((md_diagnosis.code)::text || ' '::text) || (md_diagnosis.name)::text))
  • Buffers: shared hit=88725
38. 117.452 117.452 ↑ 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.004..0.004 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=88725
39. 146.815 146.815 ↑ 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.004..0.005 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. 58.726 381.719 ↑ 1.0 1 29,363

Limit (cost=0.56..8.59 rows=1 width=53) (actual time=0.013..0.013 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=146817
41. 322.993 322.993 ↑ 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.011..0.011 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=146817
42. 29.363 176.178 ↑ 1.0 1 29,363

Limit (cost=0.43..8.46 rows=1 width=57) (actual time=0.006..0.006 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=117216
43. 146.815 146.815 ↑ 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.005..0.005 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=117216
44. 29.363 117.452 ↑ 1.0 1 29,363

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

  • Output: pim_position.department_id, pim_position.name
  • Buffers: shared hit=88008
45. 88.089 88.089 ↑ 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.003..0.003 rows=1 loops=29,363)

  • Output: pim_position.department_id, pim_position.name
  • Index Cond: (pim_position.id = s.position_id)
  • Buffers: shared hit=88008
46. 29.363 117.452 ↑ 1.0 1 29,363

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

  • Output: (NULL::integer), (NULL::integer), (NULL::integer)
  • Buffers: shared hit=107061
47. 88.089 88.089 ↑ 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.003..0.003 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=107061
48. 29.363 117.452 ↑ 1.0 1 29,363

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

  • Output: pim_department.code, pim_department.name
  • Buffers: shared hit=88008
49. 88.089 88.089 ↑ 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.003..0.003 rows=1 loops=29,363)

  • Output: pim_department.code, pim_department.name
  • Index Cond: (pim_department.id = pim_position.department_id)
  • Buffers: shared hit=88008
50. 29.363 411.082 ↑ 1.0 1 29,363

Limit (cost=0.72..16.80 rows=1 width=49) (actual time=0.014..0.014 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=205398
51. 176.286 381.719 ↑ 1.0 1 29,363

Nested Loop (cost=0.72..16.80 rows=1 width=49) (actual time=0.013..0.013 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=205398
52. 88.089 88.089 ↑ 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.003..0.003 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=88008
53. 117.344 117.344 ↑ 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.004..0.004 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=117390
54. 58.726 528.534 ↑ 1.0 1 29,363

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

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

Seq Scan on public.md_profile f (cost=0.00..10.21 rows=1 width=3) (actual time=0.016..0.016 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. 29.363 176.178 ↑ 1.0 1 29,363

Limit (cost=0.00..3.67 rows=1 width=134) (actual time=0.006..0.006 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. 146.815 146.815 ↑ 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.005..0.005 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. 822.164 822.164 ↑ 1.0 1 29,363

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

  • Output: billing.fin_bill__get_item_warning(item.id)
  • Buffers: shared hit=88595
60. 528.534 528.534 ↑ 1.0 1 29,363

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

  • Output: fin_bill__get_item_errors(item.id)
  • Buffers: shared hit=89803
61. 58.726 469.808 ↑ 1.0 1 29,363

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

  • Output: n_1.name
  • Buffers: shared hit=137487
62. 165.921 411.082 ↑ 1.0 1 29,363

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

  • Output: n_1.name
  • Hash Cond: (n_1.id = t.outcome_id)
  • Buffers: shared hit=137487
63. 39.620 39.620 ↑ 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.002..0.002 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. 29.363 205.541 ↑ 1.0 1 29,363

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

  • Output: t.outcome_id
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=117677
65. 176.178 176.178 ↑ 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=0.006..0.006 rows=1 loops=29,363)

  • Output: t.outcome_id
  • Index Cond: (t.id = s.step_id)
  • Buffers: shared hit=117677
66. 0.000 322.993 ↑ 1.0 1 29,363

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

  • Output: ((((d.code)::text || ' '::text) || (d.name)::text))
  • Buffers: shared hit=234299
67. 59.221 322.993 ↑ 1.0 1 29,363

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

  • Output: (((d.code)::text || ' '::text) || (d.name)::text)
  • Buffers: shared hit=234299
68. 176.178 176.178 ↑ 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=0.006..0.006 rows=1 loops=29,363)

  • Output: m.diagnos_id
  • Index Cond: (m.id = s.step_main_diagnosis_id)
  • Buffers: shared hit=146068
69. 87.594 87.594 ↑ 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.003..0.003 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. 29.363 322.993 ↓ 0.0 0 29,363

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

  • Output: fin_bill_add_case.case_id
  • Buffers: shared hit=58726
71. 293.630 293.630 ↓ 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.010..0.010 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. 0.000 264.267 ↓ 0.0 0 29,363

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

  • Output: pci.patient_id
  • Buffers: shared hit=182051
73. 35.251 264.267 ↓ 0.0 0 29,363

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

  • Output: pci.patient_id
  • Buffers: shared hit=182051
74. 146.815 146.815 ↓ 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.005..0.005 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=100542
75. 12.061 82.201 ↑ 1.0 1 11,743

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

  • Buffers: shared hit=81509
76. 11.884 70.140 ↑ 1.0 1 11,690

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

  • Buffers: shared hit=81509
77. 35.070 35.070 ↑ 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.003..0.003 rows=1 loops=11,690)

  • Output: mc.diagnos_id
  • Index Cond: (mc.id = s.step_main_diagnosis_id)
  • Buffers: shared hit=57993
78. 23.186 23.186 ↑ 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.002..0.002 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 557.897 ↓ 0.0 0 29,363

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

  • Output: ((((pi.surname)::text || ' '::text) || (pi.name)::text))
  • Buffers: shared hit=230758
80.          

Initplan (for Limit)

81. 29.363 264.267 ↑ 1.0 1 29,363

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

  • Output: (upper((c_2.aud_who)::text)), c_2.aud_when
  • Buffers: shared hit=117452
82. 234.904 234.904 ↑ 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=0.008..0.008 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=117452
83. 32.050 557.897 ↓ 0.0 0 29,363

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

  • Output: (((pi.surname)::text || ' '::text) || (pi.name)::text)
  • Buffers: shared hit=230758
84. 302.986 499.171 ↓ 0.0 0 29,363

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

  • Output: sup.party_id
  • Buffers: shared hit=204082
85. 176.178 176.178 ↓ 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.006..0.006 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=65401
86. 20.007 20.007 ↑ 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.003..0.003 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=21229
87. 26.676 26.676 ↑ 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.004..0.004 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=26676
Planning time : 12.763 ms
Execution time : 9,543.414 ms