explain.depesz.com

PostgreSQL's explain analyze made readable

Result: aQvV

Settings
# exclusive inclusive rows x rows loops node
1. 0.790 58,041.585 ↑ 1.0 1 1

Aggregate (cost=8,204,232.95..8,204,232.96 rows=1 width=16) (actual time=58,041.585..58,041.585 rows=1 loops=1)

  • Output: sum(rp.reallocated_cost), sum(CASE WHEN (rp.reallocated_cost IS NULL) THEN '0'::double precision ELSE (up.total_cost * COALESCE(uf1.oon_factor, uf2.oon_factor, '0'::double precision)) END)
  • Buffers: shared hit=5,390,302
2. 1.417 58,040.795 ↑ 22.0 747 1

Hash Left Join (cost=32,664.24..8,204,109.52 rows=16,458 width=32) (actual time=66.841..58,040.795 rows=747 loops=1)

  • Output: rp.reallocated_cost, up.total_cost, uf1.oon_factor, uf2.oon_factor
  • Hash Cond: ((up.claim_type_id = uf2.claim_type_id) AND (up.place_of_service_id = uf2.place_of_service_id) AND (up.member_category_id = uf2.member_category_id))
  • Buffers: shared hit=5,390,302
3. 1.717 58,039.340 ↑ 22.0 747 1

Nested Loop Left Join (cost=32,660.75..8,202,890.86 rows=16,458 width=36) (actual time=66.798..58,039.340 rows=747 loops=1)

  • Output: up.total_cost, up.place_of_service_id, up.claim_type_id, up.member_category_id, uf1.oon_factor, rp.reallocated_cost
  • Inner Unique: true
  • Buffers: shared hit=5,390,301
4. 1.048 110.014 ↑ 22.0 747 1

Hash Left Join (cost=32,164.85..40,847.76 rows=16,458 width=105) (actual time=52.593..110.014 rows=747 loops=1)

  • Output: up.total_cost, up.id, up.procedure_code, up.place_of_service_id, up.claim_type_id, up.member_category_id, up.provider_geography_point, up.specialty_ids, up.provider_id, uf1.oon_factor
  • Hash Cond: ((up.claim_type_id = uf1.claim_type_id) AND (up.place_of_service_id = uf1.place_of_service_id) AND (up.member_category_id = uf1.member_category_id) AND ((up.procedure_code)::text = (uf1.procedure_code)::text))
  • Buffers: shared hit=7,344
5. 76.739 108.925 ↑ 22.0 747 1

Index Scan using utilization_procedures_pkey on "20191599".utilization_procedures up (cost=32,161.12..39,362.80 rows=16,458 width=97) (actual time=52.504..108.925 rows=747 loops=1)

  • Output: up.id, up.cost_type_id, up.procedure_code, up.total_cost, up.provider_id, up.client_provider_id, up.provider_primary_location_id, up.specialty_ids, up.place_of_service_id, up.claim_type_id, up.member_zip_code, up.member_category_id, up.client_claim_id, up.client_episode_id, up.member_geography_point, up.is_passthrough, up.member_type_id, up.combined_column, up.provider_geography_point
  • Index Cond: ((up.id >= 1) AND (up.id <= 100,000))
  • Filter: ((NOT up.is_passthrough) AND (up.provider_id IS NOT NULL) AND (NOT (hashed SubPlan 1)))
  • Rows Removed by Filter: 99,253
  • Buffers: shared hit=7,340
6.          

SubPlan (for Index Scan)

7. 32.186 32.186 ↑ 1.0 81,368 1

Index Scan using ix_plan_provider_locations_plan on "20191599".plan_provider_locations (cost=0.56..31,954.79 rows=82,360 width=4) (actual time=0.031..32.186 rows=81,368 loops=1)

  • Output: plan_provider_locations.provider_id
  • Index Cond: (plan_provider_locations.plan_id = 6,584)
  • Buffers: shared hit=2,604
8. 0.011 0.041 ↓ 0.0 0 1

Hash (cost=1.91..1.91 rows=91 width=26) (actual time=0.041..0.041 rows=0 loops=1)

  • Output: uf1.oon_factor, uf1.claim_type_id, uf1.place_of_service_id, uf1.member_category_id, uf1.procedure_code
  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
  • Buffers: shared hit=1
9. 0.030 0.030 ↑ 1.0 91 1

Seq Scan on "20191599".utilization_oon_factors uf1 (cost=0.00..1.91 rows=91 width=26) (actual time=0.013..0.030 rows=91 loops=1)

  • Output: uf1.oon_factor, uf1.claim_type_id, uf1.place_of_service_id, uf1.member_category_id, uf1.procedure_code
  • Buffers: shared hit=1
10. 0.747 57,927.609 ↑ 1.0 1 747

Subquery Scan on rp (cost=495.90..495.92 rows=1 width=12) (actual time=77.547..77.547 rows=1 loops=747)

  • Output: rp.id, rp.reallocated_cost
  • Filter: (up.id = rp.id)
  • Buffers: shared hit=5,382,957
11. 2.241 57,926.862 ↑ 1.0 1 747

Aggregate (cost=495.90..495.91 rows=1 width=12) (actual time=77.546..77.546 rows=1 loops=747)

  • Output: up.id, avg(urp.reprice_avg_cost)
  • Buffers: shared hit=5,382,957
12. 2.241 57,924.621 ↓ 2.0 2 747

Limit (cost=493.83..495.88 rows=1 width=8) (actual time=77.514..77.543 rows=2 loops=747)

  • Output: urp.reprice_avg_cost
  • Buffers: shared hit=5,382,957
13. 32.240 57,922.380 ↓ 2.0 2 747

Nested Loop (cost=493.83..495.88 rows=1 width=8) (actual time=77.513..77.540 rows=2 loops=747)

  • Output: urp.reprice_avg_cost
  • Buffers: shared hit=5,382,957
14. 10.458 57,814.812 ↓ 50.0 50 747

Unique (cost=493.41..493.42 rows=1 width=4) (actual time=77.376..77.396 rows=50 loops=747)

  • Output: p.provider_id
  • Buffers: shared hit=5,268,668
15. 32.121 57,804.354 ↓ 69.0 69 747

Sort (cost=493.41..493.41 rows=1 width=4) (actual time=77.375..77.382 rows=69 loops=747)

  • Output: p.provider_id
  • Sort Key: p.provider_id
  • Sort Method: quicksort Memory: 35kB
  • Buffers: shared hit=5,268,668
16. 21.663 57,772.233 ↓ 158.0 158 747

Subquery Scan on p (cost=493.38..493.40 rows=1 width=4) (actual time=77.298..77.339 rows=158 loops=747)

  • Output: p.provider_id
  • Buffers: shared hit=5,268,665
17. 45.567 57,750.570 ↓ 158.0 158 747

Sort (cost=493.38..493.39 rows=1 width=44) (actual time=77.297..77.310 rows=158 loops=747)

  • Output: ppl.provider_id, ppl.geography_point, ((up.provider_geography_point <-> ppl.geography_point))
  • Sort Key: ((up.provider_geography_point <-> ppl.geography_point))
  • Sort Method: quicksort Memory: 42kB
  • Buffers: shared hit=5,268,665
18. 196.461 57,705.003 ↓ 158.0 158 747

Group (cost=493.11..493.37 rows=1 width=44) (actual time=76.974..77.249 rows=158 loops=747)

  • Output: ppl.provider_id, ppl.geography_point, (up.provider_geography_point <-> ppl.geography_point)
  • Group Key: ppl.provider_id, ppl.geography_point
  • Buffers: shared hit=5,268,662
19. 179.280 57,508.542 ↓ 158.0 158 747

Sort (cost=493.11..493.12 rows=1 width=36) (actual time=76.971..76.986 rows=158 loops=747)

  • Output: ppl.provider_id, ppl.geography_point
  • Sort Key: ppl.provider_id, ppl.geography_point
  • Sort Method: quicksort Memory: 42kB
  • Buffers: shared hit=5,268,659
20. 6,599.745 57,329.262 ↓ 158.0 158 747

Bitmap Heap Scan on "20191599".plan_provider_locations ppl (cost=483.97..493.10 rows=1 width=36) (actual time=71.475..76.746 rows=158 loops=747)

  • Output: ppl.provider_id, ppl.geography_point
  • Recheck Cond: ((ppl.geography_point && _st_expand(up.provider_geography_point, '8046.72'::double precision)) AND (ppl.specialty_ids && up.specialty_ids))
  • Filter: ((up.provider_id <> ppl.provider_id) AND (ppl.plan_id = 6,584) AND (up.provider_geography_point && _st_expand(ppl.geography_point, '8046.72'::double precision)) AND _st_dwithin(up.provider_geography_point, ppl.geography_point, '8046.72'::double precision, true))
  • Rows Removed by Filter: 10,792
  • Heap Blocks: exact=3,760,402
  • Buffers: shared hit=5,268,651
21. 1,529.109 50,729.517 ↓ 0.0 0 747

BitmapAnd (cost=483.97..483.97 rows=6 width=0) (actual time=67.911..67.911 rows=0 loops=747)

  • Buffers: shared hit=1,508,190
22. 20,676.960 20,676.960 ↓ 326.8 195,421 747

Bitmap Index Scan on ix_plan_plan_provider_locations_geography (cost=0.00..11.02 rows=598 width=0) (actual time=27.680..27.680 rows=195,421 loops=747)

  • Index Cond: (ppl.geography_point && _st_expand(up.provider_geography_point, '8046.72'::double precision))
  • Buffers: shared hit=1,463,897
23. 28,523.448 28,523.448 ↓ 4.6 275,969 747

Bitmap Index Scan on ix_plan_provider_locations_specialties (cost=0.00..472.69 rows=59,826 width=0) (actual time=38.184..38.184 rows=275,969 loops=747)

  • Index Cond: (ppl.specialty_ids && up.specialty_ids)
  • Buffers: shared hit=44,293
24. 75.328 75.328 ↓ 0.0 0 37,664

Index Scan using ix_tmp_reprice on "20191599".utilization_reprice_procedures urp (cost=0.42..2.45 rows=1 width=12) (actual time=0.002..0.002 rows=0 loops=37,664)

  • Output: urp.id, urp.procedure_code, urp.reprice_avg_cost, urp.provider_id, urp.client_provider_id, urp.place_of_service_id, urp.member_category_id, urp.claim_type_id, urp.cost_type_id
  • Index Cond: ((urp.provider_id = p.provider_id) AND ((urp.procedure_code)::text = (up.procedure_code)::text) AND (urp.place_of_service_id = up.place_of_service_id) AND (urp.claim_type_id = up.claim_type_id) AND (urp.member_category_id = up.member_category_id))
  • Buffers: shared hit=114,289
25. 0.017 0.038 ↑ 3.9 23 1

Hash (cost=1.91..1.91 rows=90 width=20) (actual time=0.038..0.038 rows=23 loops=1)

  • Output: uf2.oon_factor, uf2.claim_type_id, uf2.place_of_service_id, uf2.member_category_id
  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
  • Buffers: shared hit=1
26. 0.021 0.021 ↑ 1.0 90 1

Seq Scan on "20191599".utilization_oon_factors uf2 (cost=0.00..1.91 rows=90 width=20) (actual time=0.004..0.021 rows=90 loops=1)

  • Output: uf2.oon_factor, uf2.claim_type_id, uf2.place_of_service_id, uf2.member_category_id
  • Filter: (uf2.procedure_code IS NULL)
  • Rows Removed by Filter: 1
  • Buffers: shared hit=1