explain.depesz.com

PostgreSQL's explain analyze made readable

Result: lXTw3

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

Subquery Scan on subsidy_hap_request_ar_transcation (cost=25.28..25.32 rows=1 width=291) (actual rows= loops=)

  • Filter: (subsidy_hap_request_ar_transcation.subsidy_certification_rank = 1)
2.          

CTE old_hap_transactions

3. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.84..10.25 rows=1 width=29) (actual rows= loops=)

4. 0.000 0.000 ↓ 0.0

Seq Scan on subsidy_hap_requests shr_1 (cost=0.00..1.88 rows=1 width=4) (actual rows= loops=)

  • Filter: ((cid = 15760) AND (id = 1158))
5. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.84..8.34 rows=1 width=29) (actual rows= loops=)

6. 0.000 0.000 ↓ 0.0

Index Scan Backward using idx_ar_transactions_allocations_join on ar_transactions at (cost=0.56..3.62 rows=2 width=25) (actual rows= loops=)

  • Index Cond: ((cid = 15760) AND (property_id = 649300))
7. 0.000 0.000 ↓ 0.0

Index Only Scan using uk_subsidy_hap_request_ar_transactions_name on subsidy_hap_request_ar_transactions shrat (cost=0.28..2.33 rows=1 width=20) (actual rows= loops=)

  • Index Cond: ((cid = 15760) AND (property_id = 649300) AND (subsidy_hap_request_id = shr_1.previous_subsidy_hap_request_id) AND (lease_id = at.lease_id) AND (ar_transaction_id = at.id) AND (is_adjustment = false))
  • Filter: (NOT is_adjustment)
8. 0.000 0.000 ↓ 0.0

Sort (cost=15.03..15.04 rows=1 width=972) (actual rows= loops=)

  • Sort Key: cl.display_number
9. 0.000 0.000 ↓ 0.0

WindowAgg (cost=14.95..15.02 rows=1 width=972) (actual rows= loops=)

10. 0.000 0.000 ↓ 0.0

Sort (cost=14.95..14.95 rows=1 width=831) (actual rows= loops=)

  • Sort Key: cl.id, sc.id DESC
11. 0.000 0.000 ↓ 0.0

GroupAggregate (cost=14.82..14.94 rows=1 width=831) (actual rows= loops=)

  • Group Key: cl.display_number, cl.id, cl.unit_number_cache, cl.name_full, pu.number_of_bedrooms, sc.id, sc.subsidy_certification_type_id, sc.effective_date, sc.effective_through_date, sc.mat_data, sc.first_voucher_date, sct.name, sc1.start_date, siet.id, art.transaction_amount, oht.old_transaction_id, oht.transaction_amount, cl.primary_customer_id
12. 0.000 0.000 ↓ 0.0

Sort (cost=14.82..14.83 rows=1 width=750) (actual rows= loops=)

  • Sort Key: cl.display_number, cl.id, cl.unit_number_cache, cl.name_full, pu.number_of_bedrooms, sc.id, sc.subsidy_certification_type_id, sc.effective_date, sc.effective_through_date, sc.mat_data, sc.first_voucher_date, sct.name, sc1.start_date, siet.id, art.transaction_amount, oht.old_transaction_id, oht.transaction_amount, cl.primary_customer_id
13. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=5.00..14.81 rows=1 width=750) (actual rows= loops=)

14. 0.000 0.000 ↓ 0.0

Nested Loop (cost=4.87..14.63 rows=1 width=747) (actual rows= loops=)

15. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=4.59..13.90 rows=1 width=751) (actual rows= loops=)

  • Join Filter: ((oht.cid = art.cid) AND (oht.property_id = art.property_id) AND (oht.lease_id = art.lease_id) AND (oht.ar_code_id = art.ar_code_id))
16. 0.000 0.000 ↓ 0.0

Nested Loop (cost=4.59..13.80 rows=1 width=745) (actual rows= loops=)

  • Join Filter: (r.unit_type_id = pu.unit_type_id)
17. 0.000 0.000 ↓ 0.0

Nested Loop (cost=4.29..11.43 rows=1 width=749) (actual rows= loops=)

  • Join Filter: ((sc.subsidy_contract_id = shr.subsidy_contract_id) AND (date_trunc('month'::text, ((r.effective_datetime)::date)::timestamp with time zone) <= date_trunc('month'::text, (shr.voucher_date)::timestamp with time zone)))
18. 0.000 0.000 ↓ 0.0

Nested Loop (cost=4.29..9.45 rows=1 width=769) (actual rows= loops=)

  • Join Filter: (art.lease_id = cl.id)
19. 0.000 0.000 ↓ 0.0

Nested Loop (cost=3.87..6.94 rows=1 width=738) (actual rows= loops=)

  • Join Filter: (sc.lease_id = art.lease_id)
20. 0.000 0.000 ↓ 0.0

Merge Join (cost=3.31..4.30 rows=1 width=729) (actual rows= loops=)

  • Merge Cond: (sc.subsidy_contract_id = r.occupancy_type_object_id)
  • Join Filter: ((sc1.subsidy_contract_type_id = r.occupancy_type_reference_id) AND (ac.ar_code_type_id = r.ar_code_type_id))
21. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.83..482.75 rows=514 width=706) (actual rows= loops=)

22. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.55..383.42 rows=6 width=690) (actual rows= loops=)

23. 0.000 0.000 ↓ 0.0

Nested Loop (cost=0.42..382.17 rows=6 width=674) (actual rows= loops=)

  • Join Filter: (sc.subsidy_contract_id = sc1.id)
24. 0.000 0.000 ↓ 0.0

Index Scan using pk_subsidy_contracts on subsidy_contracts sc1 (cost=0.14..2.17 rows=1 width=16) (actual rows= loops=)

  • Index Cond: (cid = 15760)
25. 0.000 0.000 ↓ 0.0

Index Scan using idx_subsidy_certifications_cid_appid_certtype_certstatus on subsidy_certifications sc (cost=0.28..375.32 rows=144 width=662) (actual rows= loops=)

  • Index Cond: ((cid = 15760) AND (subsidy_certification_status_type_id >= 4))
  • Filter: ((deleted_on IS NULL) AND (property_id = 649300) AND (date_trunc('month'::text, (anticipated_voucher_date)::timestamp with time zone) <= '2020-04-01 00:00:00-06'::timestamp with time zone))
26. 0.000 0.000 ↓ 0.0

Index Scan using pk_subsidy_certification_types on subsidy_certification_types sct (cost=0.13..0.22 rows=1 width=20) (actual rows= loops=)

  • Index Cond: (id = sc.subsidy_certification_type_id)
27. 0.000 0.000 ↓ 0.0

Materialize (cost=0.28..83.35 rows=83 width=16) (actual rows= loops=)

28. 0.000 0.000 ↓ 0.0

Index Scan using pk_ar_codes on ar_codes ac (cost=0.28..82.94 rows=83 width=16) (actual rows= loops=)

  • Index Cond: (cid = 15760)
29. 0.000 0.000 ↓ 0.0

Sort (cost=2.48..2.49 rows=1 width=39) (actual rows= loops=)

  • Sort Key: r.occupancy_type_object_id
30. 0.000 0.000 ↓ 0.0

Index Scan using idx_rates_cid_property_id_unit_space_id on rates r (cost=0.43..2.47 rows=1 width=39) (actual rows= loops=)

  • Index Cond: ((cid = 15760) AND (property_id = 649300))
  • Filter: (is_allowed AND (occupancy_type_id = 6) AND (ar_origin_id = 1))
31. 0.000 0.000 ↓ 0.0

Index Scan using idx_ar_transactions_ar_codes_join on ar_transactions art (cost=0.56..2.62 rows=1 width=33) (actual rows= loops=)

  • Index Cond: ((cid = 15760) AND (property_id = 649300) AND (ar_code_id = ac.id))
  • Filter: ((ar_transaction_id IS NULL) AND (is_posted IS TRUE) AND (is_deleted IS FALSE) AND (is_reversal IS FALSE) AND (is_temporary IS FALSE) AND (ar_code_id = ANY ('{144358,144440}'::integer[])) AND (transaction_amount > '0'::numeric) AND (date_trunc('month'::text, (post_date)::timestamp with time zone) = '2020-04-01 00:00:00-06'::timestamp with time zone))
32. 0.000 0.000 ↓ 0.0

Index Scan using idx_cached_leases_cid_property_id on cached_leases cl (cost=0.42..2.47 rows=1 width=43) (actual rows= loops=)

  • Index Cond: ((cid = 15760) AND (property_id = 649300))
  • Filter: ((occupancy_type_id = 6) AND (lease_status_type_id = ANY ('{3,5,6,4}'::integer[])))
33. 0.000 0.000 ↓ 0.0

Seq Scan on subsidy_hap_requests shr (cost=0.00..1.94 rows=1 width=16) (actual rows= loops=)

  • Filter: ((cid = 15760) AND (property_id = 649300) AND (id = 1158))
34. 0.000 0.000 ↓ 0.0

Index Scan using pk_property_units on property_units pu (cost=0.29..2.33 rows=1 width=20) (actual rows= loops=)

  • Index Cond: ((cid = 15760) AND (id = cl.property_unit_id))
  • Filter: (property_id = 649300)
35. 0.000 0.000 ↓ 0.0

CTE Scan on old_hap_transactions oht (cost=0.00..0.07 rows=1 width=38) (actual rows= loops=)

  • Filter: ((cid = 15760) AND (property_id = 649300))
36. 0.000 0.000 ↓ 0.0

Index Scan using uk_application_subsidy_details_cid_application_id on application_subsidy_details asd (cost=0.28..0.72 rows=1 width=12) (actual rows= loops=)

  • Index Cond: ((cid = 15760) AND (application_id = sc.application_id))
37. 0.000 0.000 ↓ 0.0

Index Scan using pk_subsidy_income_exception_types on subsidy_income_exception_types siet (cost=0.13..0.18 rows=1 width=7) (actual rows= loops=)

  • Index Cond: (id = asd.subsidy_income_exception_type_id)