| GroupAggregate (cost=622.40..622.51 rows=4 width=42) |
| Group Key: sub.new_status |
| -> Sort (cost=622.40..622.42 rows=6 width=7) |
| Sort Key: sub.new_status |
| -> Subquery Scan on sub (cost=508.33..622.33 rows=6 width=7) |
| Filter: ((sub.new_status = ANY ('{1,2}'::integer[])) AND (sub.rn = 1)) |
| -> WindowAgg (cost=508.33..573.47 rows=3257 width=27) |
| -> Sort (cost=508.33..516.47 rows=3257 width=19) |
| Sort Key: l.project_id, l.created_at DESC |
| -> Hash Join (cost=217.19..318.30 rows=3257 width=19) |
| Hash Cond: (l.project_id = p.id) |
| -> Seq Scan on tbl_project_status_logs l (cost=0.00..92.55 rows=3257 width=14) |
| Filter: ((created_at < '2026-03-01 00:00:00+08'::timestamp with time zone) AND (new_status > 0)) |
| -> 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) |