QUERY PLAN
GroupAggregate (cost=171.22..171.43 rows=6 width=28)
Group Key: ps.created_by
-> Sort (cost=171.22..171.24 rows=8 width=28)
Sort Key: ps.created_by
-> Nested Loop Left Join (cost=0.29..171.10 rows=8 width=28)
-> Seq Scan on tbl_pre_sales ps (cost=0.00..108.67 rows=8 width=28)
Filter: ((NOT is_draft) AND (start_at >= '2026-01-01 00:00:00+08'::timestamp with time zone) AND (start_at <= '2026-12-31 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..7.80 rows=1 width=8)
Index Cond: (ps.case_id = id)