APPROX_COUNT_DISTINCT
Approximates the number of distinct non-null input values.
This function is used as an approximation of COUNT(DISTINCT ...)
in order to improve performance. It should be used when there are relatively few (under one million) rows, and where the total number of distinct values is high.
Syntax
Arguments
X
X
Type: any type
The values to be counted.
Returns
Type: bigint
Returns the approximate number of distinct non-null input values.
If all input values are null, zero is returned.
Examples
Transformation job example
SQL
Query result
ordertype | avgtotal |
---|---|
pickup | 1062.14 |
shipping | 1061.91 |
Last updated