QUERY PLAN
GroupAggregate (cost=324.16..325.22 rows=47 width=42)
Group Key: sub.new_status
-> Sort (cost=324.16..324.28 rows=47 width=7)
Sort Key: sub.new_status
-> Subquery Scan on sub (cost=321.92..322.86 rows=47 width=7)
-> Unique (cost=321.92..322.39 rows=47 width=11)
-> Sort (cost=321.92..322.03 rows=47 width=11)
Sort Key: l.project_id, l.new_status, p.budget
-> Hash Join (cost=215.70..320.61 rows=47 width=11)
Hash Cond: (l.project_id = p.id)
-> Seq Scan on tbl_project_status_logs l (cost=0.00..104.79 rows=47 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=176.42..176.42 rows=3142 width=9)
-> Seq Scan on tbl_projects p (cost=0.00..176.42 rows=3142 width=9)