QUERY PLAN
Sort (cost=1812.27..1812.79 rows=206 width=84)
Sort Key: (COALESCE(sum(r.amount), '0'::numeric)) DESC
-> GroupAggregate (cost=1800.23..1804.35 rows=206 width=84)
Group Key: tt.id
-> Sort (cost=1800.23..1800.75 rows=206 width=21)
Sort Key: tt.id
-> Hash Left Join (cost=315.74..1792.32 rows=206 width=21)
Hash Cond: (ttr.taxonomy_id = tt.id)
-> Hash Right Join (cost=304.83..1780.86 rows=206 width=9)
Hash Cond: (ttr.object_id = r.id)
-> Seq Scan on tbl_term_taxonomy_relationships ttr (cost=0.00..1470.28 rows=2187 width=8)
Filter: ((term_id = 18) AND (object_type = 7))
-> Hash (cost=302.26..302.26 rows=206 width=9)
-> Seq Scan on tbl_reimbursements r (cost=0.00..302.26 rows=206 width=9)
Filter: ((occurrence_at >= '2026-01-01 00:00:00+08'::timestamp with time zone) AND (occurrence_at <= '2026-12-31 23:59:59+08'::timestamp with time zone) AND (status = ANY ('{1,2,3}'::integer[])))
-> Hash (cost=7.07..7.07 rows=307 width=16)
-> Seq Scan on tbl_term_taxonomies tt (cost=0.00..7.07 rows=307 width=16)