explain.depesz.com

PostgreSQL's explain analyze made readable

Result: GvBa

Settings

Optimization(s) for this plan:

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

Update on discharge d (cost=35,714,549.87..36,155,198.42 rows=1 width=244) (actual rows= loops=)

2. 0.000 0.000 ↓ 0.0

Merge Join (cost=35,714,549.87..36,155,198.42 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=26,140,825.17..26,317,084.58 rows=35,251,882 width=36) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Sort (cost=26,140,825.17..26,228,954.88 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=20,229,091.56..20,757,869.79 rows=35,251,882 width=36) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Unique (cost=20,229,091.56..20,405,350.97 rows=35,251,882 width=8) (actual rows= loops=)

9. 0.000 0.000 ↓ 0.0

Sort (cost=20,229,091.56..20,317,221.26 rows=35,251,882 width=8) (actual rows= loops=)

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

Merge Right Join (cost=14,271,165.82..15,810,057.18 rows=35,251,882 width=8) (actual rows= loops=)

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

Sort (cost=7,224,013.44..7,317,708.11 rows=37,477,868 width=35) (actual rows= loops=)

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

Seq Scan on treatment (cost=0.00..1,484,598.68 rows=37,477,868 width=35) (actual rows= loops=)

13. 0.000 0.000 ↓ 0.0

Materialize (cost=7,043,438.20..7,219,697.61 rows=35,251,882 width=35) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Sort (cost=7,043,438.20..7,131,567.91 rows=35,251,882 width=35) (actual rows= loops=)

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

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