explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 9EuM

Settings
# exclusive inclusive rows x rows loops node
1. 0.475 11,573.746 ↓ 1,092.0 1,092 1

Subquery Scan on trial_balance (cost=48.12..48.50 rows=1 width=298) (actual time=11,531.475..11,573.746 rows=1,092 loops=1)

2. 39.724 11,573.271 ↓ 1,092.0 1,092 1

GroupAggregate (cost=48.12..48.49 rows=1 width=550) (actual time=11,531.474..11,573.271 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. 86.422 11,533.547 ↓ 14,422.0 14,422 1

Sort (cost=48.12..48.12 rows=1 width=499) (actual time=11,531.092..11,533.547 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,563.433 11,447.125 ↓ 14,422.0 14,422 1

Nested Loop Left Join (cost=0.95..48.11 rows=1 width=499) (actual time=20.872..11,447.125 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. 21.190 96.932 ↓ 13,944.0 13,944 1

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

6. 6.234 33.910 ↓ 13,944.0 13,944 1

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

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

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

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

  • Filter: ((is_disabled = 0) AND (is_test = 0))
9. 41.832 41.832 ↑ 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.003..0.003 rows=1 loops=13,944)

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

Seq Scan on temp_tbal_data tbr_data (cost=0.00..28.26 rows=5 width=125) (actual time=0.003..0.415 rows=1,800 loops=13,944)

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