QUERY PLAN
Sort (cost=26.20..26.22 rows=7 width=10)
Sort Key: d."order"
-> Group (cost=26.05..26.10 rows=7 width=10)
Group Key: u.id, d.id
-> Sort (cost=26.05..26.07 rows=7 width=10)
Sort Key: u.id, d.id
-> Hash Left Join (cost=1.20..25.95 rows=7 width=10)
Hash Cond: (u.department_id = d.id)
-> Seq Scan on tbl_users u (cost=0.00..24.72 rows=7 width=8)
Filter: ((user_status = '1'::type_global_user_status) AND ((id = ANY ('{1000,1001,1004,1005,1011,1013,1015,1022,1023,5016,5064,5085,5087,5248,5250,5252,5295,5300,5311,5332,5360,5446,5449,5461,5476}'::integer[])) OR (id = ANY ('{5015,5016,5064,5250,5252,5329}'::integer[])) OR (id = ANY ('{5252,1015,1000,5295,1013,5388,5300,5064,1014,5446,1011,1001,5016}'::integer[]))))
-> Hash (cost=1.09..1.09 rows=9 width=6)
-> Seq Scan on tbl_departments d (cost=0.00..1.09 rows=9 width=6)