QUERY PLAN
GroupAggregate (cost=280.82..281.39 rows=13 width=28)
Group Key: ps.created_by
-> Sort (cost=280.82..280.88 rows=25 width=28)
Sort Key: ps.created_by
-> Nested Loop Left Join (cost=0.29..280.24 rows=25 width=28)
-> Seq Scan on tbl_pre_sales ps (cost=0.00..108.67 rows=25 width=28)
Filter: ((NOT is_draft) AND (start_at >= '2025-01-01 00:00:00+08'::timestamp with time zone) AND (start_at <= '2025-06-15 23:59:59+08'::timestamp with time zone) AND (created_by = ANY ('{5085,5248,1015,1022,5064,1023}'::integer[])))
-> Index Scan using tbl_cases_pkey on tbl_cases c (cost=0.29..6.86 rows=1 width=8)
Index Cond: (ps.case_id = id)