QUERY PLAN
Aggregate (cost=50.91..50.92 rows=1 width=720)
-> Nested Loop Left Join (cost=34.12..50.56 rows=1 width=38)
-> Nested Loop Left Join (cost=33.96..46.39 rows=1 width=40)
-> Nested Loop (cost=33.81..42.21 rows=1 width=40)
Join Filter: (p.id = subpsl.project_id)
-> Index Scan using tbl_projects_created_by_idx on tbl_projects p (cost=0.14..8.16 rows=1 width=36)
Index Cond: (created_by = 5495)
-> GroupAggregate (cost=33.67..33.87 rows=8 width=12)
Group Key: subpsl.project_id
Filter: ((min(subpsl.id) IS NOT NULL) AND (max(subpsl.id) IS NOT NULL))
-> Sort (cost=33.67..33.69 rows=8 width=8)
Sort Key: subpsl.project_id
-> Seq Scan on tbl_project_status_logs subpsl (cost=0.00..33.55 rows=8 width=8)
Filter: ((created_at >= '2026-06-02 00:00:00+08'::timestamp with time zone) AND (created_at < '2026-06-03 00:00:00'::timestamp without time zone))
-> Index Scan using tbl_project_status_logs_pkey on tbl_project_status_logs minpsl (cost=0.15..4.17 rows=1 width=8)
Index Cond: ((min(subpsl.id)) = id)
-> Index Scan using tbl_project_status_logs_pkey on tbl_project_status_logs maxpsl (cost=0.15..4.17 rows=1 width=6)
Index Cond: ((max(subpsl.id)) = id)