QUERY PLAN
GroupAggregate (cost=328.91..329.99 rows=48 width=42)
Group Key: sub.new_status
-> Sort (cost=328.91..329.03 rows=48 width=7)
Sort Key: sub.new_status
-> Subquery Scan on sub (cost=326.61..327.57 rows=48 width=7)
-> Unique (cost=326.61..327.09 rows=48 width=11)
-> Sort (cost=326.61..326.73 rows=48 width=11)
Sort Key: l.project_id, l.new_status, p.budget
-> Hash Join (cost=217.10..325.27 rows=48 width=11)
Hash Cond: (l.project_id = p.id)
-> Seq Scan on tbl_project_status_logs l (cost=0.00..108.04 rows=48 width=6)
Filter: ((created_at >= '2025-12-01 00:00:00+08'::timestamp with time zone) AND (created_at < '2026-01-01 00:00:00+08'::timestamp with time zone) AND (new_status = ANY ('{3,4,5}'::integer[])))
-> Hash (cost=177.60..177.60 rows=3160 width=9)
-> Seq Scan on tbl_projects p (cost=0.00..177.60 rows=3160 width=9)