QUERY PLAN
GroupAggregate (cost=771.70..771.79 rows=5 width=12)
Group Key: created_by
-> Sort (cost=771.70..771.71 rows=5 width=4)
Sort Key: created_by
-> Bitmap Heap Scan on tbl_schedules (cost=131.98..771.64 rows=5 width=4)
Recheck Cond: (created_by = ANY ('{5332,1001,5087,5467,5300,5311,5295,1013,5476,1004,1005,5449}'::integer[]))
Filter: ((created_at >= '2025-07-19 00:00:00+08'::timestamp with time zone) AND (created_at <= '2025-12-31 23:59:59+08'::timestamp with time zone) AND ((complete_at IS NULL) OR (complete_at > '2025-12-31 23:59:59+08'::timestamp with time zone)))
-> Bitmap Index Scan on tbl_schedules_created_by_idx (cost=0.00..131.98 rows=7005 width=0)
Index Cond: (created_by = ANY ('{5332,1001,5087,5467,5300,5311,5295,1013,5476,1004,1005,5449}'::integer[]))