QUERY PLAN
Sort (cost=1974.48..1975.07 rows=235 width=84)
Sort Key: (COALESCE(sum(r.amount), '0'::numeric)) DESC
-> GroupAggregate (cost=1960.53..1965.23 rows=235 width=84)
Group Key: tt.id
-> Sort (cost=1960.53..1961.12 rows=235 width=21)
Sort Key: tt.id
-> Hash Left Join (cost=474.85..1951.27 rows=235 width=21)
Hash Cond: (ttr.taxonomy_id = tt.id)
-> Hash Right Join (cost=463.94..1939.74 rows=235 width=9)
Hash Cond: (ttr.object_id = r.id)
-> Seq Scan on tbl_term_taxonomy_relationships ttr (cost=0.00..1470.03 rows=2196 width=8)
Filter: ((term_id = 18) AND (object_type = 7))
-> Hash (cost=461.01..461.01 rows=235 width=9)
-> Seq Scan on tbl_reimbursements r (cost=0.00..461.01 rows=235 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)