explain.depesz.com

PostgreSQL's explain analyze made readable

Result: pcXU

Settings
# exclusive inclusive rows x rows loops node
1. 0.004 15,320.366 ↓ 0.0 0 1

Limit (cost=460,557.61..460,557.62 rows=1 width=969) (actual time=15,320.366..15,320.366 rows=0 loops=1)

  • Output: mr.id, mrrt.name, (CASE WHEN mrt.is_laboratory THEN 'лаб. исследования'::text WHEN ((mrt.code)::text = '2'::text) THEN 'на госпитализацию'::text WHEN ((mrt.code)::text = '5'::text) THEN 'на экспертизу'::text WHEN ((mrt.code)::text = '10'::text) THEN 'на ЦВКК'::text WHEN ((mrt.code)::text = '11'::text) THEN 'на 2 этап диспансеризации'::text ELSE regexp_replace((mrt.name)::text, 'направление '::text, ''::text, 'i'::text) END), ms.case_id, ms.id, mr.order_number, (to_char(mr.referral_date, 'DD.MM.YYYY HH24:MI'::text)), mr.referral_date, (CASE WHEN (mr.status_id = 4) THEN true ELSE false END), po.id, po.full_name, pd.id, pd.name, mr.recv_doctor_id, ((SubPlan 1)), md.id, ((((md.code)::text || ' '::text) || (md.name)::text)), mr.is_urgent, ((SubPlan 8)), ((SubPlan 9)), ((SubPlan 10)), mr.patient_id, mr.referral_type_id, (CASE WHEN (SubPlan 11) THEN true ELSE false END), (CASE WHEN (SubPlan 12) THEN true ELSE false END), ($19), ffst.id, ((SubPlan 14)), ((SubPlan 15)), mr.comment, ((SubPlan 16)), ((SubPlan 17)), ((SubPlan 18)), ('68'), (NULL::unknown), (CASE WHEN (68 <> po.id) THEN CASE WHEN (((SubPlan 19) <> 1) OR ((SubPlan 20) <> 1)) THEN NULL::integer ELSE CASE WHEN ((SubPlan 22) = 1) THEN (SubPlan 24) ELSE NULL::integer END END ELSE CASE WHEN ((SubPlan 25) IS NOT NULL) THEN CASE WHEN ((SubPlan 26) IS NOT NULL) THEN NULL::integer ELSE (SubPlan 27) END ELSE CASE WHEN ((SubPlan 28) <> 1) THEN NULL::integer ELSE (SubPlan 29) END END END)
  • Buffers: shared hit=3,734 read=115,484 dirtied=27 written=9
  • I/O Timings: read=1,724.868 write=0.807
2.          

Initplan (for Limit)

3. 0.000 0.000 ↓ 0.0 0

Seq Scan on public.pim_party_role ppr (cost=0.00..1.30 rows=1 width=4) (never executed)

  • Output: ppr.id
  • Filter: ((ppr.code)::text = 'CLINIC_ORGANIZATION'::text)
4. 0.109 15,320.362 ↓ 0.0 0 1

Sort (cost=460,556.31..460,556.32 rows=1 width=969) (actual time=15,320.362..15,320.362 rows=0 loops=1)

  • Output: mr.id, mrrt.name, (CASE WHEN mrt.is_laboratory THEN 'лаб. исследования'::text WHEN ((mrt.code)::text = '2'::text) THEN 'на госпитализацию'::text WHEN ((mrt.code)::text = '5'::text) THEN 'на экспертизу'::text WHEN ((mrt.code)::text = '10'::text) THEN 'на ЦВКК'::text WHEN ((mrt.code)::text = '11'::text) THEN 'на 2 этап диспансеризации'::text ELSE regexp_replace((mrt.name)::text, 'направление '::text, ''::text, 'i'::text) END), ms.case_id, ms.id, mr.order_number, (to_char(mr.referral_date, 'DD.MM.YYYY HH24:MI'::text)), mr.referral_date, (CASE WHEN (mr.status_id = 4) THEN true ELSE false END), po.id, po.full_name, pd.id, pd.name, mr.recv_doctor_id, ((SubPlan 1)), md.id, ((((md.code)::text || ' '::text) || (md.name)::text)), mr.is_urgent, ((SubPlan 8)), ((SubPlan 9)), ((SubPlan 10)), mr.patient_id, mr.referral_type_id, (CASE WHEN (SubPlan 11) THEN true ELSE false END), (CASE WHEN (SubPlan 12) THEN true ELSE false END), ($19), ffst.id, ((SubPlan 14)), ((SubPlan 15)), mr.comment, ((SubPlan 16)), ((SubPlan 17)), ((SubPlan 18)), ('68'), (NULL::unknown), (CASE WHEN (68 <> po.id) THEN CASE WHEN (((SubPlan 19) <> 1) OR ((SubPlan 20) <> 1)) THEN NULL::integer ELSE CASE WHEN ((SubPlan 22) = 1) THEN (SubPlan 24) ELSE NULL::integer END END ELSE CASE WHEN ((SubPlan 25) IS NOT NULL) THEN CASE WHEN ((SubPlan 26) IS NOT NULL) THEN NULL::integer ELSE (SubPlan 27) END ELSE CASE WHEN ((SubPlan 28) <> 1) THEN NULL::integer ELSE (SubPlan 29) END END END)
  • Sort Key: mr.id
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=3,734 read=115,484 dirtied=27 written=9
  • I/O Timings: read=1,724.868 write=0.807
5. 0.026 15,320.253 ↓ 0.0 0 1

Nested Loop Left Join (cost=6,477.40..460,556.30 rows=1 width=969) (actual time=15,320.253..15,320.253 rows=0 loops=1)

  • Output: mr.id, mrrt.name, CASE WHEN mrt.is_laboratory THEN 'лаб. исследования'::text WHEN ((mrt.code)::text = '2'::text) THEN 'на госпитализацию'::text WHEN ((mrt.code)::text = '5'::text) THEN 'на экспертизу'::text WHEN ((mrt.code)::text = '10'::text) THEN 'на ЦВКК'::text WHEN ((mrt.code)::text = '11'::text) THEN 'на 2 этап диспансеризации'::text ELSE regexp_replace((mrt.name)::text, 'направление '::text, ''::text, 'i'::text) END, ms.case_id, ms.id, mr.order_number, to_char(mr.referral_date, 'DD.MM.YYYY HH24:MI'::text), mr.referral_date, CASE WHEN (mr.status_id = 4) THEN true ELSE false END, po.id, po.full_name, pd.id, pd.name, mr.recv_doctor_id, (SubPlan 1), md.id, (((md.code)::text || ' '::text) || (md.name)::text), mr.is_urgent, (SubPlan 8), (SubPlan 9), (SubPlan 10), mr.patient_id, mr.referral_type_id, CASE WHEN (SubPlan 11) THEN true ELSE false END, CASE WHEN (SubPlan 12) THEN true ELSE false END, $19, ffst.id, (SubPlan 14), (SubPlan 15), mr.comment, (SubPlan 16), (SubPlan 17), (SubPlan 18), '68', NULL::unknown, CASE WHEN (68 <> po.id) THEN CASE WHEN (((SubPlan 19) <> 1) OR ((SubPlan 20) <> 1)) THEN NULL::integer ELSE CASE WHEN ((SubPlan 22) = 1) THEN (SubPlan 24) ELSE NULL::integer END END ELSE CASE WHEN ((SubPlan 25) IS NOT NULL) THEN CASE WHEN ((SubPlan 26) IS NOT NULL) THEN NULL::integer ELSE (SubPlan 27) END ELSE CASE WHEN ((SubPlan 28) <> 1) THEN NULL::integer ELSE (SubPlan 29) END END END
  • Join Filter: (mr.referral_type_id = mrt.id)
  • Buffers: shared hit=3,731 read=115,484 dirtied=27 written=9
  • I/O Timings: read=1,724.868 write=0.807
6. 597.973 15,320.227 ↓ 0.0 0 1

Hash Join (cost=6,477.40..459,657.70 rows=1 width=898) (actual time=15,320.227..15,320.227 rows=0 loops=1)

  • Output: mr.id, mr.order_number, mr.referral_date, mr.status_id, mr.recv_doctor_id, mr.is_urgent, mr.patient_id, mr.referral_type_id, mr.comment, mrrt.name, po.id, po.full_name, pd.id, pd.name, md.id, md.code, md.name, ffst.id, ms.case_id, ms.id
  • Hash Cond: (mr.step_id = ms.id)
  • Buffers: shared hit=3,731 read=115,484 dirtied=27 written=9
  • I/O Timings: read=1,724.868 write=0.807
7. 1,869.988 14,722.062 ↑ 1.0 4,957,319 1

Hash Left Join (cost=6,467.04..440,918.68 rows=4,994,305 width=894) (actual time=182.250..14,722.062 rows=4,957,319 loops=1)

  • Output: mr.id, mr.order_number, mr.referral_date, mr.status_id, mr.recv_doctor_id, mr.is_urgent, mr.patient_id, mr.referral_type_id, mr.comment, mr.step_id, mrrt.name, po.id, po.full_name, pd.id, pd.name, md.id, md.code, md.name, ffst.id
  • Hash Cond: (mr.funding_id = ffst.id)
  • Buffers: shared hit=3,728 read=115,482 dirtied=27 written=9
  • I/O Timings: read=1,724.821 write=0.807
8. 2,033.367 12,852.054 ↑ 1.0 4,957,319 1

Hash Left Join (cost=6,465.86..389,196.48 rows=4,994,305 width=894) (actual time=182.198..12,852.054 rows=4,957,319 loops=1)

  • Output: mr.id, mr.order_number, mr.referral_date, mr.status_id, mr.recv_doctor_id, mr.is_urgent, mr.patient_id, mr.referral_type_id, mr.comment, mr.funding_id, mr.step_id, mrrt.name, po.id, po.full_name, pd.id, pd.name, md.id, md.code, md.name
  • Hash Cond: (mr.diagnosis_id = md.id)
  • Buffers: shared hit=3,727 read=115,482 dirtied=27 written=9
  • I/O Timings: read=1,724.821 write=0.807
9. 1,947.456 10,798.435 ↑ 1.0 4,957,319 1

Hash Left Join (cost=5,744.62..353,738.20 rows=4,994,305 width=795) (actual time=161.770..10,798.435 rows=4,957,319 loops=1)

  • Output: mr.id, mr.order_number, mr.referral_date, mr.status_id, mr.recv_doctor_id, mr.is_urgent, mr.patient_id, mr.referral_type_id, mr.comment, mr.diagnosis_id, mr.funding_id, mr.step_id, mrrt.name, po.id, po.full_name, pd.id, pd.name
  • Hash Cond: (mr.department_id = pd.id)
  • Buffers: shared hit=3,352 read=115,482 dirtied=27 written=9
  • I/O Timings: read=1,724.821 write=0.807
10. 2,226.998 8,837.832 ↑ 1.0 4,957,319 1

Hash Left Join (cost=5,232.12..306,988.42 rows=4,994,305 width=750) (actual time=148.424..8,837.832 rows=4,957,319 loops=1)

  • Output: mr.id, mr.order_number, mr.referral_date, mr.status_id, mr.recv_doctor_id, mr.is_urgent, mr.patient_id, mr.referral_type_id, mr.comment, mr.department_id, mr.diagnosis_id, mr.funding_id, mr.step_id, mrrt.name, po.id, po.full_name
  • Hash Cond: (mr.recv_organization_id = po.id)
  • Buffers: shared hit=3,127 read=115,482 dirtied=27 written=9
  • I/O Timings: read=1,724.821 write=0.807
11. 2,692.875 6,463.592 ↑ 1.0 4,957,319 1

Hash Left Join (cost=12.47..234,004.38 rows=4,994,305 width=661) (actual time=0.083..6,463.592 rows=4,957,319 loops=1)

  • Output: mr.id, mr.order_number, mr.referral_date, mr.status_id, mr.recv_doctor_id, mr.is_urgent, mr.patient_id, mr.referral_type_id, mr.comment, mr.recv_organization_id, mr.department_id, mr.diagnosis_id, mr.funding_id, mr.step_id, mrrt.name
  • Hash Cond: (mr.referral_type_id = mrrt.referral_type_id)
  • Buffers: shared hit=35 read=115,482 dirtied=27 written=9
  • I/O Timings: read=1,724.821 write=0.807
12. 3,770.716 3,770.716 ↑ 1.0 4,957,319 1

Seq Scan on public.md_referral mr (cost=0.00..165,460.05 rows=4,994,305 width=149) (actual time=0.059..3,770.716 rows=4,957,319 loops=1)

  • Output: mr.id, mr.diagnosis_comment, mr.is_urgent, mr.order_number, mr.referral_comment, mr.referral_date, mr.diagnosis_id, mr.ref_doctor_id, mr.funding_id, mr.ref_organization_id, mr.patient_id, mr.prescription_id, mr.recv_organization_id, mr.recv_doctor_id, mr.service_pat_id, mr.referral_type_id, mr.department_id, mr.note, mr.step_id, mr.service_id, mr.goal_id, mr.recv_res_group_id, mr.date_cancel, mr.cancel_reason_id, mr.cancel_source_id, mr.ref_department_id, mr.comment, mr.status_id, mr.cancel_reason_detail, mr.cancel_source_org, mr.cancel_source_dep, mr.aud_who, mr.aud_when, mr.aud_source, mr.aud_who_create, mr.aud_when_create, mr.aud_source_create, mr.clinical_form_id, mr.localization_id, mr.complication_id, mr.recv_regimen_id, mr.ref_organization_role_id, mr.case_id, mr.receiving_speciality_id, mr.is_operation_required, mr.ref_organization_code, mr.ref_doctor_code, mr.ref_status_id, mr.send_date, mr.vmp_profile_id, mr.vmp_kind_id, mr.profile_id, mr.bed_profile_id, mr.proposed_date
  • Buffers: shared hit=35 read=115,482 dirtied=27 written=9
  • I/O Timings: read=1,724.821 write=0.807
13. 0.001 0.001 ↓ 0.0 0 1

Hash (cost=11.10..11.10 rows=110 width=520) (actual time=0.001..0.001 rows=0 loops=1)

  • Output: mrrt.name, mrrt.referral_type_id
  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
14. 0.000 0.000 ↓ 0.0 0 1

Seq Scan on public.md_report_referral_type mrrt (cost=0.00..11.10 rows=110 width=520) (actual time=0.000..0.000 rows=0 loops=1)

  • Output: mrrt.name, mrrt.referral_type_id
15. 62.622 147.242 ↑ 1.0 94,543 1

Hash (cost=4,037.62..4,037.62 rows=94,562 width=93) (actual time=147.242..147.242 rows=94,543 loops=1)

  • Output: po.id, po.full_name
  • Buckets: 131,072 Batches: 1 Memory Usage: 12,646kB
  • Buffers: shared hit=3,092
16. 84.620 84.620 ↑ 1.0 94,543 1

Seq Scan on public.pim_organization po (cost=0.00..4,037.62 rows=94,562 width=93) (actual time=0.044..84.620 rows=94,543 loops=1)

  • Output: po.id, po.full_name
  • Buffers: shared hit=3,092
17. 5.058 13.147 ↑ 1.0 12,778 1

Hash (cost=352.78..352.78 rows=12,778 width=49) (actual time=13.147..13.147 rows=12,778 loops=1)

  • Output: pd.id, pd.name
  • Buckets: 16,384 Batches: 1 Memory Usage: 1,144kB
  • Buffers: shared hit=225
18. 8.089 8.089 ↑ 1.0 12,778 1

Seq Scan on public.pim_department pd (cost=0.00..352.78 rows=12,778 width=49) (actual time=0.040..8.089 rows=12,778 loops=1)

  • Output: pd.id, pd.name
  • Buffers: shared hit=225
19. 9.052 20.252 ↑ 1.0 15,388 1

Hash (cost=528.88..528.88 rows=15,388 width=103) (actual time=20.252..20.252 rows=15,388 loops=1)

  • Output: md.id, md.code, md.name
  • Buckets: 16,384 Batches: 1 Memory Usage: 2,175kB
  • Buffers: shared hit=375
20. 11.200 11.200 ↑ 1.0 15,388 1

Seq Scan on public.md_diagnosis md (cost=0.00..528.88 rows=15,388 width=103) (actual time=0.020..11.200 rows=15,388 loops=1)

  • Output: md.id, md.code, md.name
  • Buffers: shared hit=375
21. 0.008 0.020 ↑ 1.0 8 1

Hash (cost=1.08..1.08 rows=8 width=4) (actual time=0.020..0.020 rows=8 loops=1)

  • Output: ffst.id
  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=1
22. 0.012 0.012 ↑ 1.0 8 1

Seq Scan on public.fin_funding_source_type ffst (cost=0.00..1.08 rows=8 width=4) (actual time=0.008..0.012 rows=8 loops=1)

  • Output: ffst.id
  • Buffers: shared hit=1
23. 0.018 0.192 ↑ 6.0 1 1

Hash (cost=10.29..10.29 rows=6 width=8) (actual time=0.192..0.192 rows=1 loops=1)

  • Output: ms.case_id, ms.id
  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=3 read=2
  • I/O Timings: read=0.047
24. 0.174 0.174 ↑ 6.0 1 1

Index Scan using idx_mc_step on public.mc_step ms (cost=0.56..10.29 rows=6 width=8) (actual time=0.172..0.174 rows=1 loops=1)

  • Output: ms.case_id, ms.id
  • Index Cond: (ms.case_id = 32,988,140)
  • Buffers: shared hit=3 read=2
  • I/O Timings: read=0.047
25. 0.000 0.000 ↓ 0.0 0

Seq Scan on public.md_referral_type mrt (cost=0.00..1.31 rows=31 width=75) (never executed)

  • Output: mrt.id, mrt.code, mrt.name, mrt.scope_id, mrt.e_code, mrt.hsp_rsv_mark, mrt.from_dt, mrt.to_dt, mrt.app_code, mrt.aud_who, mrt.aud_when, mrt.aud_source, mrt.aud_who_create, mrt.aud_when_create, mrt.aud_source_create, mrt.is_laboratory, mrt.is_vk
26.          

SubPlan (for Nested Loop Left Join)

27. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=1.01..21.20 rows=1 width=50) (never executed)

  • Output: (((((pi1.surname)::text || ' '::text) || "left"(initcap((pi1.name)::text), 1)) || '. '::text) || "left"(initcap((pi1.patr_name)::text), 1))
28. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=0.58..16.62 rows=1 width=4) (never executed)

  • Output: pe1.individual_id
29. 0.000 0.000 ↓ 0.0 0

Index Scan using pim_employee_position_pk on public.pim_employee_position pep1 (cost=0.29..8.31 rows=1 width=4) (never executed)

  • Output: pep1.id, pep1.dismissal_order_code, pep1.start_date, pep1.hiring_order_code, pep1.rate, pep1.end_date, pep1.dismissal_reason_id, pep1.employee_id, pep1.employment_type_id, pep1.hiring_type_id, pep1.position_id, pep1.position_type_id, pep1.unit_id, pep1.code, pep1.aud_who, pep1.aud_when, pep1.aud_source, pep1.aud_who_create, pep1.aud_when_create, pep1.aud_source_create, pep1.pref_prescription, pep1.extra_payment, pep1.target_training, pep1.leaving_reason_id
  • Index Cond: (pep1.id = mr.recv_doctor_id)
30. 0.000 0.000 ↓ 0.0 0

Index Scan using pim_employee_pk on public.pim_employee pe1 (cost=0.29..8.31 rows=1 width=8) (never executed)

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

Index Scan using pim_individual_pk on public.pim_individual pi1 (cost=0.43..4.55 rows=1 width=54) (never executed)

  • Output: pi1.id, pi1.birth_dt, pi1.death_dt, pi1.has_citizenship, pi1.name, pi1.patr_name, pi1.surname, pi1.gender_id, pi1.nationality_id, pi1.list_identity_doc, pi1.list_oms_doc, pi1.list_job_org, pi1.list_reg_name, pi1.list_snils, pi1.list_uid, pi1.aud_who, pi1.aud_when, pi1.aud_source, pi1.aud_who_create, pi1.aud_when_create, pi1.aud_source_create, pi1.birth_place, pi1.age_year, pi1.age_month, pi1.age_day, pi1.list_main_contact
  • Index Cond: (pe1.individual_id = pi1.id)
32. 0.000 0.000 ↓ 0.0 0

Result (cost=180.16..180.18 rows=1 width=0) (never executed)

  • Output: CASE WHEN ($4 IS TRUE) THEN (($6 || '; '::text) || $9) ELSE $12 END
33.          

Initplan (for Result)

34. 0.000 0.000 ↓ 0.0 0

Index Scan using md_referral_service_referral_id_idx on public.md_referral_service mrsx (cost=0.43..9.11 rows=1 width=0) (never executed)

  • Index Cond: (mrsx.referral_id = mr.id)
  • Filter: (mrsx.main_complex IS TRUE)
35. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.86..17.57 rows=1 width=176) (never executed)

  • Output: (concat('[+] ', ss.name))
36. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.86..17.57 rows=1 width=176) (never executed)

  • Output: concat('[+] ', ss.name)
37. 0.000 0.000 ↓ 0.0 0

Index Scan using md_referral_service_referral_id_idx on public.md_referral_service mrs1 (cost=0.43..9.11 rows=1 width=4) (never executed)

  • Output: mrs1.id, mrs1.comment, mrs1.referral_id, mrs1.service_id, mrs1.service_prototype_id, mrs1.aud_who, mrs1.aud_when, mrs1.aud_source, mrs1.aud_who_create, mrs1.aud_when_create, mrs1.aud_source_create, mrs1.biomaterial_id, mrs1.main_complex, mrs1.biomaterial_dt, mrs1.complex_id, mrs1.building_id, mrs1.room_id
  • Index Cond: (mrs1.referral_id = mr.id)
  • Filter: (mrs1.main_complex IS TRUE)
38. 0.000 0.000 ↓ 0.0 0

Index Scan using sr_service_pk on public.sr_service ss (cost=0.42..8.44 rows=1 width=180) (never executed)

  • Output: ss.id, ss.code, ss.cul, ss.is_death, ss.duration, ss.is_fictitious, ss.is_independent, ss.is_multuplicity, ss.name, ss.terms, ss.org_id, ss.category_id, ss.duration_unit_id, ss.prototype_id, ss.type_id, ss.from_dt, ss.to_dt, ss.is_repeated, ss.is_inherit_protocol, ss.is_expendable_materials, ss.is_actual_cul, ss.is_paraclinical, ss.is_complex, ss.accounting_id, ss.is_autocopy_diagnoses, ss.is_stomat, ss.srg_dif_type_id, ss.srg_opr_kind_id, ss.is_need_anatomic_zone, ss.aud_who, ss.aud_when, ss.aud_source, ss.aud_who_create, ss.aud_when_create, ss.aud_source_create, ss.is_filling, ss.is_extraction, ss.is_need_close_date, ss.is_vmp, ss.short_name
  • Index Cond: (ss.id = mrs1.service_id)
39. 0.000 0.000 ↓ 0.0 0

Result (cost=76.73..76.74 rows=1 width=0) (never executed)

  • Output: array_to_string($8, '; '::text)
40.          

Initplan (for Result)

41. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.86..76.73 rows=8 width=176) (never executed)

  • Output: ss_1.name
42. 0.000 0.000 ↓ 0.0 0

Index Scan using md_referral_service_referral_id_idx on public.md_referral_service mrs1_1 (cost=0.43..9.11 rows=8 width=4) (never executed)

  • Output: mrs1_1.id, mrs1_1.comment, mrs1_1.referral_id, mrs1_1.service_id, mrs1_1.service_prototype_id, mrs1_1.aud_who, mrs1_1.aud_when, mrs1_1.aud_source, mrs1_1.aud_who_create, mrs1_1.aud_when_create, mrs1_1.aud_source_create, mrs1_1.biomaterial_id, mrs1_1.main_complex, mrs1_1.biomaterial_dt, mrs1_1.complex_id, mrs1_1.building_id, mrs1_1.room_id
  • Index Cond: (mrs1_1.referral_id = mr.id)
  • Filter: ((mrs1_1.complex_id IS NULL) AND (mrs1_1.main_complex IS NOT TRUE))
43. 0.000 0.000 ↓ 0.0 0

Index Scan using sr_service_pk on public.sr_service ss_1 (cost=0.42..8.44 rows=1 width=180) (never executed)

  • Output: ss_1.id, ss_1.code, ss_1.cul, ss_1.is_death, ss_1.duration, ss_1.is_fictitious, ss_1.is_independent, ss_1.is_multuplicity, ss_1.name, ss_1.terms, ss_1.org_id, ss_1.category_id, ss_1.duration_unit_id, ss_1.prototype_id, ss_1.type_id, ss_1.from_dt, ss_1.to_dt, ss_1.is_repeated, ss_1.is_inherit_protocol, ss_1.is_expendable_materials, ss_1.is_actual_cul, ss_1.is_paraclinical, ss_1.is_complex, ss_1.accounting_id, ss_1.is_autocopy_diagnoses, ss_1.is_stomat, ss_1.srg_dif_type_id, ss_1.srg_opr_kind_id, ss_1.is_need_anatomic_zone, ss_1.aud_who, ss_1.aud_when, ss_1.aud_source, ss_1.aud_who_create, ss_1.aud_when_create, ss_1.aud_source_create, ss_1.is_filling, ss_1.is_extraction, ss_1.is_need_close_date, ss_1.is_vmp, ss_1.short_name
  • Index Cond: (ss_1.id = mrs1_1.service_id)
44. 0.000 0.000 ↓ 0.0 0

Result (cost=76.73..76.74 rows=1 width=0) (never executed)

  • Output: array_to_string($11, '; '::text)
45.          

Initplan (for Result)

46. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.86..76.73 rows=8 width=176) (never executed)

  • Output: ss_2.name
47. 0.000 0.000 ↓ 0.0 0

Index Scan using md_referral_service_referral_id_idx on public.md_referral_service mrs1_2 (cost=0.43..9.11 rows=8 width=4) (never executed)

  • Output: mrs1_2.id, mrs1_2.comment, mrs1_2.referral_id, mrs1_2.service_id, mrs1_2.service_prototype_id, mrs1_2.aud_who, mrs1_2.aud_when, mrs1_2.aud_source, mrs1_2.aud_who_create, mrs1_2.aud_when_create, mrs1_2.aud_source_create, mrs1_2.biomaterial_id, mrs1_2.main_complex, mrs1_2.biomaterial_dt, mrs1_2.complex_id, mrs1_2.building_id, mrs1_2.room_id
  • Index Cond: (mrs1_2.referral_id = mr.id)
  • Filter: ((mrs1_2.complex_id IS NULL) AND (mrs1_2.main_complex IS NOT TRUE))
48. 0.000 0.000 ↓ 0.0 0

Index Scan using sr_service_pk on public.sr_service ss_2 (cost=0.42..8.44 rows=1 width=180) (never executed)

  • Output: ss_2.id, ss_2.code, ss_2.cul, ss_2.is_death, ss_2.duration, ss_2.is_fictitious, ss_2.is_independent, ss_2.is_multuplicity, ss_2.name, ss_2.terms, ss_2.org_id, ss_2.category_id, ss_2.duration_unit_id, ss_2.prototype_id, ss_2.type_id, ss_2.from_dt, ss_2.to_dt, ss_2.is_repeated, ss_2.is_inherit_protocol, ss_2.is_expendable_materials, ss_2.is_actual_cul, ss_2.is_paraclinical, ss_2.is_complex, ss_2.accounting_id, ss_2.is_autocopy_diagnoses, ss_2.is_stomat, ss_2.srg_dif_type_id, ss_2.srg_opr_kind_id, ss_2.is_need_anatomic_zone, ss_2.aud_who, ss_2.aud_when, ss_2.aud_source, ss_2.aud_who_create, ss_2.aud_when_create, ss_2.aud_source_create, ss_2.is_filling, ss_2.is_extraction, ss_2.is_need_close_date, ss_2.is_vmp, ss_2.short_name
  • Index Cond: (ss_2.id = mrs1_2.service_id)
49. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=77.01..77.03 rows=1 width=28) (never executed)

  • Output: array_to_json(array_agg(r.*))
50. 0.000 0.000 ↓ 0.0 0

Subquery Scan on r (cost=76.89..76.99 rows=8 width=28) (never executed)

  • Output: r.*
51. 0.000 0.000 ↓ 0.0 0

Sort (cost=76.89..76.91 rows=8 width=193) (never executed)

  • Output: ss_3.id, ((((COALESCE(ss_3.code, ''::character varying))::text || ' '::text) || (COALESCE(ss_3.name, ''::character varying))::text)), mrs.id
  • Sort Key: mrs.id
52. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=0.86..76.77 rows=8 width=193) (never executed)

  • Output: ss_3.id, (((COALESCE(ss_3.code, ''::character varying))::text || ' '::text) || (COALESCE(ss_3.name, ''::character varying))::text), mrs.id
53. 0.000 0.000 ↓ 0.0 0

Index Scan using md_referral_service_referral_id_idx on public.md_referral_service mrs (cost=0.43..9.11 rows=8 width=8) (never executed)

  • Output: mrs.id, mrs.comment, mrs.referral_id, mrs.service_id, mrs.service_prototype_id, mrs.aud_who, mrs.aud_when, mrs.aud_source, mrs.aud_who_create, mrs.aud_when_create, mrs.aud_source_create, mrs.biomaterial_id, mrs.main_complex, mrs.biomaterial_dt, mrs.complex_id, mrs.building_id, mrs.room_id
  • Index Cond: (mrs.referral_id = mr.id)
  • Filter: ((mrs.main_complex IS NOT TRUE) AND (mrs.service_id IS NOT NULL))
54. 0.000 0.000 ↓ 0.0 0

Index Scan using sr_service_pk on public.sr_service ss_3 (cost=0.42..8.44 rows=1 width=189) (never executed)

  • Output: ss_3.id, ss_3.code, ss_3.cul, ss_3.is_death, ss_3.duration, ss_3.is_fictitious, ss_3.is_independent, ss_3.is_multuplicity, ss_3.name, ss_3.terms, ss_3.org_id, ss_3.category_id, ss_3.duration_unit_id, ss_3.prototype_id, ss_3.type_id, ss_3.from_dt, ss_3.to_dt, ss_3.is_repeated, ss_3.is_inherit_protocol, ss_3.is_expendable_materials, ss_3.is_actual_cul, ss_3.is_paraclinical, ss_3.is_complex, ss_3.accounting_id, ss_3.is_autocopy_diagnoses, ss_3.is_stomat, ss_3.srg_dif_type_id, ss_3.srg_opr_kind_id, ss_3.is_need_anatomic_zone, ss_3.aud_who, ss_3.aud_when, ss_3.aud_source, ss_3.aud_who_create, ss_3.aud_when_create, ss_3.aud_source_create, ss_3.is_filling, ss_3.is_extraction, ss_3.is_need_close_date, ss_3.is_vmp, ss_3.short_name
  • Index Cond: (mrs.service_id = ss_3.id)
55. 0.000 0.000 ↓ 0.0 0

Subquery Scan on r_1 (cost=17.58..17.59 rows=1 width=28) (never executed)

  • Output: row_to_json(r_1.*)
56. 0.000 0.000 ↓ 0.0 0

Limit (cost=17.58..17.58 rows=1 width=193) (never executed)

  • Output: ss_4.id, (concat('[+] ', ss_4.code, ' ', ss_4.name)), mrs_1.id
57. 0.000 0.000 ↓ 0.0 0

Sort (cost=17.58..17.58 rows=1 width=193) (never executed)

  • Output: ss_4.id, (concat('[+] ', ss_4.code, ' ', ss_4.name)), mrs_1.id
  • Sort Key: mrs_1.id
58. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=0.86..17.57 rows=1 width=193) (never executed)

  • Output: ss_4.id, concat('[+] ', ss_4.code, ' ', ss_4.name), mrs_1.id
59. 0.000 0.000 ↓ 0.0 0

Index Scan using md_referral_service_referral_id_idx on public.md_referral_service mrs_1 (cost=0.43..9.11 rows=1 width=8) (never executed)

  • Output: mrs_1.id, mrs_1.comment, mrs_1.referral_id, mrs_1.service_id, mrs_1.service_prototype_id, mrs_1.aud_who, mrs_1.aud_when, mrs_1.aud_source, mrs_1.aud_who_create, mrs_1.aud_when_create, mrs_1.aud_source_create, mrs_1.biomaterial_id, mrs_1.main_complex, mrs_1.biomaterial_dt, mrs_1.complex_id, mrs_1.building_id, mrs_1.room_id
  • Index Cond: (mrs_1.referral_id = mr.id)
  • Filter: (mrs_1.main_complex IS TRUE)
60. 0.000 0.000 ↓ 0.0 0

Index Scan using sr_service_pk on public.sr_service ss_4 (cost=0.42..8.44 rows=1 width=189) (never executed)

  • Output: ss_4.id, ss_4.code, ss_4.cul, ss_4.is_death, ss_4.duration, ss_4.is_fictitious, ss_4.is_independent, ss_4.is_multuplicity, ss_4.name, ss_4.terms, ss_4.org_id, ss_4.category_id, ss_4.duration_unit_id, ss_4.prototype_id, ss_4.type_id, ss_4.from_dt, ss_4.to_dt, ss_4.is_repeated, ss_4.is_inherit_protocol, ss_4.is_expendable_materials, ss_4.is_actual_cul, ss_4.is_paraclinical, ss_4.is_complex, ss_4.accounting_id, ss_4.is_autocopy_diagnoses, ss_4.is_stomat, ss_4.srg_dif_type_id, ss_4.srg_opr_kind_id, ss_4.is_need_anatomic_zone, ss_4.aud_who, ss_4.aud_when, ss_4.aud_source, ss_4.aud_who_create, ss_4.aud_when_create, ss_4.aud_source_create, ss_4.is_filling, ss_4.is_extraction, ss_4.is_need_close_date, ss_4.is_vmp, ss_4.short_name
  • Index Cond: (mrs_1.service_id = ss_4.id)
61. 0.000 0.000 ↓ 0.0 0

Seq Scan on public.md_referral_type (cost=0.00..1.39 rows=1 width=1) (never executed)

  • Output: md_referral_type.is_laboratory
  • Filter: (md_referral_type.id = mr.referral_type_id)
62. 0.000 0.000 ↓ 0.0 0

Seq Scan on public.md_referral_type md_referral_type_1 (cost=0.00..1.39 rows=1 width=1) (never executed)

  • Output: md_referral_type_1.hsp_rsv_mark
  • Filter: (md_referral_type_1.id = mr.referral_type_id)
63. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=76.97..76.99 rows=1 width=208) (never executed)

  • Output: array_to_json(array_agg(r_2.*))
64. 0.000 0.000 ↓ 0.0 0

Subquery Scan on r_2 (cost=76.85..76.95 rows=8 width=208) (never executed)

  • Output: r_2.*
65. 0.000 0.000 ↓ 0.0 0

Sort (cost=76.85..76.87 rows=8 width=184) (never executed)

  • Output: mrs_2.id, mrs_2.service_id, ss_5.name
  • Sort Key: mrs_2.id
66. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=0.86..76.73 rows=8 width=184) (never executed)

  • Output: mrs_2.id, mrs_2.service_id, ss_5.name
67. 0.000 0.000 ↓ 0.0 0

Index Scan using md_referral_service_referral_id_idx on public.md_referral_service mrs_2 (cost=0.43..9.11 rows=8 width=8) (never executed)

  • Output: mrs_2.id, mrs_2.comment, mrs_2.referral_id, mrs_2.service_id, mrs_2.service_prototype_id, mrs_2.aud_who, mrs_2.aud_when, mrs_2.aud_source, mrs_2.aud_who_create, mrs_2.aud_when_create, mrs_2.aud_source_create, mrs_2.biomaterial_id, mrs_2.main_complex, mrs_2.biomaterial_dt, mrs_2.complex_id, mrs_2.building_id, mrs_2.room_id
  • Index Cond: (mrs_2.referral_id = mr.id)
68. 0.000 0.000 ↓ 0.0 0

Index Scan using sr_service_pk on public.sr_service ss_5 (cost=0.42..8.44 rows=1 width=180) (never executed)

  • Output: ss_5.id, ss_5.code, ss_5.cul, ss_5.is_death, ss_5.duration, ss_5.is_fictitious, ss_5.is_independent, ss_5.is_multuplicity, ss_5.name, ss_5.terms, ss_5.org_id, ss_5.category_id, ss_5.duration_unit_id, ss_5.prototype_id, ss_5.type_id, ss_5.from_dt, ss_5.to_dt, ss_5.is_repeated, ss_5.is_inherit_protocol, ss_5.is_expendable_materials, ss_5.is_actual_cul, ss_5.is_paraclinical, ss_5.is_complex, ss_5.accounting_id, ss_5.is_autocopy_diagnoses, ss_5.is_stomat, ss_5.srg_dif_type_id, ss_5.srg_opr_kind_id, ss_5.is_need_anatomic_zone, ss_5.aud_who, ss_5.aud_when, ss_5.aud_source, ss_5.aud_who_create, ss_5.aud_when_create, ss_5.aud_source_create, ss_5.is_filling, ss_5.is_extraction, ss_5.is_need_close_date, ss_5.is_vmp, ss_5.short_name
  • Index Cond: (mrs_2.service_id = ss_5.id)
69. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=75.87..75.89 rows=1 width=197) (never executed)

  • Output: array_to_json(array_agg(r_3.*))
70. 0.000 0.000 ↓ 0.0 0

Subquery Scan on r_3 (cost=75.75..75.85 rows=8 width=197) (never executed)

  • Output: r_3.*
71. 0.000 0.000 ↓ 0.0 0

Sort (cost=75.75..75.77 rows=8 width=169) (never executed)

  • Output: mrs_3.id, mrs_3.id, mrs_3.service_prototype_id, ssp.name
  • Sort Key: mrs_3.id
72. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=0.72..75.63 rows=8 width=169) (never executed)

  • Output: mrs_3.id, mrs_3.id, mrs_3.service_prototype_id, ssp.name
73. 0.000 0.000 ↓ 0.0 0

Index Scan using md_referral_service_referral_id_idx on public.md_referral_service mrs_3 (cost=0.43..9.11 rows=8 width=8) (never executed)

  • Output: mrs_3.id, mrs_3.comment, mrs_3.referral_id, mrs_3.service_id, mrs_3.service_prototype_id, mrs_3.aud_who, mrs_3.aud_when, mrs_3.aud_source, mrs_3.aud_who_create, mrs_3.aud_when_create, mrs_3.aud_source_create, mrs_3.biomaterial_id, mrs_3.main_complex, mrs_3.biomaterial_dt, mrs_3.complex_id, mrs_3.building_id, mrs_3.room_id
  • Index Cond: (mrs_3.referral_id = mr.id)
74. 0.000 0.000 ↓ 0.0 0

Index Scan using sr_srv_prototype_pk on public.sr_srv_prototype ssp (cost=0.29..8.30 rows=1 width=165) (never executed)

  • Output: ssp.id, ssp.code, ssp.is_independent, ssp.name, ssp.is_remote, ssp.terms, ssp.type_id, ssp.anesthesia_type, ssp.is_repeated, ssp.is_expendable_materials, ssp.protocol_path, ssp.report_path, ssp.is_complete_protocol, ssp.is_complex, ssp.accounting_id, ssp.from_dt, ssp.to_dt, ssp.e_code, ssp.aud_who, ssp.aud_when, ssp.aud_source, ssp.aud_who_create, ssp.aud_when_create, ssp.aud_source_create
  • Index Cond: (mrs_3.service_prototype_id = ssp.id)
75. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=19.42..19.43 rows=1 width=598) (never executed)

  • Output: array_to_json(array_agg(ar.*))
76. 0.000 0.000 ↓ 0.0 0

Subquery Scan on ar (cost=19.39..19.41 rows=2 width=598) (never executed)

  • Output: ar.*
77. 0.000 0.000 ↓ 0.0 0

Sort (cost=19.39..19.39 rows=2 width=570) (never executed)

  • Output: mra.id, mra.id, mrat.id, mrat.name, mra.appendix_name, mra.file_name, mra.comment
  • Sort Key: mra.id
78. 0.000 0.000 ↓ 0.0 0

Hash Right Join (cost=8.54..19.38 rows=2 width=570) (never executed)

  • Output: mra.id, mra.id, mrat.id, mrat.name, mra.appendix_name, mra.file_name, mra.comment
  • Hash Cond: (mrat.id = mra.appendix_type_id)
79. 0.000 0.000 ↓ 0.0 0

Seq Scan on public.md_referral_appendix_type mrat (cost=0.00..10.60 rows=60 width=520) (never executed)

  • Output: mrat.id, mrat.code, mrat.name, mrat.aud_who, mrat.aud_when, mrat.aud_source, mrat.aud_who_create, mrat.aud_when_create, mrat.aud_source_create
80. 0.000 0.000 ↓ 0.0 0

Hash (cost=8.52..8.52 rows=2 width=54) (never executed)

  • Output: mra.id, mra.appendix_name, mra.file_name, mra.comment, mra.appendix_type_id
81. 0.000 0.000 ↓ 0.0 0

Index Scan using md_referral_appendix_referral_id_idx on public.md_referral_appendix mra (cost=0.43..8.52 rows=2 width=54) (never executed)

  • Output: mra.id, mra.appendix_name, mra.file_name, mra.comment, mra.appendix_type_id
  • Index Cond: (mra.referral_id = mr.id)
82. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=9.35..9.37 rows=1 width=28) (never executed)

  • Output: array_to_json(array_agg(r_4.*))
83. 0.000 0.000 ↓ 0.0 0

Subquery Scan on r_4 (cost=9.23..9.33 rows=8 width=28) (never executed)

  • Output: r_4.*
84. 0.000 0.000 ↓ 0.0 0

Sort (cost=9.23..9.25 rows=8 width=4) (never executed)

  • Output: mrs_4.id
  • Sort Key: mrs_4.id
85. 0.000 0.000 ↓ 0.0 0

Index Scan using md_referral_service_referral_id_idx on public.md_referral_service mrs_4 (cost=0.43..9.11 rows=8 width=4) (never executed)

  • Output: mrs_4.id
  • Index Cond: (mrs_4.referral_id = mr.id)
86. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=8.56..8.57 rows=1 width=28) (never executed)

  • Output: array_to_json(array_agg(ar_1.*))
87. 0.000 0.000 ↓ 0.0 0

Subquery Scan on ar_1 (cost=8.53..8.55 rows=2 width=28) (never executed)

  • Output: ar_1.*
88. 0.000 0.000 ↓ 0.0 0

Sort (cost=8.53..8.53 rows=2 width=4) (never executed)

  • Output: mra_1.id
  • Sort Key: mra_1.id
89. 0.000 0.000 ↓ 0.0 0

Index Scan using md_referral_appendix_referral_id_idx on public.md_referral_appendix mra_1 (cost=0.43..8.52 rows=2 width=4) (never executed)

  • Output: mra_1.id
  • Index Cond: (mra_1.referral_id = mr.id)
90. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=9.11..9.12 rows=1 width=4) (never executed)

  • Output: count(md_referral_service.service_prototype_id)
91. 0.000 0.000 ↓ 0.0 0

Index Scan using md_referral_service_referral_id_idx on public.md_referral_service (cost=0.43..9.11 rows=1 width=4) (never executed)

  • Output: md_referral_service.id, md_referral_service.comment, md_referral_service.referral_id, md_referral_service.service_id, md_referral_service.service_prototype_id, md_referral_service.aud_who, md_referral_service.aud_when, md_referral_service.aud_source, md_referral_service.aud_who_create, md_referral_service.aud_when_create, md_referral_service.aud_source_create, md_referral_service.biomaterial_id, md_referral_service.main_complex, md_referral_service.biomaterial_dt, md_referral_service.complex_id, md_referral_service.building_id, md_referral_service.room_id
  • Index Cond: (md_referral_service.referral_id = mr.id)
  • Filter: (md_referral_service.service_prototype_id IS NOT NULL)
92. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=48.75..48.76 rows=1 width=4) (never executed)

  • Output: count(DISTINCT ss1.id)
93. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=0.86..48.73 rows=8 width=4) (never executed)

  • Output: ss1.id
94. 0.000 0.000 ↓ 0.0 0

Index Scan using md_referral_service_referral_id_idx on public.md_referral_service mrs_5 (cost=0.43..9.11 rows=8 width=4) (never executed)

  • Output: mrs_5.id, mrs_5.comment, mrs_5.referral_id, mrs_5.service_id, mrs_5.service_prototype_id, mrs_5.aud_who, mrs_5.aud_when, mrs_5.aud_source, mrs_5.aud_who_create, mrs_5.aud_when_create, mrs_5.aud_source_create, mrs_5.biomaterial_id, mrs_5.main_complex, mrs_5.biomaterial_dt, mrs_5.complex_id, mrs_5.building_id, mrs_5.room_id
  • Index Cond: (mrs_5.referral_id = mr.id)
  • Filter: ((mrs_5.main_complex IS NOT TRUE) AND (mrs_5.service_id IS NOT NULL))
95. 0.000 0.000 ↓ 0.0 0

Index Only Scan using sr_service_pk on public.sr_service ss1 (cost=0.42..4.94 rows=1 width=4) (never executed)

  • Output: ss1.id
  • Index Cond: (ss1.id = mrs_5.service_id)
  • Heap Fetches: 0
96. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=84.25..84.26 rows=1 width=4) (never executed)

  • Output: count(sr_service.id)
97.          

Initplan (for Aggregate)

98. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.43..9.11 rows=1 width=4) (never executed)

  • Output: md_referral_service_1.service_prototype_id
99. 0.000 0.000 ↓ 0.0 0

Index Scan using md_referral_service_referral_id_idx on public.md_referral_service md_referral_service_1 (cost=0.43..9.11 rows=1 width=4) (never executed)

  • Output: md_referral_service_1.service_prototype_id
  • Index Cond: (md_referral_service_1.referral_id = mr.id)
  • Filter: (md_referral_service_1.service_prototype_id IS NOT NULL)
100. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on public.sr_service (cost=71.13..75.14 rows=1 width=4) (never executed)

  • Output: sr_service.id, sr_service.code, sr_service.cul, sr_service.is_death, sr_service.duration, sr_service.is_fictitious, sr_service.is_independent, sr_service.is_multuplicity, sr_service.name, sr_service.terms, sr_service.org_id, sr_service.category_id, sr_service.duration_unit_id, sr_service.prototype_id, sr_service.type_id, sr_service.from_dt, sr_service.to_dt, sr_service.is_repeated, sr_service.is_inherit_protocol, sr_service.is_expendable_materials, sr_service.is_actual_cul, sr_service.is_paraclinical, sr_service.is_complex, sr_service.accounting_id, sr_service.is_autocopy_diagnoses, sr_service.is_stomat, sr_service.srg_dif_type_id, sr_service.srg_opr_kind_id, sr_service.is_need_anatomic_zone, sr_service.aud_who, sr_service.aud_when, sr_service.aud_source, sr_service.aud_who_create, sr_service.aud_when_create, sr_service.aud_source_create, sr_service.is_filling, sr_service.is_extraction, sr_service.is_need_close_date, sr_service.is_vmp, sr_service.short_name
  • Recheck Cond: ((sr_service.prototype_id = $31) AND (sr_service.org_id = po.id))
101. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=71.13..71.13 rows=1 width=0) (never executed)

102. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on sr_service_prototype_id_idx (cost=0.00..5.08 rows=87 width=0) (never executed)

  • Index Cond: (sr_service.prototype_id = $31)
103. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on sr_service_org_id_id_idx (cost=0.00..65.80 rows=3,383 width=0) (never executed)

  • Index Cond: (sr_service.org_id = po.id)
104. 0.000 0.000 ↓ 0.0 0

Limit (cost=80.24..84.25 rows=1 width=4) (never executed)

  • Output: sr_service_1.id
105.          

Initplan (for Limit)

106. 0.000 0.000 ↓ 0.0 0

Index Scan using md_referral_service_referral_id_idx on public.md_referral_service md_referral_service_2 (cost=0.43..9.11 rows=1 width=4) (never executed)

  • Output: md_referral_service_2.service_prototype_id
  • Index Cond: (md_referral_service_2.referral_id = mr.id)
  • Filter: (md_referral_service_2.service_prototype_id IS NOT NULL)
107. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on public.sr_service sr_service_1 (cost=71.13..75.14 rows=1 width=4) (never executed)

  • Output: sr_service_1.id
  • Recheck Cond: ((sr_service_1.prototype_id = $34) AND (sr_service_1.org_id = po.id))
108. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=71.13..71.13 rows=1 width=0) (never executed)

109. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on sr_service_prototype_id_idx (cost=0.00..5.08 rows=87 width=0) (never executed)

  • Index Cond: (sr_service_1.prototype_id = $34)
110. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on sr_service_org_id_id_idx (cost=0.00..65.80 rows=3,383 width=0) (never executed)

  • Index Cond: (sr_service_1.org_id = po.id)
111. 0.000 0.000 ↓ 0.0 0

Limit (cost=17.57..17.58 rows=1 width=8) (never executed)

  • Output: ss1_1.id, mrs_6.id
112. 0.000 0.000 ↓ 0.0 0

Sort (cost=17.57..17.58 rows=1 width=8) (never executed)

  • Output: ss1_1.id, mrs_6.id
  • Sort Key: mrs_6.id
113. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=0.86..17.56 rows=1 width=8) (never executed)

  • Output: ss1_1.id, mrs_6.id
114. 0.000 0.000 ↓ 0.0 0

Index Scan using md_referral_service_referral_id_idx on public.md_referral_service mrs_6 (cost=0.43..9.11 rows=1 width=8) (never executed)

  • Output: mrs_6.id, mrs_6.comment, mrs_6.referral_id, mrs_6.service_id, mrs_6.service_prototype_id, mrs_6.aud_who, mrs_6.aud_when, mrs_6.aud_source, mrs_6.aud_who_create, mrs_6.aud_when_create, mrs_6.aud_source_create, mrs_6.biomaterial_id, mrs_6.main_complex, mrs_6.biomaterial_dt, mrs_6.complex_id, mrs_6.building_id, mrs_6.room_id
  • Index Cond: (mrs_6.referral_id = mr.id)
  • Filter: (mrs_6.main_complex IS TRUE)
115. 0.000 0.000 ↓ 0.0 0

Index Only Scan using sr_service_pk on public.sr_service ss1_1 (cost=0.42..8.44 rows=1 width=4) (never executed)

  • Output: ss1_1.id
  • Index Cond: (ss1_1.id = mrs_6.service_id)
  • Heap Fetches: 0
116. 0.000 0.000 ↓ 0.0 0

Limit (cost=48.75..48.76 rows=1 width=4) (never executed)

  • Output: ss1_2.id
117. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=48.75..48.83 rows=8 width=4) (never executed)

  • Output: ss1_2.id
  • Group Key: ss1_2.id
118. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=0.86..48.73 rows=8 width=4) (never executed)

  • Output: ss1_2.id
119. 0.000 0.000 ↓ 0.0 0

Index Scan using md_referral_service_referral_id_idx on public.md_referral_service mrs_7 (cost=0.43..9.11 rows=8 width=4) (never executed)

  • Output: mrs_7.id, mrs_7.comment, mrs_7.referral_id, mrs_7.service_id, mrs_7.service_prototype_id, mrs_7.aud_who, mrs_7.aud_when, mrs_7.aud_source, mrs_7.aud_who_create, mrs_7.aud_when_create, mrs_7.aud_source_create, mrs_7.biomaterial_id, mrs_7.main_complex, mrs_7.biomaterial_dt, mrs_7.complex_id, mrs_7.building_id, mrs_7.room_id
  • Index Cond: (mrs_7.referral_id = mr.id)
  • Filter: ((mrs_7.main_complex IS NOT TRUE) AND (mrs_7.service_id IS NOT NULL))
120. 0.000 0.000 ↓ 0.0 0

Index Only Scan using sr_service_pk on public.sr_service ss1_2 (cost=0.42..4.94 rows=1 width=4) (never executed)

  • Output: ss1_2.id
  • Index Cond: (ss1_2.id = mrs_7.service_id)
  • Heap Fetches: 0
121. 0.000 0.000 ↓ 0.0 0

Limit (cost=17.57..17.58 rows=1 width=8) (never executed)

  • Output: ss1_3.id, mrs_8.id
122. 0.000 0.000 ↓ 0.0 0

Sort (cost=17.57..17.58 rows=1 width=8) (never executed)

  • Output: ss1_3.id, mrs_8.id
  • Sort Key: mrs_8.id
123. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=0.86..17.56 rows=1 width=8) (never executed)

  • Output: ss1_3.id, mrs_8.id
124. 0.000 0.000 ↓ 0.0 0

Index Scan using md_referral_service_referral_id_idx on public.md_referral_service mrs_8 (cost=0.43..9.11 rows=1 width=8) (never executed)

  • Output: mrs_8.id, mrs_8.comment, mrs_8.referral_id, mrs_8.service_id, mrs_8.service_prototype_id, mrs_8.aud_who, mrs_8.aud_when, mrs_8.aud_source, mrs_8.aud_who_create, mrs_8.aud_when_create, mrs_8.aud_source_create, mrs_8.biomaterial_id, mrs_8.main_complex, mrs_8.biomaterial_dt, mrs_8.complex_id, mrs_8.building_id, mrs_8.room_id
  • Index Cond: (mrs_8.referral_id = mr.id)
  • Filter: (mrs_8.main_complex IS TRUE)
125. 0.000 0.000 ↓ 0.0 0

Index Only Scan using sr_service_pk on public.sr_service ss1_3 (cost=0.42..8.44 rows=1 width=4) (never executed)

  • Output: ss1_3.id
  • Index Cond: (ss1_3.id = mrs_8.service_id)
  • Heap Fetches: 0
126. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=48.75..48.76 rows=1 width=4) (never executed)

  • Output: count(DISTINCT ss1_4.id)
127. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=0.86..48.73 rows=8 width=4) (never executed)

  • Output: ss1_4.id
128. 0.000 0.000 ↓ 0.0 0

Index Scan using md_referral_service_referral_id_idx on public.md_referral_service mrs_9 (cost=0.43..9.11 rows=8 width=4) (never executed)

  • Output: mrs_9.id, mrs_9.comment, mrs_9.referral_id, mrs_9.service_id, mrs_9.service_prototype_id, mrs_9.aud_who, mrs_9.aud_when, mrs_9.aud_source, mrs_9.aud_who_create, mrs_9.aud_when_create, mrs_9.aud_source_create, mrs_9.biomaterial_id, mrs_9.main_complex, mrs_9.biomaterial_dt, mrs_9.complex_id, mrs_9.building_id, mrs_9.room_id
  • Index Cond: (mrs_9.referral_id = mr.id)
  • Filter: ((mrs_9.main_complex IS NOT TRUE) AND (mrs_9.service_id IS NOT NULL))
129. 0.000 0.000 ↓ 0.0 0

Index Only Scan using sr_service_pk on public.sr_service ss1_4 (cost=0.42..4.94 rows=1 width=4) (never executed)

  • Output: ss1_4.id
  • Index Cond: (ss1_4.id = mrs_9.service_id)
  • Heap Fetches: 0
130. 0.000 0.000 ↓ 0.0 0

Limit (cost=48.75..48.76 rows=1 width=4) (never executed)

  • Output: ss1_5.id
131. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=48.75..48.83 rows=8 width=4) (never executed)

  • Output: ss1_5.id
  • Group Key: ss1_5.id
132. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=0.86..48.73 rows=8 width=4) (never executed)

  • Output: ss1_5.id
133. 0.000 0.000 ↓ 0.0 0

Index Scan using md_referral_service_referral_id_idx on public.md_referral_service mrs_10 (cost=0.43..9.11 rows=8 width=4) (never executed)

  • Output: mrs_10.id, mrs_10.comment, mrs_10.referral_id, mrs_10.service_id, mrs_10.service_prototype_id, mrs_10.aud_who, mrs_10.aud_when, mrs_10.aud_source, mrs_10.aud_who_create, mrs_10.aud_when_create, mrs_10.aud_source_create, mrs_10.biomaterial_id, mrs_10.main_complex, mrs_10.biomaterial_dt, mrs_10.complex_id, mrs_10.building_id, mrs_10.room_id
  • Index Cond: (mrs_10.referral_id = mr.id)
  • Filter: ((mrs_10.main_complex IS NOT TRUE) AND (mrs_10.service_id IS NOT NULL))
134. 0.000 0.000 ↓ 0.0 0

Index Only Scan using sr_service_pk on public.sr_service ss1_5 (cost=0.42..4.94 rows=1 width=4) (never executed)

  • Output: ss1_5.id
  • Index Cond: (ss1_5.id = mrs_10.service_id)
  • Heap Fetches: 0
Planning time : 61.299 ms
Execution time : 15,328.981 ms