QUERY PLAN
GroupAggregate (cost=882.29..883.34 rows=52 width=36)
Group Key: c.project_id
-> Sort (cost=882.29..882.42 rows=53 width=36)
Sort Key: c.project_id
-> Hash Right Join (cost=674.01..880.77 rows=53 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=463.09..463.09 rows=53 width=8)
-> Seq Scan on tbl_cases c (cost=0.00..463.09 rows=53 width=8)
Filter: (project_id = ANY ('{3515,3514,3513,3503,3467,3424,3441,3372,3371,3216,3300,3281,3251,3276,3274,3263,3246,3225,3209,3208}'::integer[]))