QUERY PLAN
Sort (cost=3.49..3.51 rows=6 width=158)
Sort Key: g.sort
-> HashAggregate (cost=3.36..3.42 rows=6 width=158)
Group Key: g.id
-> Hash Join (cost=1.14..3.33 rows=10 width=154)
Hash Cond: (sgr.group_id = g.id)
-> Seq Scan on tbl_sales_group_relationships sgr (cost=0.00..2.15 rows=10 width=4)
Filter: (sales_id = ANY ('{5332,1001,5087,5300,5311,5295,1013,5476,1004,1005}'::integer[]))
-> Hash (cost=1.06..1.06 rows=6 width=154)
-> Seq Scan on tbl_groups g (cost=0.00..1.06 rows=6 width=154)