QUERY PLAN
Sort (cost=3.98..3.99 rows=5 width=186)
Sort Key: g.sort
-> HashAggregate (cost=3.86..3.92 rows=5 width=186)
Group Key: g.id
-> Hash Join (cost=1.11..3.69 rows=17 width=158)
Hash Cond: (sgr.group_id = g.id)
-> Seq Scan on tbl_sales_group_relationships sgr (cost=0.00..2.53 rows=17 width=8)
Filter: (sales_id = ANY ('{5329,5332,5420,1001,5087,5300,5311,5364,5295,1013,1025,1004,5359,5409,5412,1005,5358}'::integer[]))
-> Hash (cost=1.05..1.05 rows=5 width=154)
-> Seq Scan on tbl_groups g (cost=0.00..1.05 rows=5 width=154)