QUERY PLAN
GroupAggregate (cost=330.41..331.49 rows=48 width=42)
Group Key: sub.new_status
-> Sort (cost=330.41..330.53 rows=48 width=7)
Sort Key: sub.new_status
-> Subquery Scan on sub (cost=328.11..329.07 rows=48 width=7)
-> Unique (cost=328.11..328.59 rows=48 width=11)
-> Sort (cost=328.11..328.23 rows=48 width=11)
Sort Key: l.project_id, l.new_status, p.budget
-> Hash Join (cost=218.59..326.76 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=178.82..178.82 rows=3182 width=9)
-> Seq Scan on tbl_projects p (cost=0.00..178.82 rows=3182 width=9)