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