QUERY PLAN
Limit (cost=347.42..347.56 rows=11 width=374)
-> Sort (cost=347.42..347.45 rows=11 width=374)
Sort Key: b.is_delete, b.sort
-> GroupAggregate (cost=345.77..347.23 rows=11 width=374)
Group Key: b.id
-> Merge Left Join (cost=345.77..346.32 rows=11 width=332)
Merge Cond: (b.id = osb.erp_bank_id)
-> Merge Left Join (cost=279.07..279.49 rows=11 width=324)
Merge Cond: (b.id = isb.erp_bank_id)
-> Merge Left Join (cost=214.10..214.39 rows=11 width=316)
Merge Cond: (b.id = f.erp_bank_id)
-> Merge Left Join (cost=140.69..140.85 rows=11 width=252)
Merge Cond: (b.id = l.erp_bank_id)
-> Sort (cost=70.99..71.02 rows=11 width=188)
Sort Key: b.id
-> Hash Left Join (cost=69.58..70.80 rows=11 width=188)
Hash Cond: (b.id = n.erp_bank_id)
-> Hash Right Join (cost=1.25..2.42 rows=11 width=124)
Hash Cond: (t.id = b.id)
-> Seq Scan on tbl_erp_banks t (cost=0.00..1.14 rows=11 width=10)
Filter: (created_at <= '2026-12-31 23:59:59+08'::timestamp with time zone)
-> Hash (cost=1.11..1.11 rows=11 width=118)
-> Seq Scan on tbl_erp_banks b (cost=0.00..1.11 rows=11 width=118)
-> Hash (cost=68.25..68.25 rows=7 width=68)
-> Subquery Scan on n (cost=68.08..68.25 rows=7 width=68)
-> HashAggregate (cost=68.08..68.18 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.36 rows=496 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))
-> Sort (cost=69.69..69.71 rows=7 width=68)
Sort Key: l.erp_bank_id
-> Subquery Scan on l (cost=69.42..69.59 rows=7 width=68)
-> HashAggregate (cost=69.42..69.53 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.96 rows=1261 width=15)
Filter: (settle_at <= '2026-01-01 00:00:00+08'::timestamp with time zone)
-> Sort (cost=73.41..73.43 rows=7 width=68)
Sort Key: f.erp_bank_id
-> Subquery Scan on f (cost=73.14..73.31 rows=7 width=68)
-> HashAggregate (cost=73.14..73.24 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.96 rows=1757 width=15)
Filter: (settle_at <= '2026-12-31 23:59:59+08'::timestamp with time zone)
-> Sort (cost=64.97..64.99 rows=7 width=12)
Sort Key: isb.erp_bank_id
-> Subquery Scan on isb (cost=64.73..64.87 rows=7 width=12)
-> HashAggregate (cost=64.73..64.80 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.36 rows=75 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.70..66.72 rows=7 width=12)
Sort Key: osb.erp_bank_id
-> Subquery Scan on osb (cost=66.46..66.60 rows=7 width=12)
-> HashAggregate (cost=66.46..66.53 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.36 rows=421 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))