Optimized countAll()