QUERY PLAN
Sort (cost=3.49..3.50 rows=5 width=186)
Sort Key: g.sort
-> HashAggregate (cost=3.37..3.43 rows=5 width=186)
Group Key: g.id
-> Hash Join (cost=1.11..3.26 rows=11 width=158)
Hash Cond: (sgr.group_id = g.id)
-> Seq Scan on tbl_sales_group_relationships sgr (cost=0.00..2.12 rows=11 width=8)
Filter: (sales_id = ANY ('{5329,5332,5420,1001,5087,5300,5311,5295,1013,1004,1005}'::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)