Optimize get_user_details.