QUERY PLAN
Aggregate (cost=76.47..76.48 rows=1 width=32)
-> Sort (cost=76.30..76.33 rows=11 width=1018)
Sort Key: b.is_delete, b.sort
-> GroupAggregate (cost=75.72..76.11 rows=11 width=1018)
Group Key: b.id
-> Sort (cost=75.72..75.75 rows=11 width=79)
Sort Key: b.id
-> Hash Left Join (cost=74.34..75.53 rows=11 width=79)
Hash Cond: (b.id = l.erp_bank_id)
-> Hash Left Join (cost=1.22..2.38 rows=11 width=15)
Hash Cond: (b.id = t.id)
-> Seq Scan on tbl_erp_banks b (cost=0.00..1.11 rows=11 width=9)
-> Hash (cost=1.14..1.14 rows=7 width=10)
-> Seq Scan on tbl_erp_banks t (cost=0.00..1.14 rows=7 width=10)
Filter: (created_at <= '2026-05-31 23:59:59+08'::timestamp with time zone)
-> Hash (cost=73.03..73.03 rows=7 width=68)
-> Subquery Scan on l (cost=72.86..73.03 rows=7 width=68)
-> HashAggregate (cost=72.86..72.96 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.96 rows=1719 width=15)
Filter: (settle_at <= '2026-05-01 00:00:00+08'::timestamp with time zone)