explain.depesz.com

PostgreSQL's explain analyze made readable

Result: KUfg

Settings
# exclusive inclusive rows x rows loops node
1. 0.004 398.830 ↑ 16,935.0 1 1

Nested Loop (cost=14,792.52..1,714,454.07 rows=16,935 width=0) (actual time=288.957..398.830 rows=1 loops=1)

  • Output: 1
  • Buffers: shared hit=54315
2. 0.014 398.810 ↑ 17,518.0 1 1

Nested Loop Left Join (cost=14,791.95..1,638,430.18 rows=17,518 width=8) (actual time=288.938..398.810 rows=1 loops=1)

  • Output: ssr.res_group_id, srgr.group_id
  • Filter: ((msr.case_id IS NULL) OR (SubPlan 1))
  • Buffers: shared hit=54310
3. 0.011 398.748 ↑ 26,057.0 1 1

Nested Loop Anti Join (cost=14,791.39..1,176,498.89 rows=26,057 width=12) (actual time=288.878..398.748 rows=1 loops=1)

  • Output: ssr.res_group_id, ssr.id, srgr.group_id
  • Buffers: shared hit=54299
4. 51.371 398.724 ↑ 40,126.0 1 1

Hash Join (cost=14,790.95..1,002,069.69 rows=40,126 width=12) (actual time=288.855..398.724 rows=1 loops=1)

  • Output: ssr.res_group_id, ssr.id, srgr.group_id
  • Hash Cond: (ssr.res_group_id = srgr.group_id)
  • Buffers: shared hit=54296
5. 273.918 346.371 ↑ 1.3 322,039 1

Bitmap Heap Scan on public.sr_srv_rendered ssr (cost=12,839.58..998,209.68 rows=432,908 width=16) (actual time=86.503..346.371 rows=322,039 loops=1)

  • Output: ssr.id, ssr.bdate, ssr.comment, ssr.cost, ssr.duration, ssr.edate, ssr.is_rendered, ssr.quantity, ssr.total_cost, ssr.contract_id, ssr.customer_id, ssr.funding_id, ssr.res_group_id, ssr.service_id, ssr.duration_measure_unit_id, ssr.begin_time, ssr.prototype_id, ssr.org_id, ssr.price_list_id, ssr.cul, ssr.parent_id, ssr.payment_status_id, ssr.root_service_id, ssr.is_wholly_rendered, ssr.planned_date, ssr.planned_time, ssr.tooth_number, ssr.is_refused, ssr.aud_who, ssr.aud_when, ssr.aud_source, ssr.aud_who_create, ssr.aud_when_create, ssr.aud_source_create, ssr.is_amalgam_filling, ssr.is_mobile_medical_teams, ssr.close_date, ssr.complex_srv_id, ssr.for_upload, ssr.uid, ssr.is_need_consulting
  • Recheck Cond: ((ssr.bdate >= '2018-09-20'::date) AND (ssr.bdate <= '2018-09-30'::date))
  • Filter: (ssr.planned_date IS NOT NULL)
  • Rows Removed by Filter: 139771
  • Heap Blocks: exact=52754
  • Buffers: shared hit=54135
6. 72.453 72.453 ↑ 1.2 462,028 1

Bitmap Index Scan on sr_srv_rendered_bdate_org_ix (cost=0.00..12,731.36 rows=563,879 width=0) (actual time=72.453..72.453 rows=462,028 loops=1)

  • Index Cond: ((ssr.bdate >= '2018-09-20'::date) AND (ssr.bdate <= '2018-09-30'::date))
  • Buffers: shared hit=1381
7. 0.165 0.982 ↑ 33.4 640 1

Hash (cost=1,684.57..1,684.57 rows=21,344 width=4) (actual time=0.982..0.982 rows=640 loops=1)

  • Output: srgr.group_id
  • Buckets: 32768 Batches: 1 Memory Usage: 279kB
  • Buffers: shared hit=161
8. 0.358 0.817 ↑ 33.4 640 1

HashAggregate (cost=1,471.13..1,684.57 rows=21,344 width=4) (actual time=0.665..0.817 rows=640 loops=1)

  • Output: srgr.group_id
  • Group Key: srgr.group_id
  • Buffers: shared hit=161
9. 0.113 0.459 ↑ 33.2 643 1

Nested Loop (cost=0.86..1,417.77 rows=21,344 width=4) (actual time=0.057..0.459 rows=643 loops=1)

  • Output: srgr.group_id
  • Buffers: shared hit=161
10. 0.020 0.020 ↑ 1.0 1 1

Index Scan using employee_position_id_unique on public.pim_employee_position_resource pepr1 (cost=0.29..8.30 rows=1 width=4) (actual time=0.019..0.020 rows=1 loops=1)

  • Output: pepr1.id, pepr1.employee_position_id, pepr1.aud_who, pepr1.aud_when, pepr1.aud_source, pepr1.aud_who_create, pepr1.aud_when_create, pepr1.aud_source_create
  • Index Cond: (pepr1.employee_position_id = 87510)
  • Buffers: shared hit=3
11. 0.326 0.326 ↑ 33.2 643 1

Index Only Scan using sr_res_group_relationship_resource_id_group_id_ix on public.sr_res_group_relationship srgr (cost=0.57..1,196.02 rows=21,344 width=8) (actual time=0.030..0.326 rows=643 loops=1)

  • Output: srgr.resource_id, srgr.group_id
  • Index Cond: (srgr.resource_id = pepr1.id)
  • Heap Fetches: 50
  • Buffers: shared hit=158
12. 0.013 0.013 ↓ 0.0 0 1

Index Only Scan using md_appointment_srv_rendered_id_idx on public.md_appointment ma (cost=0.44..4.34 rows=1 width=4) (actual time=0.013..0.013 rows=0 loops=1)

  • Output: ma.srv_rendered_id
  • Index Cond: (ma.srv_rendered_id = ssr.id)
  • Heap Fetches: 0
  • Buffers: shared hit=3
13. 0.013 0.013 ↑ 1.0 1 1

Index Scan using md_srv_rendered_pk on public.md_srv_rendered msr (cost=0.56..8.08 rows=1 width=8) (actual time=0.012..0.013 rows=1 loops=1)

  • Output: msr.id, msr.is_urgent, msr.is_use_cryogenic, msr.is_use_endoscopic, msr.is_use_laser, msr.anesthesia_type_id, msr.step_id, msr.complication_type_id, msr.diagnosis_id, msr.case_id, msr.referral_id, msr.result_category_id, msr.patient_prescription_id, msr.health_group_id, msr.vmp_type_id, msr.vmp_method_id, msr.anatomic_zone_id, msr.aud_who, msr.aud_when, msr.aud_source, msr.aud_who_create, msr.aud_when_create, msr.aud_source_create, msr.prescription_id, msr.by_standard, msr.complicated_value, msr.vmp_profile_id
  • Index Cond: (ssr.id = msr.id)
  • Buffers: shared hit=5
14.          

SubPlan (forNested Loop Left Join)

15. 0.014 0.035 ↑ 1.0 1 1

Nested Loop (cost=0.56..9.64 rows=1 width=0) (actual time=0.035..0.035 rows=1 loops=1)

  • Join Filter: (mc.case_type_id = mct.id)
  • Rows Removed by Join Filter: 1
  • Buffers: shared hit=6
16. 0.014 0.014 ↑ 1.0 1 1

Index Scan using mc_case_pk on public.mc_case mc (cost=0.56..8.58 rows=1 width=4) (actual time=0.014..0.014 rows=1 loops=1)

  • Output: mc.case_type_id
  • Index Cond: (msr.case_id = mc.id)
  • Buffers: shared hit=5
17. 0.007 0.007 ↑ 1.0 2 1

Seq Scan on public.mc_case_type mct (cost=0.00..1.04 rows=2 width=4) (actual time=0.007..0.007 rows=2 loops=1)

  • Output: mct.id, mct.case_mode_id, mct.code, mct.name, mct.default_regimen_id, mct.e_code, mct.from_dt, mct.to_dt, mct.aud_who, mct.aud_when, mct.aud_source, mct.aud_who_create, mct.aud_when_create, mct.aud_source_create
  • Filter: (mct.case_mode_id = 1)
  • Rows Removed by Filter: 1
  • Buffers: shared hit=1
18. 0.016 0.016 ↑ 1.0 1 1

Index Only Scan using sr_res_group_pk on public.sr_res_group srg (cost=0.57..4.33 rows=1 width=4) (actual time=0.015..0.016 rows=1 loops=1)

  • Output: srg.id
  • Index Cond: (srg.id = ssr.res_group_id)
  • Heap Fetches: 0
  • Buffers: shared hit=5