QUERY PLAN
Aggregate (cost=73.21..73.22 rows=1 width=32)
-> Sort (cost=73.11..73.12 rows=7 width=1018)
Sort Key: b.is_delete, b.sort
-> GroupAggregate (cost=70.88..73.01 rows=7 width=1018)
Group Key: b.id
-> Nested Loop Left Join (cost=70.88..72.78 rows=7 width=81)
Join Filter: (t.id = b.id)
-> Merge Left Join (cost=70.88..71.02 rows=7 width=73)
Merge Cond: (b.id = l.erp_bank_id)
-> Sort (cost=1.17..1.19 rows=7 width=9)
Sort Key: b.id
-> Seq Scan on tbl_erp_banks b (cost=0.00..1.07 rows=7 width=9)
-> Sort (cost=69.71..69.73 rows=7 width=68)
Sort Key: l.erp_bank_id
-> 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_1.erp_bank_id
-> Seq Scan on tbl_erp_bank_amount_change_logs t_1 (cost=0.00..59.80 rows=1285 width=15)
Filter: (settle_at <= '2026-01-01 00:00:00+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)