explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 8iDZ

Settings
# exclusive inclusive rows x rows loops node
1. 0.479 11,325.798 ↓ 1,092.0 1,092 1

Subquery Scan on trial_balance (cost=59.42..59.81 rows=1 width=298) (actual time=11,281.372..11,325.798 rows=1,092 loops=1)

2. 43.928 11,325.319 ↓ 1,092.0 1,092 1

GroupAggregate (cost=59.42..59.80 rows=1 width=550) (actual time=11,281.370..11,325.319 rows=1,092 loops=1)

  • Group Key: p.property_name, gat.formatted_account_number, p.id, gat.grouping_gl_account_id, gat.name, gat.details, gat.hide_account_balance_from_reports
  • Filter: CASE WHEN (max(gat.disabled_by) IS NOT NULL) THEN ((COALESCE(sum(tbr_data.current_amount_debits), '0'::numeric) <> '0'::numeric) OR (COALESCE(sum(tbr_data.current_amount_credits), '0'::numeric) <> '0'::numeric) OR (sum(COALESCE(tbr_data.opening_balance, '0'::numeric)) <> '0'::numeric)) ELSE ((COALESCE(sum(tbr_data.current_amount_debits), '0'::numeric) <> '0'::numeric) OR (COALESCE(sum(tbr_data.current_amount_credits), '0'::numeric) <> '0'::numeric) OR (sum(COALESCE(tbr_data.opening_balance, '0'::numeric)) <> '0'::numeric)) END
  • Rows Removed by Filter: 12852
3. 89.392 11,281.391 ↓ 14,422.0 14,422 1

Sort (cost=59.42..59.43 rows=1 width=499) (actual time=11,278.134..11,281.391 rows=14,422 loops=1)

  • Sort Key: p.property_name, gat.formatted_account_number, p.id, gat.grouping_gl_account_id, gat.name, gat.details
  • Sort Method: quicksort Memory: 2603kB
4. 5,461.380 11,191.999 ↓ 14,422.0 14,422 1

Nested Loop Left Join (cost=0.95..59.41 rows=1 width=499) (actual time=17.306..11,191.999 rows=14,422 loops=1)

  • Join Filter: ((tbr_data.cid = p.cid) AND (tbr_data.property_id = p.id) AND (tbr_data.gl_account_id = gat.gl_account_id))
  • Rows Removed by Join Filter: 25097411
5. 10.783 97.243 ↓ 13,944.0 13,944 1

Nested Loop (cost=0.95..19.76 rows=1 width=394) (actual time=16.488..97.243 rows=13,944 loops=1)

6. 6.446 30.684 ↓ 13,944.0 13,944 1

Nested Loop (cost=0.67..9.45 rows=1 width=276) (actual time=16.465..30.684 rows=13,944 loops=1)

7. 2.160 2.160 ↓ 1,162.0 1,162 1

Index Scan using uk_gl_account_trees_gl_account_id on gl_account_trees gat (cost=0.42..8.44 rows=1 width=272) (actual time=0.025..2.160 rows=1,162 loops=1)

  • Index Cond: ((cid = 224) AND (gl_tree_id = 232))
  • Filter: (hide_account_balance_from_reports = 0)
8. 22.078 22.078 ↓ 12.0 12 1,162

Function Scan on load_properties load_prop (cost=0.25..1.00 rows=1 width=4) (actual time=0.015..0.019 rows=12 loops=1,162)

  • Filter: ((is_disabled = 0) AND (is_test = 0))
9. 55.776 55.776 ↑ 1.0 1 13,944

Index Scan using idx_properties_cid_id_is_disabled_remote_primary_key on properties p (cost=0.28..8.30 rows=1 width=126) (actual time=0.004..0.004 rows=1 loops=13,944)

  • Index Cond: ((cid = 224) AND (id = load_prop.property_id))
10. 5,633.376 5,633.376 ↓ 200.0 1,800 13,944

Seq Scan on temp_tbal_data tbr_data (cost=0.00..39.50 rows=9 width=125) (actual time=0.003..0.404 rows=1,800 loops=13,944)

  • Filter: (cid = 224)
Planning time : 2.099 ms