Skip to main content
Returns the approximate value of aggregate function similar to the result of COUNT(DISTINCT col). ds_theta_count_distinct is faster than COUNT(DISTINCT col) and uses less memory for columns of high cardinality. ds_theta_count_distinct is similar to APPROX_COUNT_DISTINCT(expr) and DS_HLL_COUNT_DISTINCT(expr) but with different precisions because it adopts Apache DataSketches. For more information, see Theta Sketches. The relative error is 3.125% (95% confidence). For more information, see the relative error table.

Syntax

  • expr: The column in which to calculate the approximate count distinct values.

Examples

text

Keywords

DS_THETA_COUNT_DISTINCT,DS_HLL_COUNT_DISTINCT,APPROX_COUNT_DISTINCT