explain.depesz.com

PostgreSQL's explain analyze made readable

Result: c5w

Settings
# exclusive inclusive rows x rows loops node
1. 0.255 2,961.257 ↓ 576.0 576 1

Subquery Scan on trial_balance (cost=40.04..40.42 rows=1 width=298) (actual time=2,938.909..2,961.257 rows=576 loops=1)

2. 20.774 2,961.002 ↓ 576.0 576 1

GroupAggregate (cost=40.04..40.41 rows=1 width=550) (actual time=2,938.905..2,961.002 rows=576 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: 6396
3. 44.557 2,940.228 ↓ 7,193.0 7,193 1

Sort (cost=40.04..40.04 rows=1 width=499) (actual time=2,938.467..2,940.228 rows=7,193 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: 1304kB
4. 1,408.299 2,895.671 ↓ 7,193.0 7,193 1

Nested Loop Left Join (cost=0.95..40.03 rows=1 width=499) (actual time=22.197..2,895.671 rows=7,193 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: 6246022
5. 6.129 65.084 ↓ 6,972.0 6,972 1

Nested Loop (cost=0.95..19.76 rows=1 width=394) (actual time=21.767..65.084 rows=6,972 loops=1)

6. 4.068 31.067 ↓ 6,972.0 6,972 1

Nested Loop (cost=0.67..9.45 rows=1 width=276) (actual time=21.755..31.067 rows=6,972 loops=1)

7. 2.597 2.597 ↓ 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.597 rows=1,162 loops=1)

  • Index Cond: ((cid = 224) AND (gl_tree_id = 232))
  • Filter: (hide_account_balance_from_reports = 0)
8. 24.402 24.402 ↓ 6.0 6 1,162

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

  • Filter: ((is_disabled = 0) AND (is_test = 0))
9. 27.888 27.888 ↑ 1.0 1 6,972

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=6,972)

  • Index Cond: ((cid = 224) AND (id = load_prop.property_id))
10. 1,422.288 1,422.288 ↓ 224.0 896 6,972

Seq Scan on temp_tbal_data tbr_data (cost=0.00..20.20 rows=4 width=125) (actual time=0.003..0.204 rows=896 loops=6,972)

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