QUERY PLAN
GroupAggregate (cost=48.48..48.73 rows=10 width=178)
Group Key: g.name
-> Sort (cost=48.48..48.50 rows=10 width=150)
Sort Key: g.name
-> Hash Join (cost=34.14..48.31 rows=10 width=150)
Hash Cond: (g.id = sgr.group_id)
-> Seq Scan on tbl_groups g (cost=0.00..13.30 rows=330 width=150)
-> Hash (cost=34.01..34.01 rows=10 width=8)
-> Bitmap Heap Scan on tbl_sales_group_relationships sgr (cost=23.45..34.01 rows=10 width=8)
Recheck Cond: (sales_id = 5493)
-> Bitmap Index Scan on tbl_sales_group_relationships_pkey (cost=0.00..23.45 rows=10 width=0)
Index Cond: (sales_id = 5493)