QUERY PLAN
GroupAggregate (cost=883.08..884.43 rows=67 width=36)
Group Key: c.project_id
-> Sort (cost=883.08..883.25 rows=69 width=36)
Sort Key: c.project_id
-> Hash Right Join (cost=674.21..880.97 rows=69 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=69 width=8)
-> Seq Scan on tbl_cases c (cost=0.00..463.09 rows=69 width=8)
Filter: (project_id = ANY ('{3957,4005,3976,4002,3972,4034,4037,4026,4007,3986,4041,4031,4030,4029,4020,4017,4001,3997,3996,3994}'::integer[]))