Optimized retrieving of asssigned user ids.