Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

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