QUERY PLAN
GroupAggregate (cost=778.93..779.77 rows=42 width=36)
Group Key: c.project_id
-> Sort (cost=778.93..779.03 rows=43 width=36)
Sort Key: c.project_id
-> Hash Right Join (cost=571.00..777.76 rows=43 width=36)
Hash Cond: (tbl_case_assignments.case_id = c.id)
-> HashAggregate (cost=210.26..313.12 rows=8229 width=36)
Group Key: tbl_case_assignments.case_id
-> Seq Scan on tbl_case_assignments (cost=0.00..168.84 rows=8284 width=12)
-> Hash (cost=360.20..360.20 rows=43 width=8)
-> Seq Scan on tbl_cases c (cost=0.00..360.20 rows=43 width=8)
Filter: (project_id = ANY ('{2587,3933,3935,3788,3772,3737,3642,3392,3364,3258}'::integer[]))