Limit the Use of unique()

unique() can affect query performance for large datasets that have over 100 million rows and include more than one million unique values. For large datasets, unique() is faster for measures than for dimensions. If counting the number of unique string values causes performance issues, convert the string to a number. For example, use a hash of the string value or refer to the index of the string in a sorted list of string values.

Counting unique values can impact performance, but counting the total number of rows in a dataset doesn’t.

Note