QUERY PLAN
GroupAggregate (cost=5.76..5.83 rows=3 width=68)
Group Key: i.ledger_account_caption_id
-> Sort (cost=5.76..5.76 rows=3 width=12)
Sort Key: i.ledger_account_caption_id
-> Hash Join (cost=2.30..5.73 rows=3 width=12)
Hash Cond: (i.ledger_ticket_id = t.id)
-> Seq Scan on tbl_ledger_ticket_items i (cost=0.00..3.12 rows=112 width=16)
-> Hash (cost=2.28..2.28 rows=1 width=4)
-> Seq Scan on tbl_ledger_tickets t (cost=0.00..2.28 rows=1 width=4)
Filter: ((ticket_date >= '2026-06-01'::date) AND (ticket_date <= '2026-06-30'::date) AND (ledger_id = 1) AND (status = 1) AND ((type = 1) OR ((type = 2) AND (settle_caption_id = ANY ('{1,2,3,4,5,6,7}'::integer[])))))