QUERY PLAN
Limit (cost=346.51..346.60 rows=7 width=395)
-> Sort (cost=346.51..346.53 rows=7 width=395)
Sort Key: b.is_delete, b.sort
-> GroupAggregate (cost=342.72..346.41 rows=7 width=395)
Group Key: b.id
-> Merge Left Join (cost=342.72..345.84 rows=7 width=355)
Merge Cond: (b.id = osb.erp_bank_id)
-> Merge Left Join (cost=276.36..279.36 rows=7 width=347)
Merge Cond: (b.id = isb.erp_bank_id)
-> Merge Left Join (cost=211.63..214.50 rows=7 width=339)
Merge Cond: (b.id = f.erp_bank_id)
-> Nested Loop Left Join (cost=138.47..141.22 rows=7 width=275)
Join Filter: (l.erp_bank_id = b.id)
-> Nested Loop Left Join (cost=69.04..70.94 rows=7 width=211)
Join Filter: (t.id = b.id)
-> Merge Left Join (cost=69.04..69.18 rows=7 width=203)
Merge Cond: (b.id = n.erp_bank_id)
-> Sort (cost=1.17..1.19 rows=7 width=139)
Sort Key: b.id
-> Seq Scan on tbl_erp_banks b (cost=0.00..1.07 rows=7 width=139)
-> Sort (cost=67.87..67.89 rows=7 width=68)
Sort Key: n.erp_bank_id
-> Subquery Scan on n (cost=67.59..67.77 rows=7 width=68)
-> HashAggregate (cost=67.59..67.70 rows=7 width=68)
Group Key: t_1.erp_bank_id
-> Seq Scan on tbl_erp_bank_amount_change_logs t_1 (cost=0.00..64.16 rows=458 width=15)
Filter: ((settle_at >= '2026-01-01 00:00:00+08'::timestamp with time zone) AND (settle_at <= '2026-12-31 23:59:59+08'::timestamp with time zone))
-> Materialize (cost=0.00..1.12 rows=7 width=12)
-> Seq Scan on tbl_erp_banks t (cost=0.00..1.09 rows=7 width=12)
Filter: (created_at <= '2026-12-31 23:59:59+08'::timestamp with time zone)
-> Materialize (cost=69.44..69.65 rows=7 width=68)
-> Subquery Scan on l (cost=69.44..69.61 rows=7 width=68)
-> HashAggregate (cost=69.44..69.54 rows=7 width=68)
Group Key: t_2.erp_bank_id
-> Seq Scan on tbl_erp_bank_amount_change_logs t_2 (cost=0.00..59.80 rows=1285 width=15)
Filter: (settle_at <= '2026-01-01 00:00:00+08'::timestamp with time zone)
-> Sort (cost=73.15..73.17 rows=7 width=68)
Sort Key: f.erp_bank_id
-> Subquery Scan on f (cost=72.88..73.05 rows=7 width=68)
-> HashAggregate (cost=72.88..72.98 rows=7 width=68)
Group Key: t_3.erp_bank_id
-> Seq Scan on tbl_erp_bank_amount_change_logs t_3 (cost=0.00..59.80 rows=1744 width=15)
Filter: (settle_at <= '2026-12-31 23:59:59+08'::timestamp with time zone)
-> Sort (cost=64.73..64.75 rows=7 width=12)
Sort Key: isb.erp_bank_id
-> Subquery Scan on isb (cost=64.50..64.63 rows=7 width=12)
-> HashAggregate (cost=64.50..64.56 rows=7 width=12)
Group Key: t_4.erp_bank_id
-> Seq Scan on tbl_erp_bank_amount_change_logs t_4 (cost=0.00..64.16 rows=67 width=4)
Filter: ((in_amount IS NOT NULL) AND (settle_at >= '2026-01-01 00:00:00+08'::timestamp with time zone) AND (settle_at <= '2026-12-31 23:59:59+08'::timestamp with time zone))
-> Sort (cost=66.36..66.38 rows=7 width=12)
Sort Key: osb.erp_bank_id
-> Subquery Scan on osb (cost=66.12..66.26 rows=7 width=12)
-> HashAggregate (cost=66.12..66.19 rows=7 width=12)
Group Key: t_5.erp_bank_id
-> Seq Scan on tbl_erp_bank_amount_change_logs t_5 (cost=0.00..64.16 rows=392 width=4)
Filter: ((out_amount IS NOT NULL) AND (settle_at >= '2026-01-01 00:00:00+08'::timestamp with time zone) AND (settle_at <= '2026-12-31 23:59:59+08'::timestamp with time zone))