explain.depesz.com

PostgreSQL's explain analyze made readable

Result: qPZC

Settings
# exclusive inclusive rows x rows loops node
1. 5.916 373,613.961 ↓ 2.0 24 1

GroupAggregate (cost=107,811.46..107,812.84 rows=12 width=142) (actual time=373,605.377..373,613.961 rows=24 loops=1)

  • Group Key: mgp.property_name, mgp.row_number, mgp.cid, mgp.property_id, mgp.start_date, mgp.end_date
2. 24.180 373,608.045 ↓ 328.5 7,884 1

Sort (cost=107,811.46..107,811.52 rows=24 width=126) (actual time=373,605.091..373,608.045 rows=7,884 loops=1)

  • Sort Key: mgp.property_name, mgp.row_number DESC, mgp.property_id, mgp.start_date, mgp.end_date
  • Sort Method: quicksort Memory: 1301kB
3. 10.840 373,583.865 ↓ 328.5 7,884 1

Nested Loop (cost=4,368.57..107,810.91 rows=24 width=126) (actual time=113.375..373,583.865 rows=7,884 loops=1)

4. 0.041 0.041 ↑ 1.0 24 1

Seq Scan on cte_monthly_generated_periods mgp (cost=0.00..1.30 rows=24 width=46) (actual time=0.008..0.041 rows=24 loops=1)

  • Filter: (cid = 3156)
5. 2,141.832 373,572.984 ↓ 328.0 328 24

Nested Loop Left Join (cost=4,368.57..4,492.05 rows=1 width=100) (actual time=103.510..15,565.541 rows=328 loops=24)

  • Join Filter: (property_unit_details.property_unit_id = pu.id)
  • Rows Removed by Join Filter: 215496
6. 1,709.832 369,144.792 ↓ 328.0 328 24

Nested Loop Left Join (cost=4,368.57..4,471.59 rows=1 width=89) (actual time=103.318..15,381.033 rows=328 loops=24)

  • Join Filter: ((sc.cid = cusl.cid) AND (cll.unit_space_id = cusl.unit_space_id))
  • Rows Removed by Join Filter: 174387
7. 38.652 352,676.112 ↓ 328.0 328 24

Nested Loop (cost=302.47..405.42 rows=1 width=29) (actual time=34.420..14,694.838 rows=328 loops=24)

8. 23.988 135.936 ↓ 328.0 328 24

Nested Loop (cost=254.26..353.17 rows=1 width=24) (actual time=1.162..5.664 rows=328 loops=24)

9. 29.760 56.760 ↓ 65.6 328 24

Bitmap Heap Scan on property_units pu (cost=253.97..311.61 rows=5 width=20) (actual time=1.150..2.365 rows=328 loops=24)

  • Recheck Cond: ((property_id = mgp.property_id) AND (cid = mgp.cid))
  • Filter: (COALESCE(deleted_on, ('2099-12-31'::date)::timestamp with time zone) > mgp.end_date)
  • Rows Removed by Filter: 0
  • Heap Blocks: exact=4824
10. 0.360 27.000 ↓ 0.0 0 24

BitmapAnd (cost=253.97..253.97 rows=15 width=0) (actual time=1.125..1.125 rows=0 loops=24)

11. 0.816 0.816 ↓ 1.2 329 24

Bitmap Index Scan on idx_property_units_property_id (cost=0.00..6.42 rows=267 width=0) (actual time=0.034..0.034 rows=329 loops=24)

  • Index Cond: (property_id = mgp.property_id)
12. 25.824 25.824 ↓ 1.3 16,743 24

Bitmap Index Scan on pk_property_units (cost=0.00..247.29 rows=13,183 width=0) (actual time=1.076..1.076 rows=16,743 loops=24)

  • Index Cond: (cid = mgp.cid)
13. 55.188 55.188 ↑ 1.0 1 7,884

Index Scan using idx_unit_types_id on unit_types ut (cost=0.29..8.31 rows=1 width=16) (actual time=0.007..0.007 rows=1 loops=7,884)

  • Index Cond: (id = pu.unit_type_id)
  • Filter: (cid = mgp.cid)
14. 4,210.056 352,501.524 ↑ 1.0 1 7,884

Bitmap Heap Scan on cached_unit_space_logs cusl (cost=48.21..52.24 rows=1 width=21) (actual time=44.472..44.711 rows=1 loops=7,884)

  • Recheck Cond: ((property_unit_id = pu.id) AND (cid = mgp.cid) AND (property_id = mgp.property_id))
  • Filter: ((mgp.end_date >= reporting_post_date) AND (mgp.end_date <= apply_through_post_date) AND (is_post_date_ignored = 0) AND (COALESCE(deleted_on, ('2099-12-31'::date)::timestamp with time zone) > mgp.end_date))
  • Rows Removed by Filter: 335
  • Heap Blocks: exact=2222100
15. 1,773.900 348,291.468 ↓ 0.0 0 7,884

BitmapAnd (cost=48.21..48.21 rows=1 width=0) (actual time=44.177..44.177 rows=0 loops=7,884)

16. 283.824 283.824 ↓ 1.2 336 7,884

Bitmap Index Scan on idx_cached_unit_space_logs_property_unit_id (cost=0.00..6.62 rows=291 width=0) (actual time=0.036..0.036 rows=336 loops=7,884)

  • Index Cond: (property_unit_id = pu.id)
17. 346,233.744 346,233.744 ↓ 91.9 117,316 7,884

Bitmap Index Scan on idx_cached_unit_space_logs_cid_property_id_reporting_post_month (cost=0.00..41.33 rows=1,277 width=0) (actual time=43.916..43.916 rows=117,316 loops=7,884)

  • Index Cond: ((cid = mgp.cid) AND (property_id = mgp.property_id))
18. 9,870.768 14,758.848 ↓ 532.0 532 7,884

GroupAggregate (cost=4,066.10..4,066.15 rows=1 width=130) (actual time=0.217..1.872 rows=532 loops=7,884)

  • Group Key: sc.cid, sc.property_id, cll.unit_space_id, (mgp.row_number), (mgp.start_date), (mgp.end_date), pp.value, pcd.value
19. 3,283.032 4,888.080 ↓ 1,036.0 1,036 7,884

Sort (cost=4,066.10..4,066.11 rows=1 width=66) (actual time=0.208..0.620 rows=1,036 loops=7,884)

  • Sort Key: sc.property_id, cll.unit_space_id, pp.value, pcd.value
  • Sort Method: quicksort Memory: 272kB
20. 21.552 1,605.048 ↓ 1,036.0 1,036 24

Result (cost=1.85..4,066.09 rows=1 width=66) (actual time=0.146..66.877 rows=1,036 loops=24)

  • One-Time Filter: (mgp.cid = 3156)
21. 30.680 1,583.496 ↓ 1,036.0 1,036 24

Nested Loop Left Join (cost=1.85..4,066.09 rows=1 width=66) (actual time=0.144..65.979 rows=1,036 loops=24)

22. 63.164 1,453.344 ↓ 1,036.0 1,036 24

Nested Loop Left Join (cost=1.42..4,057.63 rows=1 width=29) (actual time=0.125..60.556 rows=1,036 loops=24)

  • Join Filter: ((pcd.cid = load_prop.cid) AND (pcd.property_id = load_prop.property_id))
  • Rows Removed by Join Filter: 1036
23. 58.368 1,365.312 ↓ 1,036.0 1,036 24

Nested Loop (cost=1.42..4,056.61 rows=1 width=24) (actual time=0.116..56.888 rows=1,036 loops=24)

24. 36.456 923.544 ↓ 1,065.0 1,065 24

Nested Loop (cost=0.86..4,048.66 rows=1 width=44) (actual time=0.078..38.481 rows=1,065 loops=24)

  • Join Filter: (load_prop.property_id = sc.property_id)
25. 22.824 269.328 ↓ 7.9 1,170 24

Nested Loop (cost=0.43..2,358.02 rows=148 width=20) (actual time=0.026..11.222 rows=1,170 loops=24)

26. 0.120 0.120 ↑ 1.0 2 24

Seq Scan on load_prop (cost=0.00..1.02 rows=2 width=8) (actual time=0.003..0.005 rows=2 loops=24)

27. 246.384 246.384 ↓ 7.9 585 48

Index Scan using idx_lease_intervals_cid_propid_leaseid on lease_intervals li (cost=0.43..1,177.76 rows=74 width=12) (actual time=0.020..5.133 rows=585 loops=48)

  • Index Cond: ((cid = 3156) AND (property_id = load_prop.property_id))
  • Filter: (lease_status_type_id <> ALL ('{1,2}'::integer[]))
  • Rows Removed by Filter: 4322
28. 617.760 617.760 ↑ 1.0 1 28,080

Index Scan using idx_scheduled_charges_lease_interval_id on scheduled_charges sc (cost=0.43..11.41 rows=1 width=40) (actual time=0.019..0.022 rows=1 loops=28,080)

  • Index Cond: (lease_interval_id = li.id)
  • Filter: ((NOT is_unselected_quote) AND (cid = 3156) AND (ar_trigger_id = 307) AND (ar_code_type_id = 2) AND (li.property_id = property_id) AND ((last_posted_on = date_trunc('MONTH'::text, (mgp.end_date)::timestamp with time zone)) OR ((charge_start_date <= mgp.end_date) AND (COALESCE(charge_end_date, '2099-12-31'::date) >= mgp.end_date) AND (COALESCE(deleted_on, ('2099-12-31'::date)::timestamp with time zone) > mgp.end_date))))
  • Rows Removed by Filter: 18
29. 383.400 383.400 ↑ 1.0 1 25,560

Index Scan using idx_cached_lease_logs_cid_lease_id_reporting_post_month_apply_t on cached_lease_logs cll (cost=0.56..7.94 rows=1 width=16) (actual time=0.013..0.015 rows=1 loops=25,560)

  • Index Cond: ((cid = 3156) AND (lease_id = sc.lease_id))
  • Filter: ((mgp.end_date >= reporting_post_date) AND (mgp.end_date <= apply_through_post_date) AND (lease_status_type_id = ANY ('{4,5}'::integer[])) AND (occupancy_type_id <> 5) AND (is_post_date_ignored = 0) AND ((sc.last_posted_on = date_trunc('MONTH'::text, (mgp.end_date)::timestamp with time zone)) OR ((sc.charge_start_date <= mgp.end_date) AND (COALESCE(sc.charge_end_date, '2099-12-31'::date) >= mgp.end_date) AND (COALESCE(sc.deleted_on, ('2099-12-31'::date)::timestamp with time zone) > mgp.end_date) AND (COALESCE(move_out_date, '2099-12-31'::date) > mgp.end_date))))
  • Rows Removed by Filter: 12
30. 24.868 24.868 ↑ 1.0 1 24,868

Seq Scan on property_custom_data_key_values pcd (cost=0.00..1.01 rows=1 width=13) (actual time=0.001..0.001 rows=1 loops=24,868)

  • Filter: ((key)::text = 'SCHEDULED_RENT'::text)
31. 99.472 99.472 ↑ 1.0 1 24,868

Index Scan using uk_property_preferences_cid_property_id_key on property_preferences pp (cost=0.42..8.44 rows=1 width=37) (actual time=0.004..0.004 rows=1 loops=24,868)

  • Index Cond: ((cid = load_prop.cid) AND (property_id = load_prop.property_id) AND ((key)::text = 'MIGRATION_THRESHOLD_DATE'::text))
32. 2,286.360 2,286.360 ↑ 1.0 657 7,884

Seq Scan on property_unit_details (cost=0.00..12.21 rows=657 width=12) (actual time=0.006..0.290 rows=657 loops=7,884)

  • Filter: (cid = 3156)
Planning time : 11.733 ms