In the segments total count query there is an check if the MaterializedView exist for the given task. This is not required and should be removed.