QUERY PLAN
Sort (cost=49.52..49.54 rows=10 width=158)
Sort Key: g.sort
-> Group (cost=49.30..49.35 rows=10 width=158)
Group Key: g.id
-> Sort (cost=49.30..49.33 rows=10 width=154)
Sort Key: g.id
-> Hash Join (cost=34.14..49.13 rows=10 width=154)
Hash Cond: (g.id = sgr.group_id)
-> Seq Scan on tbl_groups g (cost=0.00..14.12 rows=329 width=154)
Filter: (id <> 999999)
-> Hash (cost=34.01..34.01 rows=10 width=4)
-> Bitmap Heap Scan on tbl_sales_group_relationships sgr (cost=23.45..34.01 rows=10 width=4)
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)