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,3751,3899,3890,3886,3872,3857,3855,3816,3813,3786,3767,3764,3760,3752,3744,3723,3714,3679,3653}'::integer[]))