QUERY PLAN
GroupAggregate (cost=849.28..850.31 rows=51 width=36)
Group Key: c.project_id
-> Sort (cost=849.28..849.41 rows=52 width=36)
Sort Key: c.project_id
-> Hash Right Join (cost=648.70..847.80 rows=52 width=36)
Hash Cond: (tbl_case_assignments.case_id = c.id)
-> HashAggregate (cost=202.64..301.69 rows=7924 width=36)
Group Key: tbl_case_assignments.case_id
-> Seq Scan on tbl_case_assignments (cost=0.00..162.76 rows=7976 width=12)
-> Hash (cost=445.41..445.41 rows=52 width=8)
-> Seq Scan on tbl_cases c (cost=0.00..445.41 rows=52 width=8)
Filter: (project_id = ANY ('{3927,3934,3930,3929,3928,3926,3925,3924,3751,3922,3919,3882,3920,3883,3916,3841,3910,3906,3911,3900}'::integer[]))