explain.depesz.com

PostgreSQL's explain analyze made readable

Result: QlPA

Settings
# exclusive inclusive rows x rows loops node
1. 10.296 18,025.692 ↓ 1,223.0 1,223 1

Sort (cost=1,520.79..1,520.80 rows=1 width=1,140) (actual time=18,025.522..18,025.692 rows=1,223 loops=1)

  • Sort Key: l.property_name, (CASE WHEN (3 = l.lease_interval_type_id) THEN (cal_max.lease_approved)::date WHEN (1 = l.lease_interval_type_id) THEN CASE WHEN ('12'::text = pp_applications.value) THEN (l.application_approved_on)::date WHEN ('18'::text = pp_applications.value) THEN (cal_max.lease_approved)::date ELSE (LEAST(l.application_completed, e.event_datetime))::date END WHEN (5 = l.lease_interval_type_id) THEN CASE WHEN ('51'::text = pp_transfers.value) THEN (LEAST(l.application_completed, e.event_datetime))::date WHEN ('52'::text = pp_transfers.value) THEN (l.application_approved_on)::date ELSE (cal_max.lease_approved)::date END ELSE NULL::date END) DESC, (CASE WHEN (l.lease_interval_type_id = 1) THEN 1 WHEN (l.lease_interval_type_id = 5) THEN 2 WHEN (l.lease_interval_type_id = 3) THEN 3 ELSE NULL::integer END)
  • Sort Method: quicksort Memory: 679kB
2. 39.620 18,015.396 ↓ 1,223.0 1,223 1

Nested Loop Left Join (cost=219.28..1,520.78 rows=1 width=1,140) (actual time=212.890..18,015.396 rows=1,223 loops=1)

  • Filter: CASE WHEN (3 = l.lease_interval_type_id) THEN (((cal_max.lease_approved)::date >= '2018-01-01'::date) AND ((cal_max.lease_approved)::date < '2019-01-01 00:00:00'::timestamp without time zone)) WHEN (1 = l.lease_interval_type_id) THEN CASE WHEN ('12'::text = pp_applications.value) THEN (((l.application_approved_on)::date >= '2018-01-01'::date) AND ((l.application_approved_on)::date < '2019-01-01 00:00:00'::timestamp without time zone)) WHEN ('18'::text = pp_applications.value) THEN (((cal_max.lease_approved)::date >= '2018-01-01'::date) AND ((cal_max.lease_approved)::date < '2019-01-01 00:00:00'::timestamp without time zone)) ELSE (((LEAST(l.application_completed, e.event_datetime))::date >= '2018-01-01'::date) AND ((LEAST(l.application_completed, e.event_datetime))::date < '2019-01-01 00:00:00'::timestamp without time zone)) END WHEN (5 = l.lease_interval_type_id) THEN CASE WHEN ('51'::text = pp_transfers.value) THEN (((LEAST(l.application_completed, e.event_datetime))::date >= '2018-01-01'::date) AND ((LEAST(l.application_completed, e.event_datetime))::date < '2019-01-01 00:00:00'::timestamp without time zone)) WHEN ('52'::text = pp_transfers.value) THEN (((l.application_approved_on)::date >= '2018-01-01'::date) AND ((l.application_approved_on)::date < '2019-01-01 00:00:00'::timestamp without time zone)) ELSE (((cal_max.lease_approved)::date >= '2018-01-01'::date) AND ((cal_max.lease_approved)::date < '2019-01-01 00:00:00'::timestamp without time zone)) END ELSE NULL::boolean END
  • Rows Removed by Filter: 770
3. 3.938 17,961.825 ↓ 1,993.0 1,993 1

Nested Loop Left Join (cost=218.86..1,511.39 rows=1 width=1,097) (actual time=18.569..17,961.825 rows=1,993 loops=1)

4. 5.206 17,937.957 ↓ 1,993.0 1,993 1

Nested Loop Left Join (cost=218.44..1,502.72 rows=1 width=1,078) (actual time=18.547..17,937.957 rows=1,993 loops=1)

5. 4.467 17,922.786 ↓ 1,993.0 1,993 1

Nested Loop Left Join (cost=218.15..1,494.67 rows=1 width=1,078) (actual time=18.534..17,922.786 rows=1,993 loops=1)

6. 3.355 17,910.347 ↓ 1,993.0 1,993 1

Nested Loop Left Join (cost=217.87..1,489.45 rows=1 width=844) (actual time=18.520..17,910.347 rows=1,993 loops=1)

7. 5.098 17,897.027 ↓ 1,993.0 1,993 1

Nested Loop Left Join (cost=217.59..1,484.68 rows=1 width=839) (actual time=18.508..17,897.027 rows=1,993 loops=1)

8. 4.833 17,885.950 ↓ 1,993.0 1,993 1

Nested Loop Left Join (cost=217.46..1,484.16 rows=1 width=827) (actual time=18.499..17,885.950 rows=1,993 loops=1)

9. 4.105 17,492.482 ↓ 1,993.0 1,993 1

Nested Loop Left Join (cost=202.18..1,467.82 rows=1 width=693) (actual time=18.283..17,492.482 rows=1,993 loops=1)

10. 633.602 17,478.412 ↓ 1,993.0 1,993 1

Nested Loop (cost=201.90..1,459.50 rows=1 width=557) (actual time=18.268..17,478.412 rows=1,993 loops=1)

  • Join Filter: (cll.unit_space_id = past_recent_lease.unit_space_id)
  • Rows Removed by Join Filter: 2881658
11. 3.901 178.576 ↓ 719.3 2,158 1

Nested Loop Left Join (cost=10.46..717.18 rows=3 width=501) (actual time=0.557..178.576 rows=2,158 loops=1)

12. 5.089 159.569 ↓ 719.3 2,158 1

Nested Loop Left Join (cost=2.13..692.10 rows=3 width=493) (actual time=0.532..159.569 rows=2,158 loops=1)

13. 4.221 145.848 ↓ 2,158.0 2,158 1

Nested Loop Left Join (cost=1.84..691.78 rows=1 width=497) (actual time=0.520..145.848 rows=2,158 loops=1)

14. 3.711 124.363 ↓ 2,158.0 2,158 1

Nested Loop (cost=1.42..683.32 rows=1 width=477) (actual time=0.507..124.363 rows=2,158 loops=1)

15. 4.679 107.704 ↓ 2,158.0 2,158 1

Nested Loop (cost=1.13..676.00 rows=1 width=465) (actual time=0.476..107.704 rows=2,158 loops=1)

16. 2.616 87.814 ↓ 2,173.0 2,173 1

Nested Loop (cost=0.71..673.74 rows=1 width=461) (actual time=0.461..87.814 rows=2,173 loops=1)

17. 3.870 74.333 ↓ 362.2 2,173 1

Nested Loop (cost=0.43..671.87 rows=6 width=467) (actual time=0.452..74.333 rows=2,173 loops=1)

18. 5.033 5.033 ↓ 49.6 2,181 1

Seq Scan on leads l (cost=0.00..298.75 rows=44 width=414) (actual time=0.412..5.033 rows=2,181 loops=1)

  • Filter: ((unit_number_cache IS NOT NULL) AND (post_date >= '2018-01-01'::date) AND (cid = 8132) AND (lease_interval_type_id = ANY ('{1,5,3}'::integer[])))
  • Rows Removed by Filter: 6659
19. 65.430 65.430 ↑ 1.0 1 2,181

Index Scan using idx_cached_lease_logs_cid_lease_id_log_datetime_date on cached_lease_logs cll (cost=0.43..8.47 rows=1 width=53) (actual time=0.029..0.030 rows=1 loops=2,181)

  • Index Cond: ((cid = 8132) AND (lease_id = l.lease_id) AND (reporting_post_date < '2019-01-01 00:00:00'::timestamp without time zone))
  • Filter: ((apply_through_post_date >= '2018-12-31'::date) AND (is_post_date_ignored = 0))
  • Rows Removed by Filter: 13
20. 10.865 10.865 ↑ 1.0 1 2,173

Index Scan using idx_property_charge_settings_property_id on property_charge_settings pcs (cost=0.28..0.30 rows=1 width=10) (actual time=0.004..0.005 rows=1 loops=2,173)

  • Index Cond: (property_id = cll.property_id)
  • Filter: (cid = 8132)
21. 15.211 15.211 ↑ 1.0 1 2,173

Index Scan using pk_cached_leases on cached_leases cl (cost=0.42..2.25 rows=1 width=16) (actual time=0.007..0.007 rows=1 loops=2,173)

  • Index Cond: ((cid = 8132) AND (id = cll.lease_id))
  • Filter: (lease_status_type_id <> 2)
  • Rows Removed by Filter: 0
22. 12.948 12.948 ↑ 1.0 1 2,158

Index Scan using idx_temp_min_max_leads_application_id on min_max_leads cal_max (cost=0.29..7.31 rows=1 width=28) (actual time=0.005..0.006 rows=1 loops=2,158)

  • Index Cond: (application_id = l.application_id)
  • Filter: ((cid = 8132) AND (l.property_id = property_id))
23. 17.264 17.264 ↑ 1.0 1 2,158

Index Scan using idx_lease_intervals on lease_intervals li (cost=0.43..8.45 rows=1 width=24) (actual time=0.008..0.008 rows=1 loops=2,158)

  • Index Cond: (id = l.lease_interval_id)
  • Filter: ((cid = 8132) AND (cid = l.cid) AND (lease_id = l.lease_id))
  • Rows Removed by Filter: 0
24. 8.632 8.632 ↑ 1.0 1 2,158

Index Scan using pk_lease_terms on lease_terms lt (cost=0.29..0.32 rows=1 width=12) (actual time=0.004..0.004 rows=1 loops=2,158)

  • Index Cond: ((cid = li.cid) AND (cid = 8132) AND (id = li.lease_term_id))
25. 2.158 15.106 ↓ 0.0 0 2,158

Limit (cost=8.33..8.34 rows=1 width=8) (actual time=0.007..0.007 rows=0 loops=2,158)

26. 6.474 12.948 ↓ 0.0 0 2,158

Sort (cost=8.33..8.34 rows=1 width=8) (actual time=0.006..0.006 rows=0 loops=2,158)

  • Sort Key: e.event_datetime
  • Sort Method: quicksort Memory: 25kB
27. 6.474 6.474 ↓ 0.0 0 2,158

Index Scan using idx_events_lease_interval_id_status_change on events e (cost=0.29..8.32 rows=1 width=8) (actual time=0.003..0.003 rows=0 loops=2,158)

  • Index Cond: (lease_interval_id = l.lease_interval_id)
  • Filter: ((cid = 8132) AND (new_stage_id = 3) AND (new_status_id = 2) AND (((new_stage_id = 3) AND (old_stage_id < 3)) OR ((new_status_id = 2) AND (old_status_id < 2))))
  • Rows Removed by Filter: 0
28. 1,732.874 16,666.234 ↓ 190.9 1,336 2,158

Subquery Scan on past_recent_lease (cost=191.43..247.35 rows=7 width=68) (actual time=3.525..7.723 rows=1,336 loops=2,158)

  • Filter: ((past_recent_lease.lease_id IS NOT NULL) AND (past_recent_lease.cid = 8132) AND (past_recent_lease.prior_lease_row_num = 1))
  • Rows Removed by Filter: 1434
29. 6,422.208 14,933.360 ↓ 2.0 2,771 2,158

WindowAgg (cost=191.43..226.38 rows=1,398 width=80) (actual time=3.525..6.920 rows=2,771 loops=2,158)

30. 4,823.130 8,511.152 ↓ 2.0 2,771 2,158

Sort (cost=191.43..194.93 rows=1,398 width=72) (actual time=3.521..3.944 rows=2,771 loops=2,158)

  • Sort Key: cl_1.unit_space_id, (CASE WHEN (cl_1.move_out_date IS NOT NULL) THEN cl_1.move_out_date ELSE NULL::date END) DESC, cl_1.lease_end_date DESC
  • Sort Method: quicksort Memory: 499kB
31. 3,688.022 3,688.022 ↓ 2.0 2,771 2,158

Seq Scan on available_cached_leases cl_1 (cost=0.00..118.40 rows=1,398 width=72) (actual time=0.005..1.709 rows=2,771 loops=2,158)

  • Filter: ((lease_interval_id <> l.lease_interval_id) AND (lease_start_date < li.lease_start_date) AND (cid = 8132))
  • Rows Removed by Filter: 1423
32. 9.965 9.965 ↑ 1.0 1 1,993

Index Scan using idx_temp_cached_leases_scheduled_charges_lease_interval_id on cached_leases_scheduled_charges lsc (cost=0.29..8.31 rows=1 width=156) (actual time=0.005..0.005 rows=1 loops=1,993)

  • Index Cond: (lease_interval_id = past_recent_lease.lease_interval_id)
  • Filter: ((cid = 8132) AND (cid = past_recent_lease.cid) AND (lease_id = past_recent_lease.lease_id))
33. 91.678 388.635 ↑ 1.0 1 1,993

GroupAggregate (cost=15.27..16.32 rows=1 width=176) (actual time=0.195..0.195 rows=1 loops=1,993)

  • Group Key: sc.one_time_concession
34. 11.958 296.957 ↓ 4.0 4 1,993

Sort (cost=15.27..15.28 rows=1 width=73) (actual time=0.148..0.149 rows=4 loops=1,993)

  • Sort Key: sc.one_time_concession
  • Sort Method: quicksort Memory: 25kB
35. 5.979 284.999 ↓ 4.0 4 1,993

Subquery Scan on sc (cost=15.22..15.26 rows=1 width=73) (actual time=0.134..0.143 rows=4 loops=1,993)

36. 17.937 279.020 ↓ 4.0 4 1,993

WindowAgg (cost=15.22..15.25 rows=1 width=121) (actual time=0.133..0.140 rows=4 loops=1,993)

37. 17.937 261.083 ↓ 4.0 4 1,993

Sort (cost=15.22..15.22 rows=1 width=81) (actual time=0.131..0.131 rows=4 loops=1,993)

  • Sort Key: sc_charges.property_id, sc_charges.ar_origin_id, sc_charges.ar_code_type_id, sc_charges.charge_end_date DESC
  • Sort Method: quicksort Memory: 25kB
38. 7.972 243.146 ↓ 4.0 4 1,993

Group (cost=15.17..15.21 rows=1 width=81) (actual time=0.118..0.122 rows=4 loops=1,993)

  • Group Key: sc_charges.cid, sc_charges.lease_id, sc_charges.lease_interval_id, sc_charges.property_id, sc_charges.charge_amount, sc_charges.ar_origin_id, sc_charges.ar_code_type_id, sc_charges.scheduled_charge_type_id, sc_charges.charge_start_date, sc_charges.charge_end_date, sc_charges.ar_trigger_id, sc_charges.ar_code_id, current_manual_concession.one_time_concession
39. 27.902 235.174 ↓ 5.0 5 1,993

Sort (cost=15.17..15.17 rows=1 width=81) (actual time=0.117..0.118 rows=5 loops=1,993)

  • Sort Key: sc_charges.property_id, sc_charges.charge_amount, sc_charges.ar_origin_id, sc_charges.ar_code_type_id, sc_charges.scheduled_charge_type_id, sc_charges.charge_start_date, sc_charges.charge_end_date, sc_charges.ar_trigger_id, sc_charges.ar_code_id, current_manual_concession.one_time_concession
  • Sort Method: quicksort Memory: 25kB
40. 25.185 207.272 ↓ 5.0 5 1,993

Nested Loop Left Join (cost=9.43..15.16 rows=1 width=81) (actual time=0.058..0.104 rows=5 loops=1,993)

41. 61.783 115.594 ↓ 5.0 5 1,993

Bitmap Heap Scan on scheduled_charges sc_charges (cost=9.43..13.45 rows=1 width=49) (actual time=0.046..0.058 rows=5 loops=1,993)

  • Recheck Cond: ((cid = 8132) AND (lease_id = l.lease_id) AND (lease_interval_id = li.id))
  • Filter: ((NOT is_unselected_quote) AND (deleted_on IS NULL) AND (deleted_by IS NULL))
  • Rows Removed by Filter: 10
  • Heap Blocks: exact=13297
42. 5.979 53.811 ↓ 0.0 0 1,993

BitmapAnd (cost=9.43..9.43 rows=1 width=0) (actual time=0.027..0.027 rows=0 loops=1,993)

43. 29.895 29.895 ↓ 10.2 51 1,993

Bitmap Index Scan on idx_scheduled_charges_remote_primary_key (cost=0.00..4.48 rows=5 width=0) (actual time=0.015..0.015 rows=51 loops=1,993)

  • Index Cond: ((cid = 8132) AND (lease_id = l.lease_id))
44. 17.937 17.937 ↑ 2.4 15 1,993

Bitmap Index Scan on idx_scheduled_charges_lease_interval_id (cost=0.00..4.70 rows=36 width=0) (actual time=0.009..0.009 rows=15 loops=1,993)

  • Index Cond: (lease_interval_id = li.id)
45. 66.493 66.493 ↓ 0.0 0 9,499

Seq Scan on ar_transaction_concessions current_manual_concession (cost=0.00..1.70 rows=1 width=32) (actual time=0.007..0.007 rows=0 loops=9,499)

  • Filter: ((cid = l.cid) AND (lease_id = l.lease_id) AND (lease_interval_id = li.id))
  • Rows Removed by Filter: 40
46. 5.979 5.979 ↑ 1.0 1 1,993

Index Scan using pk_lease_interval_types on lease_interval_types lit (cost=0.13..0.42 rows=1 width=16) (actual time=0.003..0.003 rows=1 loops=1,993)

  • Index Cond: (id = l.lease_interval_type_id)
47. 9.965 9.965 ↑ 1.0 1 1,993

Index Scan using idx_property_floorplans on property_floorplans pf (cost=0.28..4.76 rows=1 width=17) (actual time=0.005..0.005 rows=1 loops=1,993)

  • Index Cond: (id = l.property_floorplan_id)
  • Filter: ((cid = 8132) AND (cid = l.cid))
48. 7.972 7.972 ↑ 1.0 1 1,993

Index Scan using idx_unit_types_id on unit_types ut (cost=0.28..5.21 rows=1 width=246) (actual time=0.004..0.004 rows=1 loops=1,993)

  • Index Cond: (id = l.unit_type_id)
  • Filter: ((cid = 8132) AND (cid = l.cid))
49. 9.965 9.965 ↑ 1.0 1 1,993

Index Scan using pk_property_units on property_units pu (cost=0.29..8.04 rows=1 width=12) (actual time=0.005..0.005 rows=1 loops=1,993)

  • Index Cond: ((cid = l.cid) AND (cid = 8132) AND (id = l.property_unit_id))
50. 19.930 19.930 ↑ 1.0 1 1,993

Index Scan using uk_property_preferences_cid_property_id_key on property_preferences pp_applications (cost=0.42..8.45 rows=1 width=27) (actual time=0.010..0.010 rows=1 loops=1,993)

  • Index Cond: ((cid = l.cid) AND (cid = 8132) AND (property_id = l.property_id) AND ((key)::text = 'CHANGE_UNIT_STATUS_TO_RENTED'::text))
51. 13.951 13.951 ↑ 1.0 1 1,993

Index Scan using uk_property_preferences_cid_property_id_key on property_preferences pp_transfers (cost=0.42..8.45 rows=1 width=27) (actual time=0.007..0.007 rows=1 loops=1,993)

  • Index Cond: ((cid = l.cid) AND (cid = 8132) AND (property_id = l.property_id) AND ((key)::text = 'TRANSFER_CHANGE_UNIT_STATUS_TO_RENTED'::text))
Planning time : 20.114 ms