QUERY PLAN
Sort (cost=401.75..401.85 rows=37 width=41)
Sort Key: (COALESCE(sum(p.budget), '0'::numeric)) DESC
-> GroupAggregate (cost=400.05..400.79 rows=37 width=41)
Group Key: c.name
-> Sort (cost=400.05..400.14 rows=37 width=14)
Sort Key: c.name
-> Nested Loop (cost=0.28..399.09 rows=37 width=14)
-> Seq Scan on tbl_projects p (cost=0.00..199.99 rows=37 width=9)
Filter: ((created_at >= '2026-01-01 00:00:00+08'::timestamp with time zone) AND (created_at <= '2026-12-31 23:59:59+08'::timestamp with time zone) AND (project_status = 3))
-> Index Scan using tbl_contacts_pkey on tbl_contacts c (cost=0.28..5.38 rows=1 width=13)
Index Cond: (id = p.from_contact)