Improve performance of query `_get_subset_users_in_room_with_profiles`.