QUERY PLAN
GroupAggregate (cost=693.86..694.26 rows=20 width=36)
Group Key: c.project_id
-> Sort (cost=693.86..693.91 rows=20 width=36)
Sort Key: c.project_id
-> Hash Right Join (cost=503.97..693.42 rows=20 width=36)
Hash Cond: (tbl_case_assignments.case_id = c.id)
-> HashAggregate (cost=192.88..287.13 rows=7540 width=36)
Group Key: tbl_case_assignments.case_id
-> Seq Scan on tbl_case_assignments (cost=0.00..154.92 rows=7592 width=12)
-> Hash (cost=310.84..310.84 rows=20 width=8)
-> Seq Scan on tbl_cases c (cost=0.00..310.84 rows=20 width=8)
Filter: (project_id = ANY ('{3704,3701,3468,3241,3242,3086,2655,2590}'::integer[]))