QUERY PLAN
GroupAggregate (cost=113.68..113.70 rows=1 width=44)
Group Key: s.id
-> Sort (cost=113.68..113.68 rows=1 width=40)
Sort Key: s.id
-> Nested Loop Left Join (cost=0.14..113.67 rows=1 width=40)
-> Seq Scan on tbl_pre_sales ps (cost=0.00..105.44 rows=1 width=12)
Filter: ((NOT is_draft) AND (created_at >= '2025-08-01 00:00:00+08'::timestamp with time zone) AND (created_at <= '2025-08-31 23:59:59+08'::timestamp with time zone) AND (created_by = ANY ('{1017,5085,5248,1015,1022,1023}'::integer[])))
-> Index Scan using tbl_services_pkey on tbl_services s (cost=0.14..8.16 rows=1 width=36)
Index Cond: (ps.service_id = id)