QUERY PLAN
Group (cost=12.66..12.67 rows=1 width=4)
Group Key: u.id
-> Sort (cost=12.66..12.67 rows=1 width=4)
Sort Key: u.id
-> Nested Loop Left Join (cost=0.56..12.65 rows=1 width=4)
-> Index Scan using tbl_punch_pkey on tbl_punch p (cost=0.41..8.43 rows=1 width=4)
Index Cond: ((day_at >= '2026-06-01'::date) AND (day_at <= '2026-06-02'::date))
Filter: ((in_at IS NOT NULL) OR (out_at IS NOT NULL))
-> Index Only Scan using tbl_users_pkey on tbl_users u (cost=0.14..4.16 rows=1 width=4)
Index Cond: (id = p.user_id)