2021-05-05 08:42:57 +00:00
---
2022-08-28 14:53:34 +00:00
slug: /en/sql-reference/aggregate-functions/reference/uniqthetasketch
2022-04-09 13:29:05 +00:00
sidebar_position: 195
2022-08-28 21:34:50 +00:00
title: uniqTheta
2021-05-05 08:42:57 +00:00
---
Calculates the approximate number of different argument values, using the [Theta Sketch Framework ](https://datasketches.apache.org/docs/Theta/ThetaSketchFramework.html ).
``` sql
2021-05-11 14:36:26 +00:00
uniqTheta(x[, ...])
2021-05-05 08:42:57 +00:00
```
**Arguments**
The function takes a variable number of parameters. Parameters can be `Tuple` , `Array` , `Date` , `DateTime` , `String` , or numeric types.
**Returned value**
2023-04-19 15:55:29 +00:00
- A [UInt64 ](../../../sql-reference/data-types/int-uint.md )-type number.
2021-05-05 08:42:57 +00:00
**Implementation details**
Function:
2023-04-19 15:55:29 +00:00
- Calculates a hash for all parameters in the aggregate, then uses it in calculations.
2021-05-05 08:42:57 +00:00
2023-04-19 15:55:29 +00:00
- Uses the [KMV ](https://datasketches.apache.org/docs/Theta/InverseEstimate.html ) algorithm to approximate the number of different argument values.
2021-05-05 08:42:57 +00:00
4096(2^12) 64-bit sketch are used. The size of the state is about 41 KB.
2023-04-19 15:55:29 +00:00
- The relative error is 3.125% (95% confidence), see the [relative error table ](https://datasketches.apache.org/docs/Theta/ThetaErrorTable.html ) for detail.
2021-05-05 08:42:57 +00:00
**See Also**
2023-04-19 15:55:29 +00:00
- [uniq ](../../../sql-reference/aggregate-functions/reference/uniq.md#agg_function-uniq )
- [uniqCombined ](../../../sql-reference/aggregate-functions/reference/uniqcombined.md#agg_function-uniqcombined )
- [uniqCombined64 ](../../../sql-reference/aggregate-functions/reference/uniqcombined64.md#agg_function-uniqcombined64 )
- [uniqHLL12 ](../../../sql-reference/aggregate-functions/reference/uniqhll12.md#agg_function-uniqhll12 )
- [uniqExact ](../../../sql-reference/aggregate-functions/reference/uniqexact.md#agg_function-uniqexact )