QUERY PLAN
GroupAggregate (cost=813.06..818.02 rows=22 width=36)
Group Key: im.created_by
-> Sort (cost=813.06..813.72 rows=265 width=32)
Sort Key: im.created_by
-> Hash Left Join (cost=373.56..802.39 rows=265 width=32)
Hash Cond: (im.case_id = c.id)
-> Seq Scan on tbl_implement_records im (cost=0.00..428.13 rows=265 width=28)
Filter: ((NOT is_draft) AND (arrived_at >= '2025-01-01 00:00:00+08'::timestamp with time zone) AND (arrived_at <= '2025-06-15 23:59:59+08'::timestamp with time zone) AND (created_by = ANY ('{5085,5248,1015,1022,5064,1023}'::integer[])))
-> Hash (cost=267.14..267.14 rows=8514 width=12)
-> Seq Scan on tbl_cases c (cost=0.00..267.14 rows=8514 width=12)