explain.depesz.com

PostgreSQL's explain analyze made readable

Result: rnTU : Optimization for: plan #gfU7

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.611 73.795 ↓ 64.0 448 1

GroupAggregate (cost=906.97..907.39 rows=7 width=71) (actual time=73.009..73.795 rows=448 loops=1)

  • Group Key: psd.cid, psd.property_id, st.id, pb.id, (COALESCE(sil.is_hera, sil2.is_hera)), (COALESCE(sil.family_size, sil2.family_size)), psa.id, sct.id, pb.cid
2. 0.654 73.184 ↓ 64.0 448 1

Sort (cost=906.97..906.99 rows=7 width=63) (actual time=72.989..73.184 rows=448 loops=1)

  • Sort Key: st.id, pb.id, (COALESCE(sil.is_hera, sil2.is_hera)), (COALESCE(sil.family_size, sil2.family_size)), psa.id, sct.id, pb.cid
  • Sort Method: quicksort Memory: 60kB
3. 0.727 72.530 ↓ 64.0 448 1

Nested Loop Left Join (cost=3.55..906.88 rows=7 width=63) (actual time=23.518..72.530 rows=448 loops=1)

  • Join Filter: ((COALESCE(sil.is_hera, sil2.is_hera)) = ((st.id = 2) AND COALESCE(psd.tax_credit_use_hera_limits, false)))
  • Rows Removed by Join Filter: 448
4. 0.360 36.299 ↓ 8.0 56 1

Nested Loop Left Join (cost=2.70..47.81 rows=7 width=53) (actual time=22.161..36.299 rows=56 loops=1)

  • Join Filter: CASE WHEN (sct.id = 1) THEN (silt.id = CASE WHEN (sc.start_date <= '10/01/1981'::date) THEN 6 ELSE 3 END) WHEN (sct.id = 6) THEN (silt.id = 1) WHEN (sct.id = ANY ('{7,8}'::integer[])) THEN (silt.id = 3) WHEN (sct.id = ANY ('{3,2,9,4}'::integer[])) THEN (silt.id = 6) WHEN (sct.id = 5) THEN (silt.id = 7) WHEN (st.id = 2) THEN (silt.percent = psa.median_income_percent) WHEN (sct.id = 10) THEN (silt.id = 6) WHEN (sct.id = 11) THEN (silt.id = 3) ELSE NULL::boolean END
  • Rows Removed by Join Filter: 392
5. 0.132 35.659 ↓ 28.0 56 1

Nested Loop Left Join (cost=2.70..45.31 rows=2 width=53) (actual time=22.127..35.659 rows=56 loops=1)

6. 0.086 34.463 ↓ 28.0 56 1

Nested Loop Left Join (cost=2.42..35.82 rows=2 width=53) (actual time=21.989..34.463 rows=56 loops=1)

  • Join Filter: (sct.subsidy_type_id = st.id)
7. 0.138 34.321 ↓ 28.0 56 1

Nested Loop (cost=2.28..31.41 rows=2 width=50) (actual time=21.973..34.321 rows=56 loops=1)

8. 3.016 32.951 ↓ 14.0 56 1

Hash Join (cost=1.87..21.59 rows=4 width=63) (actual time=21.144..32.951 rows=56 loops=1)

  • Hash Cond: (pst.subsidy_type_id = st.id)
  • Join Filter: (((st.id = 2) AND psd.tax_credit_is_hold_harmless AND (COALESCE(sc.start_date, psa.placed_in_service_date) > silv.effective_date)) OR (silv.id = (SubPlan 1)))
  • Rows Removed by Join Filter: 1456
9. 1.625 2.707 ↓ 11.2 1,512 1

Nested Loop (cost=0.56..17.51 rows=135 width=68) (actual time=0.226..2.707 rows=1,512 loops=1)

10. 0.029 0.029 ↑ 1.0 27 1

Seq Scan on subsidy_income_limit_versions silv (cost=0.00..1.81 rows=27 width=8) (actual time=0.015..0.029 rows=27 loops=1)

11. 0.741 1.053 ↓ 11.2 56 27

Materialize (cost=0.56..11.32 rows=5 width=60) (actual time=0.008..0.039 rows=56 loops=27)

12. 0.056 0.312 ↓ 11.2 56 1

Nested Loop Left Join (cost=0.56..11.30 rows=5 width=60) (actual time=0.200..0.312 rows=56 loops=1)

13. 0.003 0.147 ↑ 1.0 1 1

Nested Loop Left Join (cost=0.28..5.01 rows=1 width=40) (actual time=0.142..0.147 rows=1 loops=1)

  • Join Filter: ((sc.cid = psd.cid) AND (sc.property_id = psd.property_id))
14. 0.004 0.124 ↑ 1.0 1 1

Nested Loop (cost=0.28..3.39 rows=1 width=32) (actual time=0.121..0.124 rows=1 loops=1)

15. 0.061 0.061 ↑ 1.0 1 1

Index Scan using uk_property_subsidy_details_cid_property_id on property_subsidy_details psd (cost=0.14..2.18 rows=1 width=28) (actual time=0.059..0.061 rows=1 loops=1)

  • Index Cond: ((cid = 14706) AND (property_id = 533143))
16. 0.059 0.059 ↑ 1.0 1 1

Index Only Scan using idx_property_subsidy_types_cid_pid_delon_subtypeid on property_subsidy_types pst (cost=0.14..1.19 rows=1 width=12) (actual time=0.058..0.059 rows=1 loops=1)

  • Index Cond: ((cid = 14706) AND (property_id = 533143) AND (deleted_on IS NULL))
  • Heap Fetches: 0
17. 0.020 0.020 ↓ 0.0 0 1

Seq Scan on subsidy_contracts sc (cost=0.00..1.58 rows=1 width=16) (actual time=0.020..0.020 rows=0 loops=1)

  • Filter: ((deleted_on IS NULL) AND (cid = 14706) AND (property_id = 533143) AND (CURRENT_DATE >= start_date) AND (CURRENT_DATE <= end_date))
  • Rows Removed by Filter: 13
18. 0.109 0.109 ↓ 11.2 56 1

Index Scan using idx_set_asides_cid_property_id_name on set_asides psa (cost=0.27..6.13 rows=5 width=25) (actual time=0.053..0.109 rows=56 loops=1)

  • Index Cond: ((cid = psd.cid) AND (cid = 14706) AND (property_id = psd.property_id) AND (property_id = 533143))
  • Filter: ((deleted_on IS NULL) AND ((property_building_id IS NOT NULL) = psd.is_tax_credit_multiple_building_project))
19. 0.006 0.012 ↑ 1.0 5 1

Hash (cost=1.15..1.15 rows=5 width=4) (actual time=0.011..0.012 rows=5 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
20. 0.006 0.006 ↑ 1.0 5 1

Seq Scan on subsidy_types st (cost=0.00..1.15 rows=5 width=4) (actual time=0.002..0.006 rows=5 loops=1)

21.          

SubPlan (forHash Join)

22. 4.536 27.216 ↑ 1.0 1 1,512

Limit (cost=2.37..2.37 rows=1 width=12) (actual time=0.016..0.018 rows=1 loops=1,512)

23. 4.536 22.680 ↑ 4.0 1 1,512

Sort (cost=2.37..2.38 rows=4 width=12) (actual time=0.015..0.015 rows=1 loops=1,512)

  • Sort Key: subsidy_income_limit_versions.property_id, subsidy_income_limit_versions.effective_date DESC, subsidy_income_limit_versions.id DESC
  • Sort Method: quicksort Memory: 25kB
24. 18.144 18.144 ↑ 4.0 1 1,512

Seq Scan on subsidy_income_limit_versions (cost=0.00..2.35 rows=4 width=12) (actual time=0.008..0.012 rows=1 loops=1,512)

  • Filter: (is_published AND (CURRENT_DATE >= effective_date) AND (CURRENT_DATE <= effective_through_date) AND (((pst.subsidy_type_id = 2) AND (property_id = 533143) AND (cid = 14706)) OR ((cid = 1) AND (property_id IS NULL))))
  • Rows Removed by Filter: 26
25. 1.232 1.232 ↑ 1.0 1 56

Index Scan using uk_subsidy_income_limit_areas_silvi_hmfa_code on subsidy_income_limit_areas sila (cost=0.41..2.45 rows=1 width=25) (actual time=0.022..0.022 rows=1 loops=56)

  • Index Cond: ((subsidy_income_limit_version_id = silv.id) AND (hmfa_code = psd.hmfa_code))
26. 0.056 0.056 ↓ 0.0 0 56

Index Scan using pk_subsidy_contract_types on subsidy_contract_types sct (cost=0.14..2.17 rows=1 width=11) (actual time=0.001..0.001 rows=0 loops=56)

  • Index Cond: (sc.subsidy_contract_type_id = id)
27. 1.064 1.064 ↑ 1.0 1 56

Index Only Scan using pk_property_buildings on property_buildings pb (cost=0.28..4.72 rows=1 width=8) (actual time=0.010..0.019 rows=1 loops=56)

  • Index Cond: ((cid = psa.cid) AND (cid = 14706))
  • Filter: (id = COALESCE(psa.property_building_id, id))
  • Rows Removed by Filter: 73
  • Heap Fetches: 1344
28. 0.261 0.280 ↑ 1.0 8 56

Materialize (cost=0.00..1.28 rows=8 width=9) (actual time=0.001..0.005 rows=8 loops=56)

29. 0.019 0.019 ↑ 1.0 8 1

Seq Scan on subsidy_income_level_types silt (cost=0.00..1.24 rows=8 width=9) (actual time=0.013..0.019 rows=8 loops=1)

30. 5.096 35.504 ↓ 16.0 16 56

Nested Loop Left Join (cost=0.85..122.66 rows=1 width=44) (actual time=0.057..0.634 rows=16 loops=56)

  • Join Filter: ((sil.subsidy_income_limit_version_id = sil2.subsidy_income_limit_version_id) AND (sil.subsidy_income_limit_area_id = sil2.subsidy_income_limit_area_id) AND (sil.subsidy_type_id = sil2.subsidy_type_id) AND (sil.is_hera = sil2.is_hera) AND (sil.family_size = sil2.family_size))
  • Rows Removed by Join Filter: 120
31. 2.632 2.632 ↓ 16.0 16 56

Index Scan using idx_subsidy_income_limits_subsidy_income_limit_area_id on subsidy_income_limits sil2 (cost=0.43..61.30 rows=1 width=19) (actual time=0.024..0.047 rows=16 loops=56)

  • Index Cond: (subsidy_income_limit_area_id = sila.id)
  • Filter: ((subsidy_income_limit_version_id = silv.id) AND (subsidy_type_id = pst.subsidy_type_id) AND (subsidy_income_level_type_id = 3))
  • Rows Removed by Filter: 88
32. 27.776 27.776 ↓ 8.0 8 896

Index Scan using idx_subsidy_income_limits_subsidy_income_limit_area_id on subsidy_income_limits sil (cost=0.43..61.30 rows=1 width=19) (actual time=0.020..0.031 rows=8 loops=896)

  • Index Cond: (subsidy_income_limit_area_id = sila.id)
  • Filter: ((subsidy_income_limit_version_id = silv.id) AND (subsidy_income_level_type_id = silt.id) AND (subsidy_type_id = pst.subsidy_type_id))
  • Rows Removed by Filter: 96