QUERY PLAN
GroupAggregate (cost=751.09..751.61 rows=26 width=36)
Group Key: c.project_id
-> Sort (cost=751.09..751.16 rows=26 width=36)
Sort Key: c.project_id
-> Hash Right Join (cost=550.95..750.48 rows=26 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=347.72..347.72 rows=26 width=8)
-> Seq Scan on tbl_cases c (cost=0.00..347.72 rows=26 width=8)
Filter: (project_id = ANY ('{3837,3895,3820,3867,3933,3932,3936,3908,3907,3818}'::integer[]))