explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Beci : Optimization for: plan #GvBa

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Update on discharge d (cost=27,221,966.70..27,662,615.24 rows=1 width=244) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Merge Join (cost=27,221,966.70..27,662,615.24 rows=1 width=244) (actual rows= loops=)

  • Merge Cond: (d.treatment_id = joined.treatment_id)
3. 0.000 0.000 ↓ 0.0

Sort (cost=9,573,724.70..9,661,854.41 rows=35,251,882 width=204) (actual rows= loops=)

  • Sort Key: d.treatment_id
4. 0.000 0.000 ↓ 0.0

Seq Scan on discharge d (cost=0.00..1,660,482.82 rows=35,251,882 width=204) (actual rows= loops=)

5. 0.000 0.000 ↓ 0.0

Materialize (cost=17,648,242.00..17,824,501.41 rows=35,251,882 width=36) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Sort (cost=17,648,242.00..17,736,371.71 rows=35,251,882 width=36) (actual rows= loops=)

  • Sort Key: joined.treatment_id
7. 0.000 0.000 ↓ 0.0

Subquery Scan on joined (cost=11,736,508.39..12,265,286.62 rows=35,251,882 width=36) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Unique (cost=11,736,508.39..11,912,767.80 rows=35,251,882 width=8) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

Sort (cost=11,736,508.39..11,824,638.09 rows=35,251,882 width=8) (actual rows= loops=)

  • Sort Key: d1.discharge_id
10. 0.000 0.000 ↓ 0.0

Merge Left Join (cost=6,696,303.01..7,317,474.01 rows=35,251,882 width=8) (actual rows= loops=)

  • Merge Cond: (((d1.d_adm_client_id)::text = (treatment.cd_client_id)::text) AND ((d1.d_adm_provider_id)::text = (treatment.cd_provider_id)::text) AND ((d1.d_adm_client_trans_typ)::text = (treatment.cd_client_trans_typ)::text) AND (d1.adm_admission_date = treatment.cd_date_admission) AND (d1.adm_services = treatment.cd_services) AND (d1.adm_co_dep = treatment.cd_co_dep))
11. 0.000 0.000 ↓ 0.0

Sort (cost=6,079,517.20..6,167,646.91 rows=35,251,882 width=32) (actual rows= loops=)

  • Sort Key: d1.d_adm_client_id, d1.d_adm_provider_id, d1.d_adm_client_trans_typ, d1.adm_admission_date, d1.adm_services, d1.adm_co_dep
12. 0.000 0.000 ↓ 0.0

Seq Scan on discharge d1 (cost=0.00..1,660,482.82 rows=35,251,882 width=32) (actual rows= loops=)

13. 0.000 0.000 ↓ 0.0

Sort (cost=616,764.58..617,376.72 rows=244,855 width=32) (actual rows= loops=)

  • Sort Key: treatment.cd_client_id, treatment.cd_provider_id, treatment.cd_client_trans_typ, treatment.cd_date_admission, treatment.cd_services, treatment.cd_co_dep
14. 0.000 0.000 ↓ 0.0

Bitmap Heap Scan on treatment (cost=4,586.19..594,848.14 rows=244,855 width=32) (actual rows= loops=)

  • Recheck Cond: ((cd_state_code)::text = 'AR'::text)
15. 0.000 0.000 ↓ 0.0

Bitmap Index Scan on cds_treatment_safis_index (cost=0.00..4,524.98 rows=244,855 width=0) (actual rows= loops=)

  • Index Cond: ((cd_state_code)::text = 'AR'::text)