QUERY PLAN
GroupAggregate (cost=851.58..852.60 rows=51 width=36)
Group Key: c.project_id
-> Sort (cost=851.58..851.71 rows=52 width=36)
Sort Key: c.project_id
-> Hash Right Join (cost=650.57..850.09 rows=52 width=36)
Hash Cond: (tbl_case_assignments.case_id = c.id)
-> HashAggregate (cost=202.91..302.17 rows=7941 width=36)
Group Key: tbl_case_assignments.case_id
-> Seq Scan on tbl_case_assignments (cost=0.00..162.94 rows=7994 width=12)
-> Hash (cost=447.01..447.01 rows=52 width=8)
-> Seq Scan on tbl_cases c (cost=0.00..447.01 rows=52 width=8)
Filter: (project_id = ANY ('{3935,3927,3751,3899,3890,3886,3872,3857,3855,3816,3786,3767,3764,3760,3752,3744,3723,3714,3679,3653}'::integer[]))