Speed up database queries on needs page