Load category ids from the database and not a loop loading each category.