explain.depesz.com

PostgreSQL's explain analyze made readable

Result: yB6D

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 991.917 ↓ 0.0 0 1

Unique (cost=3,344.44..3,344.45 rows=1 width=114) (actual time=991.917..991.917 rows=0 loops=1)

2. 0.012 991.915 ↓ 0.0 0 1

Sort (cost=3,344.44..3,344.45 rows=1 width=114) (actual time=991.915..991.915 rows=0 loops=1)

  • Sort Key: l.id
  • Sort Method: quicksort Memory: 25kB
3. 0.000 991.903 ↓ 0.0 0 1

Nested Loop (cost=1.70..3,344.43 rows=1 width=114) (actual time=991.903..991.903 rows=0 loops=1)

  • Join Filter: (l.id = cll.lease_id)
4. 12.218 726.848 ↓ 14,037.0 14,037 1

Nested Loop (cost=1.14..3,339.66 rows=1 width=118) (actual time=2.179..726.848 rows=14,037 loops=1)

5. 444.027 672.519 ↓ 14,037.0 14,037 1

Nested Loop Left Join (cost=0.71..3,337.27 rows=1 width=114) (actual time=2.163..672.519 rows=14,037 loops=1)

  • Join Filter: ((l.cid = i.cid) AND ((l.id = i.lease_id) OR ((l.property_unit_id = i.property_unit_id) AND (i.lease_id IS NULL) AND ((i.inspection_details ->> 'lease_ids'::text) IS NOT NULL) AND (strpos((i.inspection_details ->> 'lease_ids'::text), (l.id)::text) > 0))))
  • Rows Removed by Join Filter: 4,491,237
  • Filter: (i.id IS NULL)
  • Rows Removed by Filter: 313
6. 27.592 27.592 ↓ 19.3 14,350 1

Index Scan using idx_leases_cid_property_id_primary_customer_id on leases l (cost=0.42..1,323.87 rows=744 width=114) (actual time=0.024..27.592 rows=14,350 loops=1)

  • Index Cond: ((cid = 13,576) AND (property_id = ANY ('{679024,267563,544117,628940,529777,598061,529778,628941,267566,598062,1045265,347830,267573,267574,719751}'::integer[])))
  • Filter: ((property_unit_id IS NOT NULL) AND (occupancy_type_id = ANY ('{1,10}'::integer[])))
  • Rows Removed by Filter: 6,118
7. 198.852 200.900 ↓ 28.5 313 14,350

Materialize (cost=0.29..1,563.31 rows=11 width=466) (actual time=0.000..0.014 rows=313 loops=14,350)

8. 2.048 2.048 ↓ 28.5 313 1

Index Scan using pk_inspections on inspections i (cost=0.29..1,563.25 rows=11 width=466) (actual time=0.326..2.048 rows=313 loops=1)

  • Index Cond: (cid = 13,576)
  • Filter: ((deleted_on IS NULL) AND (scheduled_task_id = 7,814,774))
  • Rows Removed by Filter: 2,667
9. 42.111 42.111 ↑ 1.0 1 14,037

Index Scan using idx_lease_processes_cid_lease_id_customer_id on lease_processes lp (cost=0.42..2.36 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=14,037)

  • Index Cond: ((cid = 13,576) AND (lease_id = l.id))
  • Filter: (customer_id IS NULL)
  • Rows Removed by Filter: 0
10. 266.703 266.703 ↓ 0.0 0 14,037

Index Scan using idx_cached_lease_logs_cid_lease_id_reporting_post_month_apply_t on cached_lease_logs cll (cost=0.56..4.74 rows=1 width=8) (actual time=0.019..0.019 rows=0 loops=14,037)

  • Index Cond: ((cid = 13,576) AND (lease_id = lp.lease_id))
  • Filter: ((old_lease_status_type_id = 5) AND (lease_status_type_id = 6) AND (date(log_datetime) = '07/29/2020'::date))
  • Rows Removed by Filter: 14
Planning time : 3.277 ms
Execution time : 992.024 ms