explain.depesz.com

PostgreSQL's explain analyze made readable

Result: HHE4

Settings
# exclusive inclusive rows x rows loops node
1. 58.518 11,850.538 ↓ 0.0 0 1

Delete on rate_logs rl (cost=57,525.30..58,279.00 rows=7 width=18) (actual time=11,850.538..11,850.538 rows=0 loops=1)

2. 7.856 11,792.020 ↓ 4,699.9 32,899 1

Nested Loop (cost=57,525.30..58,279.00 rows=7 width=18) (actual time=6,308.500..11,792.020 rows=32,899 loops=1)

3. 14.069 11,057.663 ↓ 6,317.4 31,587 1

Nested Loop (cost=57,524.73..58,091.55 rows=5 width=24) (actual time=6,305.740..11,057.663 rows=31,587 loops=1)

4. 228.827 6,526.653 ↓ 7,896.8 31,587 1

Index Scan using idx_rates_cid_property_id_unit_space_id on rates r (cost=57,524.45..57,751.36 rows=4 width=22) (actual time=6,303.973..6,526.653 rows=31,587 loops=1)

  • Index Cond: ((cid = 3,482) AND (property_id = 508,410) AND (unit_space_id = ANY ('{4206468,4206577,4206540,4206474,4206509,4206546,4206548,4206583,4206585,4206476,4206511,4206513,4206550,4206587,4206470,4206472,4206477,4206479,4206495,4206505,4206512,4206515,4206516,4206521,4206558,4206579,4206581,4206586,4206596,4206460,4206462,4206464,4206484,4206485,4206497,4206499,4206507,4206534,4206536,4206542,4206544,4206549,4206552,4206553,4206559,4206569,4206571,4206573,4206589,4206590,4206595,4206506,4206543,4206508,4206545,4206582,4206475,4206510,4206547,4206584,4206487,4206524,4206598,4206526,4206489,4206563,4206600,4206593,4206482,4206519,4206556,4206469,4206504,4206488,4206525,4206562,4206599,4206466,4206530,4206458,4206493,4206567,4206501,4206538,4206575,4206527,4206455,4206490,4206564,4206481,4206514,4206551,4206555,4206478,4206518,4206486,4206502,4206528,4206535,4206560,4206565,4206572,4206576,4206594,4206597,4206456,4206463,4206465,4206467,4206483,4206491,4206520,4206523,4206537,4206539,4206557,4206574,4206588,4206592,4206461,4206496,4206533,4206570,4206529,4206566,4206457,4206492,4206459,4206568,4206531,4206591,4206517}'::integer[])))
  • Filter: ((NOT is_renewal) AND (lease_term_id <> 0) AND (ar_trigger_id = 307) AND (ar_phase_id = 2) AND (ar_cascade_id = 4) AND (ar_origin_id = 1) AND (NOT (hashed SubPlan 1)))
  • Rows Removed by Filter: 2,096
5.          

SubPlan (for Index Scan)

6. 6,297.826 6,297.826 ↑ 1.3 3,920 1

Index Scan using idx_scheduled_charges_property_id on scheduled_charges (cost=0.43..57,511.04 rows=5,137 width=12) (actual time=2.492..6,297.826 rows=3,920 loops=1)

  • Index Cond: (property_id = 508,410)
  • Filter: ((rate_id IS NOT NULL) AND (deleted_on IS NULL) AND (cid = 3,482) AND (created_on > (now() - '6 mons'::interval)))
  • Rows Removed by Filter: 70,713
7. 4,516.941 4,516.941 ↑ 1.0 1 31,587

Index Scan using pk_lease_terms on lease_terms lt (cost=0.29..85.04 rows=1 width=10) (actual time=0.068..0.143 rows=1 loops=31,587)

  • Index Cond: (id = r.lease_term_id)
  • Filter: (lease_term_type_id <> 2)
8. 726.501 726.501 ↑ 41.0 1 31,587

Index Scan using idx_rate_logs_cid_rate_id on rate_logs rl (cost=0.57..37.08 rows=41 width=18) (actual time=0.014..0.023 rows=1 loops=31,587)

  • Index Cond: ((cid = 3,482) AND (rate_id = r.id))
Planning time : 1.100 ms
Execution time : 11,850.614 ms