QUERY PLAN
Sort (cost=20.13..20.14 rows=5 width=158)
Sort Key: g.sort
-> Group (cost=20.04..20.07 rows=5 width=158)
Group Key: g.id
-> Sort (cost=20.04..20.06 rows=7 width=154)
Sort Key: g.id
-> Hash Join (cost=18.25..19.94 rows=7 width=154)
Hash Cond: (sgr.group_id = g.id)
-> Hash Join (cost=17.11..18.76 rows=9 width=4)
Hash Cond: (sgr.sales_id = tbl_users.id)
-> Seq Scan on tbl_sales_group_relationships sgr (cost=0.00..1.51 rows=51 width=8)
-> Hash (cost=16.80..16.80 rows=25 width=4)
-> Seq Scan on tbl_users (cost=0.00..16.80 rows=25 width=4)
Filter: (user_status = '1'::type_global_user_status)
-> Hash (cost=1.07..1.07 rows=5 width=154)
-> Seq Scan on tbl_groups g (cost=0.00..1.07 rows=5 width=154)
Filter: (id <> 999999)