QUERY PLAN
Sort (cost=15.13..15.14 rows=7 width=10)
Sort Key: d."order"
-> Group (cost=14.98..15.03 rows=7 width=10)
Group Key: u.id, d.id
-> Sort (cost=14.98..14.99 rows=7 width=10)
Sort Key: u.id, d.id
-> Hash Left Join (cost=1.20..14.88 rows=7 width=10)
Hash Cond: (u.department_id = d.id)
-> Seq Scan on tbl_users u (cost=0.00..13.64 rows=7 width=8)
Filter: ((user_status = '1'::type_global_user_status) AND ((id = ANY ('{1004,1004,1001,5446,5087,1015,1023,5064,5440,5360,1022,5311,5248,1000,5420,5445,5388,5404,5252,1013,5300,5250,5296,1005,1017,5085,5332,1011,5329,5016,5295}'::integer[])) OR (id = ANY ('{5359,5329,5332}'::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)