QUERY PLAN
Sort (cost=18.54..18.55 rows=1 width=10)
Sort Key: d."order"
-> Group (cost=18.52..18.53 rows=1 width=10)
Group Key: u.id, d.id
-> Sort (cost=18.52..18.53 rows=1 width=10)
Sort Key: u.id, d.id
-> Nested Loop Left Join (cost=0.15..18.51 rows=1 width=10)
-> Seq Scan on tbl_users u (cost=0.00..10.30 rows=1 width=8)
Filter: ((id = ANY ('{5493,5495}'::integer[])) AND (user_status = '1'::type_global_user_status))
-> Index Scan using tbl_departments_pkey on tbl_departments d (cost=0.15..8.17 rows=1 width=6)
Index Cond: (u.department_id = id)