QUERY PLAN
Sort (cost=9.84..9.84 rows=1 width=10)
Sort Key: d."order"
-> Group (cost=9.82..9.83 rows=1 width=10)
Group Key: u.id, d.id
-> Sort (cost=9.82..9.82 rows=1 width=10)
Sort Key: u.id, d.id
-> Nested Loop Left Join (cost=0.00..9.81 rows=1 width=10)
Join Filter: (u.department_id = d.id)
-> Seq Scan on tbl_users u (cost=0.00..8.61 rows=1 width=8)
Filter: ((user_status = '1'::type_global_user_status) AND ((id = ANY ('{5300,5295,5295}'::integer[])) OR (id = 5413)))
-> Seq Scan on tbl_departments d (cost=0.00..1.09 rows=9 width=6)