QUERY PLAN
GroupAggregate (cost=717.35..719.54 rows=107 width=36)
Group Key: c.project_id
-> Sort (cost=717.35..717.63 rows=114 width=36)
Sort Key: c.project_id
-> Hash Right Join (cost=524.00..713.45 rows=114 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=329.69..329.69 rows=114 width=8)
-> Seq Scan on tbl_cases c (cost=0.00..329.69 rows=114 width=8)
Filter: (project_id = ANY ('{3786,1111,1018,3809,3801,3577,3807,3810,3808,3751}'::integer[]))