explain.depesz.com

PostgreSQL's explain analyze made readable

Result: c8PM

Settings
# exclusive inclusive rows x rows loops node
1. 0.033 159,140.060 ↓ 15.0 30 1

Limit (cost=2,269.75..2,269.87 rows=2 width=1,038) (actual time=159,139.997..159,140.060 rows=30 loops=1)

2. 0.041 159,140.027 ↓ 15.0 30 1

Result (cost=2,269.75..2,269.87 rows=2 width=1,038) (actual time=159,139.996..159,140.027 rows=30 loops=1)

3. 0.234 159,139.986 ↓ 15.0 30 1

Sort (cost=2,269.75..2,269.76 rows=2 width=1,006) (actual time=159,139.985..159,139.986 rows=30 loops=1)

  • Sort Key: cne.priority DESC NULLS LAST, cne.overdue_business_days DESC
  • Sort Method: top-N heapsort Memory: 33kB
4. 0.696 159,139.752 ↓ 593.0 1,186 1

Unique (cost=2,269.50..2,269.68 rows=2 width=1,006) (actual time=159,139.005..159,139.752 rows=1,186 loops=1)

5. 0.884 159,139.056 ↓ 593.0 1,186 1

Sort (cost=2,269.50..2,269.51 rows=2 width=1,006) (actual time=159,139.004..159,139.056 rows=1,186 loops=1)

  • Sort Key: cne.id, cne.cid, ce.id, ca.leasing_agent_id, cne.priority, cne.overdue_business_days, cne.overdue_buisness_time, cne.primary_customer_id, (''::text), cne.name_first, cne.name_last, (COALESCE((((ce.name_first)::text || ' '::text) || (ce.name_last)::text), (ce.name_first)::text, (ce.name_last)::text)), cne.primary_phone_number, (''::text), cne.ps_product_id, cne.associated_event_id, cne.property_name, cne.data_reference_id, cne.lease_id, (NULL::integer), cne.created_on, cne.scheduled_datetime, (COALESCE(est.name, et.name)), cne.property_id, cne.notes, cne.event_sub_type_id, (2), ei.event_type_id, ((date_part('day'::text, (now() - ((ei.scheduled_datetime)::timestamp without time zone)::timestamp with time zone)))::integer), ((date_part('day'::text, (now() - ((ei_2.scheduled_datetime)::timestamp without time zone)::timestamp with time zone)))::integer), ((ei.scheduled_datetime)::timestamp without time zone), ei_2.event_type_id, ei_1.notes, cne.time_zone_name, (concat_ws(' - '::text, lst.name, lit.name))
  • Sort Method: quicksort Memory: 700kB
6. 0.078 159,138.172 ↓ 593.0 1,186 1

Append (cost=350.74..2,269.49 rows=2 width=1,006) (actual time=158,903.852..159,138.172 rows=1,186 loops=1)

7. 0.042 158,903.895 ↓ 67.0 67 1

Unique (cost=350.74..350.82 rows=1 width=553) (actual time=158,903.851..158,903.895 rows=67 loops=1)

8. 0.089 158,903.853 ↓ 67.0 67 1

Sort (cost=350.74..350.74 rows=1 width=553) (actual time=158,903.850..158,903.853 rows=67 loops=1)

  • Sort Key: cne.id, ce.id, ca.leasing_agent_id, cne.priority, cne.overdue_business_days, cne.overdue_buisness_time, cne.primary_customer_id, cne.name_first, cne.name_last, (COALESCE((((ce.name_first)::text || ' '::text) || (ce.name_last)::text), (ce.name_first)::text, (ce.name_last)::text)), cne.primary_phone_number, cne.ps_product_id, cne.associated_event_id, cne.property_name, cne.data_reference_id, cne.lease_id, cne.created_on, cne.scheduled_datetime, (COALESCE(est.name, et.name)), cne.property_id, cne.notes, cne.event_sub_type_id, ei.event_type_id, ((date_part('day'::text, (now() - ((ei.scheduled_datetime)::timestamp without time zone)::timestamp with time zone)))::integer), ((date_part('day'::text, (now() - ((ei_2.scheduled_datetime)::timestamp without time zone)::timestamp with time zone)))::integer), ((ei.scheduled_datetime)::timestamp without time zone), ei_2.event_type_id, ei_1.notes, cne.time_zone_name, (concat_ws(' - '::text, lst.name, lit.name))
  • Sort Method: quicksort Memory: 43kB
9. 0.174 158,903.764 ↓ 67.0 67 1

Nested Loop Left Join (cost=332.85..350.73 rows=1 width=553) (actual time=158,895.116..158,903.764 rows=67 loops=1)

10. 0.046 158,899.637 ↓ 67.0 67 1

Nested Loop Left Join (cost=316.04..333.81 rows=1 width=368) (actual time=158,895.033..158,899.637 rows=67 loops=1)

11. 0.042 158,898.921 ↓ 67.0 67 1

Nested Loop Left Join (cost=308.57..326.28 rows=1 width=312) (actual time=158,894.992..158,898.921 rows=67 loops=1)

12. 0.071 158,896.668 ↓ 67.0 67 1

Nested Loop Left Join (cost=287.38..305.02 rows=1 width=300) (actual time=158,894.894..158,896.668 rows=67 loops=1)

13. 0.193 158,896.597 ↓ 67.0 67 1

Nested Loop Left Join (cost=287.09..304.62 rows=1 width=287) (actual time=158,894.878..158,896.597 rows=67 loops=1)

  • Filter: (CURRENT_DATE >= COALESCE(ca.mute_followups_until, CURRENT_DATE))
14. 0.073 158,895.935 ↓ 67.0 67 1

Nested Loop Left Join (cost=286.67..300.11 rows=1 width=283) (actual time=158,894.833..158,895.935 rows=67 loops=1)

15. 0.064 158,895.795 ↓ 67.0 67 1

Nested Loop Left Join (cost=286.53..299.93 rows=1 width=280) (actual time=158,894.821..158,895.795 rows=67 loops=1)

16. 0.028 158,895.128 ↓ 67.0 67 1

Nested Loop Left Join (cost=286.11..295.46 rows=1 width=280) (actual time=158,894.772..158,895.128 rows=67 loops=1)

17. 0.059 158,894.966 ↓ 67.0 67 1

Nested Loop (cost=285.96..291.23 rows=1 width=256) (actual time=158,894.744..158,894.966 rows=67 loops=1)

18. 0.082 158,894.773 ↓ 67.0 67 1

Hash Right Join (cost=285.69..286.89 rows=1 width=239) (actual time=158,894.721..158,894.773 rows=67 loops=1)

  • Hash Cond: (lit.id = cne.lease_interval_type_id)
19. 0.008 0.008 ↑ 1.0 5 1

Seq Scan on lease_interval_types lit (cost=0.00..1.15 rows=5 width=16) (actual time=0.007..0.008 rows=5 loops=1)

20. 0.029 158,894.683 ↓ 67.0 67 1

Hash (cost=285.66..285.66 rows=1 width=231) (actual time=158,894.683..158,894.683 rows=67 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 21kB
21. 0.029 158,894.654 ↓ 67.0 67 1

Subquery Scan on cne (cost=285.50..285.66 rows=1 width=231) (actual time=158,894.582..158,894.654 rows=67 loops=1)

22. 0.041 158,894.625 ↓ 67.0 67 1

Unique (cost=285.50..285.63 rows=1 width=1,071) (actual time=158,894.579..158,894.625 rows=67 loops=1)

23. 0.365 158,894.584 ↓ 67.0 67 1

Sort (cost=285.50..285.50 rows=1 width=1,071) (actual time=158,894.577..158,894.584 rows=67 loops=1)

  • Sort Key: e.id, e.property_id, e.property_unit_id, e.unit_space_id, e.event_type_id, e.event_sub_type_id, e.event_result_id, e.default_event_result_id, e.associated_event_id, e.ps_product_id, e.old_stage_id, e.new_stage_id, e.old_status_id, e.new_status_id, e.company_employee_id, e.data_reference_id, e.integration_result_id, e.lease_id, e.lease_interval_id, e.customer_id, e.scheduled_task_id, e.remote_primary_key, e.calendar_event_key, e.scheduled_datetime, e.scheduled_end_datetime, e.event_datetime, e.event_handle, e.title, e.notes, e.details, e.ip_address, e.do_not_export, e.is_resident, e.is_deleted, e.updated_by, e.updated_on, e.created_by, e.created_on, (CASE WHEN (e.details ? 'overdue_on'::text) THEN CASE WHEN ((now())::timestamp without time zone > (btrim(((e.details)::json ->> 'overdue_on'::text)))::timestamp without time zone) THEN 3 WHEN (COALESCE((CURRENT_DATE - (((e.details)::json ->> 'overdue_on'::text))::date), 0) = 0) THEN 2 ELSE 1 END ELSE CASE WHEN ((now())::timestamp without time zone > (e.scheduled_datetime)::timestamp without time zone) THEN 3 WHEN (COALESCE((CURRENT_DATE - (e.scheduled_datetime)::date), 0) = 0) THEN 2 ELSE 1 END END), (CASE WHEN (e.details ? 'overdue_on'::text) THEN abs(COALESCE((CURRENT_DATE - (((e.details)::json ->> 'overdue_on'::text))::date), 0)) ELSE abs(COALESCE((CURRENT_DATE - (e.scheduled_datetime)::date), 0)) END), (CASE WHEN (e.details ? 'overdue_on'::text) THEN to_char((((((e.details)::json ->> 'overdue_on'::text))::timestamp without time zone)::time without time zone)::interval, 'HH12:MIam'::text) ELSE to_char(((e.scheduled_datetime)::time without time zone)::interval, 'HH12:MIam'::text) END), ((((e.details -> 'auto_creation'::text) ->> 'triggering_event_id'::text))::integer), (COALESCE((date_part('day'::text, (btrim(((e.details)::json ->> 'overdue_on'::text)))::timestamp without time zone) - date_part('day'::text, (now())::timestamp without time zone)), '0'::double precision)), cl.name_first, cl.name_last, cl.property_name, cl.primary_phone_number, cl.lease_interval_type_id, cl.primary_customer_id, lp.time_zone_name
  • Sort Method: quicksort Memory: 59kB
24. 2.827 158,894.219 ↓ 67.0 67 1

Nested Loop Anti Join (cost=19.84..285.49 rows=1 width=1,071) (actual time=8,052.307..158,894.219 rows=67 loops=1)

25. 56.454 158,891.325 ↓ 67.0 67 1

Nested Loop (cost=19.57..284.75 rows=1 width=1,015) (actual time=8,052.165..158,891.325 rows=67 loops=1)

  • Join Filter: (lp.property_id = e.property_id)
26. 12.722 100.106 ↓ 1,574.1 12,593 1

Nested Loop (cost=0.42..114.53 rows=8 width=95) (actual time=0.046..100.106 rows=12,593 loops=1)

27. 0.084 0.084 ↑ 1.0 25 1

Seq Scan on temp_properties lp (cost=0.00..1.81 rows=25 width=23) (actual time=0.008..0.084 rows=25 loops=1)

  • Filter: (cid = 13576)
28. 87.300 87.300 ↓ 504.0 504 25

Index Scan using idx_cached_leases_cid_property_id on cached_leases cl (cost=0.42..4.48 rows=1 width=72) (actual time=0.023..3.492 rows=504 loops=25)

  • Index Cond: ((cid = 13576) AND (property_id = lp.property_id))
  • Filter: (((lease_status_type_id = ANY ('{3,4,5}'::integer[])) OR (lease_status_type_id = 1)) AND (occupancy_type_id = ANY ('{1,2,3,4,6,9,10,11}'::integer[])))
  • Rows Removed by Filter: 280
29. 2,392.670 158,734.765 ↓ 0.0 0 12,593

Bitmap Heap Scan on events e (cost=19.14..21.25 rows=1 width=940) (actual time=12.604..12.605 rows=0 loops=12,593)

  • Recheck Cond: ((cid = 13576) AND (lease_id = cl.id) AND (lease_id IS NOT NULL) AND (property_id = cl.property_id))
  • Filter: ((NOT is_deleted) AND (event_result_id IS NULL) AND (((event_type_id = 316) AND (event_sub_type_id IS NULL)) OR (event_sub_type_id <> ALL ('{20,85}'::integer[]))) AND (CURRENT_DATE >= (scheduled_datetime)::date) AND ((cl.lease_status_type_id = ANY ('{3,4,5}'::integer[])) OR (((cl.lease_interval_type_id = 5) OR (event_type_id = 316)) AND (cl.lease_status_type_id = 1))) AND ((event_sub_type_id = ANY ('{2,17,18,19,5,7,20,21,85,1,130}'::integer[])) OR ((event_type_id = 1) AND (ps_product_id = 28) AND is_resident) OR ((ps_product_id = 28) AND (event_sub_type_id = ANY ('{23,9,10,11,111,112,113,114,115,70,136,135,68,69}'::integer[]))) OR ((event_type_id = 316) AND (event_sub_type_id IS NULL))))
  • Rows Removed by Filter: 66
  • Heap Blocks: exact=598695
30. 88.151 156,342.095 ↓ 0.0 0 12,593

BitmapAnd (cost=19.14..19.14 rows=1 width=0) (actual time=12.415..12.415 rows=0 loops=12,593)

31. 264.453 264.453 ↓ 4.7 66 12,593

Bitmap Index Scan on idx_events_lease_id (cost=0.00..2.53 rows=14 width=0) (actual time=0.021..0.021 rows=66 loops=12,593)

  • Index Cond: ((cid = 13576) AND (lease_id = cl.id) AND (lease_id IS NOT NULL))
32. 155,989.491 155,989.491 ↓ 124.5 153,773 12,593

Bitmap Index Scan on idx_events_property_id (cost=0.00..16.36 rows=1,235 width=0) (actual time=12.387..12.387 rows=153,773 loops=12,593)

  • Index Cond: (property_id = cl.property_id)
33. 0.067 0.067 ↓ 0.0 0 67

Index Scan using idx_event_results on event_results er (cost=0.28..0.54 rows=1 width=8) (actual time=0.001..0.001 rows=0 loops=67)

  • Index Cond: (id = e.event_result_id)
  • Filter: (is_system AND (cid = 13576) AND (cid = e.cid) AND ((2 = ANY (default_event_result_ids)) OR (4 = ANY (default_event_result_ids)) OR (65 = ANY (default_event_result_ids))))
34. 0.134 0.134 ↑ 1.0 1 67

Index Scan using pk_event_types on event_types et (cost=0.27..4.31 rows=1 width=25) (actual time=0.002..0.002 rows=1 loops=67)

  • Index Cond: (id = cne.event_type_id)
35. 0.134 0.134 ↑ 1.0 1 67

Index Scan using pk_event_sub_types on event_sub_types est (cost=0.14..4.18 rows=1 width=28) (actual time=0.002..0.002 rows=1 loops=67)

  • Index Cond: (id = cne.event_sub_type_id)
36. 0.603 0.603 ↑ 1.0 1 67

Index Only Scan using idx_lease_customers_cid_lease_id_customer_id_lease_status_type_ on lease_customers lcs (cost=0.42..4.47 rows=1 width=16) (actual time=0.009..0.009 rows=1 loops=67)

  • Index Cond: ((cid = cne.cid) AND (cid = 13576) AND (lease_id = cne.lease_id) AND (customer_id = cne.customer_id))
  • Heap Fetches: 48
37. 0.067 0.067 ↑ 1.0 1 67

Index Scan using pk_lease_status_types on lease_status_types lst (cost=0.13..0.17 rows=1 width=11) (actual time=0.001..0.001 rows=1 loops=67)

  • Index Cond: (lcs.lease_status_type_id = id)
38. 0.469 0.469 ↑ 1.0 1 67

Index Scan using idx_cached_applications_lease_interval_id on cached_applications ca (cost=0.42..4.47 rows=1 width=24) (actual time=0.007..0.007 rows=1 loops=67)

  • Index Cond: (lease_interval_id = cne.lease_interval_id)
  • Filter: ((cid = 13576) AND (cne.cid = cid) AND (cne.cached_lease_id = lease_id) AND (property_id = cne.property_id))
39. 0.000 0.000 ↓ 0.0 0 67

Index Scan using idx_company_employees_id on company_employees ce (cost=0.29..0.37 rows=1 width=21) (actual time=0.000..0.000 rows=0 loops=67)

  • Index Cond: (id = ca.leasing_agent_id)
  • Filter: ((cid = 13576) AND (cid = ca.cid))
40. 0.067 2.211 ↓ 0.0 0 67

Limit (cost=21.19..21.20 rows=1 width=16) (actual time=0.033..0.033 rows=0 loops=67)

41. 0.134 2.144 ↓ 0.0 0 67

Sort (cost=21.19..21.20 rows=1 width=16) (actual time=0.032..0.032 rows=0 loops=67)

  • Sort Key: ei.scheduled_datetime DESC, ei.id DESC
  • Sort Method: quicksort Memory: 25kB
42. 0.046 2.010 ↓ 0.0 0 67

Nested Loop Left Join (cost=1.83..21.18 rows=1 width=16) (actual time=0.029..0.030 rows=0 loops=67)

  • Filter: CASE WHEN (pp2.id IS NOT NULL) THEN (COALESCE(ei.ps_product_id, 0) <> 28) ELSE true END
43. 0.000 1.943 ↓ 0.0 0 67

Nested Loop Left Join (cost=1.27..16.54 rows=1 width=28) (actual time=0.028..0.029 rows=0 loops=67)

  • Filter: CASE WHEN (pp1.id IS NOT NULL) THEN (COALESCE(ei.ps_product_id, 0) <> 46) ELSE true END
44. 0.122 1.943 ↓ 0.0 0 67

Nested Loop Left Join (cost=0.71..11.90 rows=1 width=28) (actual time=0.028..0.029 rows=0 loops=67)

  • Filter: CASE WHEN ((ei.event_type_id = 15) AND (ei.event_sub_type_id = 2)) THEN ((1 = ANY (er_1.default_event_result_ids)) OR (2 = ANY (er_1.default_event_result_ids)) OR (3 = ANY (er_1.default_event_result_ids))) WHEN (ei.event_type_id = ANY ('{1,17,173}'::integer[])) THEN true WHEN ((ei.event_type_id = 3) AND (ei.event_sub_type_id <> 22)) THEN true WHEN (ei.event_type_id = 4) THEN (2 = ANY (er_1.default_event_result_ids)) ELSE NULL::boolean END
  • Rows Removed by Filter: 1
45. 1.742 1.742 ↑ 1.0 1 67

Index Scan using idx_events_cid_lease_interval_id_event_datetime on events ei (cost=0.43..7.48 rows=1 width=36) (actual time=0.022..0.026 rows=1 loops=67)

  • Index Cond: ((cid = cne.cid) AND (lease_interval_id = cne.lease_interval_id))
  • Filter: ((NOT is_deleted) AND (event_type_id = ANY ('{1,3,4,5,6,15,17,173}'::integer[])))
  • Rows Removed by Filter: 9
46. 0.079 0.079 ↑ 1.0 1 79

Index Scan using idx_event_results on event_results er_1 (cost=0.28..4.32 rows=1 width=33) (actual time=0.001..0.001 rows=1 loops=79)

  • Index Cond: (id = ei.event_result_id)
  • Filter: ((cid = cne.cid) AND (cid = ei.cid))
47. 0.018 0.018 ↓ 0.0 0 3

Index Scan using uk_property_preferences_cid_property_id_key on property_preferences pp1 (cost=0.56..4.61 rows=1 width=12) (actual time=0.005..0.006 rows=0 loops=3)

  • Index Cond: ((ei.cid = cid) AND (cid = cne.cid) AND (ei.property_id = property_id) AND ((key)::text = 'DO_NOT_CONSIDER_LEASING_CENTER_COMMUNICATION_AS_FOLLOW_UPS'::text))
  • Filter: ((value)::integer = 1)
48. 0.021 0.021 ↓ 0.0 0 3

Index Scan using uk_property_preferences_cid_property_id_key on property_preferences pp2 (cost=0.56..4.61 rows=1 width=12) (actual time=0.007..0.007 rows=0 loops=3)

  • Index Cond: ((ei.cid = cid) AND (cid = cne.cid) AND (ei.property_id = property_id) AND ((key)::text = 'DO_NOT_CONSIDER_MESSAGE_CENTER_CORRESPONDENCE_AS_FOLLOW_UPS'::text))
  • Filter: ((value)::integer = 1)
49. 0.000 0.670 ↓ 0.0 0 67

Limit (cost=7.47..7.47 rows=1 width=60) (actual time=0.010..0.010 rows=0 loops=67)

50. 0.134 0.670 ↓ 0.0 0 67

Sort (cost=7.47..7.47 rows=1 width=60) (actual time=0.010..0.010 rows=0 loops=67)

  • Sort Key: ei_1.id DESC
  • Sort Method: quicksort Memory: 25kB
51. 0.000 0.536 ↓ 0.0 0 67

Result (cost=0.43..7.46 rows=1 width=60) (actual time=0.008..0.008 rows=0 loops=67)

  • One-Time Filter: (cne.cid = 13576)
52. 0.536 0.536 ↓ 0.0 0 67

Index Scan using idx_events_partial_dashboard_leads_applicants on events ei_1 (cost=0.43..7.46 rows=1 width=60) (actual time=0.008..0.008 rows=0 loops=67)

  • Index Cond: ((cid = 13576) AND (lease_interval_id = cne.lease_interval_id))
  • Filter: (event_type_id = 8)
  • Rows Removed by Filter: 1
53. 0.067 3.953 ↑ 1.0 1 67

Limit (cost=16.81..16.82 rows=1 width=16) (actual time=0.058..0.059 rows=1 loops=67)

54. 0.201 3.886 ↑ 1.0 1 67

Sort (cost=16.81..16.82 rows=1 width=16) (actual time=0.058..0.058 rows=1 loops=67)

  • Sort Key: ei_2.scheduled_datetime DESC, ei_2.id DESC
  • Sort Method: quicksort Memory: 25kB
55. 0.340 3.685 ↓ 6.0 6 67

Nested Loop Left Join (cost=1.55..16.80 rows=1 width=16) (actual time=0.010..0.055 rows=6 loops=67)

  • Filter: CASE WHEN (pp2_1.id IS NOT NULL) THEN (COALESCE(ei_2.ps_product_id, 0) <> 28) ELSE true END
56. 0.029 2.211 ↓ 6.0 6 67

Nested Loop Left Join (cost=0.99..12.16 rows=1 width=28) (actual time=0.007..0.033 rows=6 loops=67)

  • Filter: CASE WHEN (pp1_1.id IS NOT NULL) THEN (COALESCE(ei_2.ps_product_id, 0) <> 46) ELSE true END
57. 0.670 0.670 ↓ 6.0 6 67

Index Scan using idx_events_cid_lease_interval_id_event_datetime on events ei_2 (cost=0.43..7.52 rows=1 width=32) (actual time=0.003..0.010 rows=6 loops=67)

  • Index Cond: ((cid = cne.cid) AND (lease_interval_id = cne.lease_interval_id))
  • Filter: ((NOT is_deleted) AND (event_type_id = ANY ('{78,17,9,15,10,238,18,5,1,33,6,7,4,2,3,16,173,25}'::integer[])))
  • Rows Removed by Filter: 5
58. 1.512 1.512 ↓ 0.0 0 378

Index Scan using uk_property_preferences_cid_property_id_key on property_preferences pp1_1 (cost=0.56..4.61 rows=1 width=12) (actual time=0.004..0.004 rows=0 loops=378)

  • Index Cond: ((ei_2.cid = cid) AND (cid = cne.cid) AND (ei_2.property_id = property_id) AND ((key)::text = 'DO_NOT_CONSIDER_LEASING_CENTER_COMMUNICATION_AS_FOLLOW_UPS'::text))
  • Filter: ((value)::integer = 1)
59. 1.134 1.134 ↓ 0.0 0 378

Index Scan using uk_property_preferences_cid_property_id_key on property_preferences pp2_1 (cost=0.56..4.61 rows=1 width=12) (actual time=0.003..0.003 rows=0 loops=378)

  • Index Cond: ((ei_2.cid = cid) AND (cid = cne.cid) AND (ei_2.property_id = property_id) AND ((key)::text = 'DO_NOT_CONSIDER_MESSAGE_CENTER_CORRESPONDENCE_AS_FOLLOW_UPS'::text))
  • Filter: ((value)::integer = 1)
60. 0.208 234.199 ↓ 1,119.0 1,119 1

Subquery Scan on *SELECT* 2 (cost=1,918.57..1,918.64 rows=1 width=613) (actual time=232.983..234.199 rows=1,119 loops=1)

61. 0.455 233.991 ↓ 1,119.0 1,119 1

Subquery Scan on cs1 (cost=1,918.57..1,918.61 rows=1 width=1,057) (actual time=232.980..233.991 rows=1,119 loops=1)

  • Filter: ((cs1.lease_id = cs1.lease_customer_lease_id) AND (cs1.cid = 13576))
  • Rows Removed by Filter: 2
62. 0.359 233.536 ↓ 1,121.0 1,121 1

Unique (cost=1,918.57..1,918.58 rows=1 width=1,061) (actual time=232.975..233.536 rows=1,121 loops=1)

63. 2.287 233.177 ↓ 3,423.0 3,423 1

Sort (cost=1,918.57..1,918.57 rows=1 width=1,061) (actual time=232.974..233.177 rows=3,423 loops=1)

  • Sort Key: cs.id
  • Sort Method: quicksort Memory: 2097kB
64. 9.942 230.890 ↓ 3,423.0 3,423 1

WindowAgg (cost=1,918.36..1,918.56 rows=1 width=1,061) (actual time=220.793..230.890 rows=3,423 loops=1)

65. 4.022 220.948 ↓ 3,423.0 3,423 1

Sort (cost=1,918.36..1,918.37 rows=1 width=513) (actual time=220.720..220.948 rows=3,423 loops=1)

  • Sort Key: cs.customer_id, lc.id DESC
  • Sort Method: quicksort Memory: 2054kB
66. 3.942 216.926 ↓ 3,423.0 3,423 1

Nested Loop Left Join (cost=3.97..1,918.35 rows=1 width=513) (actual time=0.528..216.926 rows=3,423 loops=1)

67. 1.432 199.292 ↓ 3,423.0 3,423 1

Nested Loop Left Join (cost=3.55..1,913.97 rows=1 width=489) (actual time=0.475..199.292 rows=3,423 loops=1)

68. 2.626 194.437 ↓ 3,423.0 3,423 1

Nested Loop Left Join (cost=3.25..1,913.57 rows=1 width=476) (actual time=0.450..194.437 rows=3,423 loops=1)

69. 2.621 176.919 ↓ 1,241.0 1,241 1

Nested Loop Left Join (cost=2.83..1,909.79 rows=1 width=480) (actual time=0.418..176.919 rows=1,241 loops=1)

  • Filter: CASE WHEN ((cl_1.lease_status_type_id = 6) AND ((COALESCE(lps.move_out_date, li.lease_end_date) + COALESCE((pp.value)::integer, 60)) > CURRENT_DATE)) THEN ((cl_1.id IS NULL) OR (cl_1.lease_status_type_id = ANY ('{3,5,6,4}'::integer[]))) ELSE ((cl_1.id IS NULL) OR (cl_1.lease_status_type_id = ANY ('{3,4,5}'::integer[]))) END
  • Rows Removed by Filter: 733
70. 4.035 164.428 ↓ 1,974.0 1,974 1

Nested Loop Left Join (cost=2.27..1,905.14 rows=1 width=492) (actual time=0.387..164.428 rows=1,974 loops=1)

  • Join Filter: (lit_1.id = cl_1.lease_interval_type_id)
  • Rows Removed by Join Filter: 1501
71. 3.454 160.393 ↓ 1,974.0 1,974 1

Nested Loop Left Join (cost=2.27..1,903.83 rows=1 width=484) (actual time=0.378..160.393 rows=1,974 loops=1)

  • Join Filter: (lc.lease_status_type_id = lst_1.id)
  • Rows Removed by Join Filter: 5962
72. 1.650 154.965 ↓ 1,974.0 1,974 1

Nested Loop Left Join (cost=2.27..1,902.45 rows=1 width=481) (actual time=0.371..154.965 rows=1,974 loops=1)

  • Join Filter: (cs.cid = lps.cid)
73. 1.289 142.353 ↓ 1,827.0 1,827 1

Nested Loop Left Join (cost=1.85..1,900.92 rows=1 width=477) (actual time=0.341..142.353 rows=1,827 loops=1)

  • Join Filter: (li.cid = cs.cid)
74. 1.205 128.275 ↓ 1,827.0 1,827 1

Nested Loop Left Join (cost=1.42..1,899.21 rows=1 width=477) (actual time=0.306..128.275 rows=1,827 loops=1)

75. 1.891 117.935 ↓ 1,827.0 1,827 1

Nested Loop Left Join (cost=1.00..1,897.84 rows=1 width=457) (actual time=0.269..117.935 rows=1,827 loops=1)

76. 0.947 116.044 ↓ 1,827.0 1,827 1

Nested Loop Left Join (cost=0.85..1,897.59 rows=1 width=447) (actual time=0.264..116.044 rows=1,827 loops=1)

77. 0.701 111.443 ↓ 1,827.0 1,827 1

Nested Loop (cost=0.71..1,897.26 rows=1 width=415) (actual time=0.241..111.443 rows=1,827 loops=1)

78. 0.762 93.062 ↓ 884.0 1,768 1

Nested Loop (cost=0.29..1,884.97 rows=2 width=399) (actual time=0.222..93.062 rows=1,768 loops=1)

79. 0.025 0.025 ↑ 1.0 25 1

Seq Scan on temp_properties lp_1 (cost=0.00..1.81 rows=25 width=42) (actual time=0.007..0.025 rows=25 loops=1)

  • Filter: (cid = 13576)
80. 18.451 92.275 ↓ 71.0 71 25

Index Scan using idx_contact_submissions_property_id on contact_submissions cs (cost=0.29..75.30 rows=1 width=365) (actual time=0.085..3.691 rows=71 loops=25)

  • Index Cond: (property_id = lp_1.property_id)
  • Filter: ((deleted_on IS NULL) AND (deleted_by IS NULL) AND (customer_message_id IS NULL) AND (cid = 13576) AND (NOT (SubPlan 1)))
  • Rows Removed by Filter: 199
81.          

SubPlan (forIndex Scan)

82. 2.307 73.824 ↓ 0.0 0 2,307

Unique (cost=7.19..7.20 rows=1 width=4) (actual time=0.032..0.032 rows=0 loops=2,307)

83. 2.307 71.517 ↓ 0.0 0 2,307

Sort (cost=7.19..7.19 rows=1 width=4) (actual time=0.031..0.031 rows=0 loops=2,307)

  • Sort Key: e_1.data_reference_id
  • Sort Method: quicksort Memory: 25kB
84. 2.307 69.210 ↑ 1.0 1 2,307

Result (cost=0.56..7.18 rows=1 width=4) (actual time=0.019..0.030 rows=1 loops=2,307)

  • One-Time Filter: (cs.cid = 13576)
85. 66.903 66.903 ↑ 1.0 1 2,307

Index Scan using idx_events_cid_etid_pid_event_datetime on events e_1 (cost=0.56..7.18 rows=1 width=4) (actual time=0.018..0.029 rows=1 loops=2,307)

  • Index Cond: ((cid = 13576) AND (event_type_id = ANY ('{339,340}'::integer[])) AND (property_id = cs.property_id))
  • Filter: ((data_reference_id IS NOT NULL) AND (customer_id = cs.customer_id))
  • Rows Removed by Filter: 39
86. 17.680 17.680 ↑ 1.0 1 1,768

Index Scan using idx_lease_customers_customer_id on lease_customers lc (cost=0.42..6.12 rows=1 width=20) (actual time=0.009..0.010 rows=1 loops=1,768)

  • Index Cond: (customer_id = cs.customer_id)
  • Filter: (cid = 13576)
  • Rows Removed by Filter: 0
87. 3.654 3.654 ↑ 1.0 1 1,827

Index Scan using idx_dashboard_priorities_cid on dashboard_priorities dp (cost=0.14..0.30 rows=1 width=36) (actual time=0.001..0.002 rows=1 loops=1,827)

  • Index Cond: ((cid = cs.cid) AND (cid = 13576))
88. 0.000 0.000 ↓ 0.0 0 1,827

Index Scan using idx_contact_submission_types_id on contact_submission_types cst (cost=0.14..0.21 rows=1 width=18) (actual time=0.000..0.000 rows=0 loops=1,827)

  • Index Cond: (id = cs.contact_submission_type_id)
  • Filter: ((deleted_on IS NULL) AND (cid = 13576) AND (is_published = 1) AND (cid = cs.cid))
89. 9.135 9.135 ↑ 1.0 1 1,827

Index Scan using pk_cached_leases on cached_leases cl_1 (cost=0.42..1.37 rows=1 width=24) (actual time=0.005..0.005 rows=1 loops=1,827)

  • Index Cond: ((cid = lc.cid) AND (cid = 13576) AND (id = lc.lease_id))
90. 12.789 12.789 ↑ 1.0 1 1,827

Index Scan using idx_lease_intervals on lease_intervals li (cost=0.42..1.68 rows=1 width=12) (actual time=0.007..0.007 rows=1 loops=1,827)

  • Index Cond: (id = cl_1.active_lease_interval_id)
  • Filter: ((lease_status_type_id <> 2) AND (cid = 13576))
  • Rows Removed by Filter: 0
91. 10.962 10.962 ↑ 1.0 1 1,827

Index Scan using idx_lease_processes_cid_lease_id_customer_id on lease_processes lps (cost=0.42..1.50 rows=1 width=12) (actual time=0.006..0.006 rows=1 loops=1,827)

  • Index Cond: ((cid = 13576) AND (cl_1.id = lease_id))
92. 1.974 1.974 ↑ 1.5 4 1,974

Seq Scan on lease_status_types lst_1 (cost=0.00..1.18 rows=6 width=11) (actual time=0.001..0.001 rows=4 loops=1,974)

93. 0.000 0.000 ↑ 2.5 2 1,974

Seq Scan on lease_interval_types lit_1 (cost=0.00..1.15 rows=5 width=16) (actual time=0.000..0.000 rows=2 loops=1,974)

94. 9.870 9.870 ↑ 1.0 1 1,974

Index Scan using uk_property_preferences_cid_property_id_key on property_preferences pp (cost=0.56..4.59 rows=1 width=18) (actual time=0.005..0.005 rows=1 loops=1,974)

  • Index Cond: ((cs.cid = cid) AND (cid = 13576) AND (cs.property_id = property_id) AND ((key)::text = 'PAST_RESIDENT_LOGIN_TOLERANCE_DAYS'::text))
95. 14.892 14.892 ↓ 3.0 3 1,241

Index Scan using idx_cached_applications_lease_id on cached_applications ca_1 (cost=0.42..3.75 rows=1 width=16) (actual time=0.006..0.012 rows=3 loops=1,241)

  • Index Cond: (cl_1.id = lease_id)
  • Filter: ((cid = 13576) AND (cl_1.cid = cid) AND (property_id = cl_1.property_id))
  • Rows Removed by Filter: 0
96. 3.423 3.423 ↓ 0.0 0 3,423

Index Scan using idx_company_employees_id on company_employees ce_1 (cost=0.29..0.37 rows=1 width=21) (actual time=0.001..0.001 rows=0 loops=3,423)

  • Index Cond: (id = ca_1.leasing_agent_id)
  • Filter: ((cid = 13576) AND (cid = ca_1.cid))
97. 13.692 13.692 ↑ 1.0 1 3,423

Index Scan using uk_cid_customer_id on customer_portal_settings cps (cost=0.42..4.38 rows=1 width=32) (actual time=0.004..0.004 rows=1 loops=3,423)

  • Index Cond: ((cid = cs.cid) AND (cid = 13576) AND (customer_id = cs.customer_id))