QUERY PLAN
Sort (cost=3.08..3.10 rows=5 width=24)
Sort Key: g.sort
-> HashAggregate (cost=2.98..3.03 rows=5 width=24)
Group Key: g.id
-> Hash Right Join (cost=1.14..2.87 rows=42 width=20)
Hash Cond: (sgr.group_id = g.id)
-> Seq Scan on tbl_sales_group_relationships sgr (cost=0.00..1.51 rows=51 width=4)
-> Hash (cost=1.07..1.07 rows=5 width=20)
-> Seq Scan on tbl_groups g (cost=0.00..1.07 rows=5 width=20)
Filter: (id <> 999999)