Made rating/task_index more efficient wrt db