QUERY PLAN
GroupAggregate (cost=329.73..330.83 rows=49 width=42)
Group Key: sub.new_status
-> Sort (cost=329.73..329.85 rows=49 width=7)
Sort Key: sub.new_status
-> Subquery Scan on sub (cost=327.38..328.36 rows=49 width=7)
-> Unique (cost=327.38..327.87 rows=49 width=11)
-> Sort (cost=327.38..327.50 rows=49 width=11)
Sort Key: l.project_id, l.new_status, p.budget
-> Hash Join (cost=217.19..326.00 rows=49 width=11)
Hash Cond: (l.project_id = p.id)
-> Seq Scan on tbl_project_status_logs l (cost=0.00..108.68 rows=49 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.64..177.64 rows=3164 width=9)
-> Seq Scan on tbl_projects p (cost=0.00..177.64 rows=3164 width=9)