When is the @count index actually needed in Dgraph?

That’s correct. Note that the @count directive would also be needed for “root functions” that use count, e.g.:

		user(func:eq(count(friend),4)) {
			name
		}

In your second example, the set of UIDs is already collected in the search so no @count predicate is required.