> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# approx_count_distinct

> Returns the approximate value of aggregate function similar to the result of COUNT(DISTINCT col).

Returns the approximate value of aggregate function similar to the result of COUNT(DISTINCT col).

It is faster than the COUNT and DISTINCT combination and uses a fixed-size memory, so less memory is used for columns of high cardinality.

## Syntax

```Haskell theme={null}
APPROX_COUNT_DISTINCT(expr)
```

## Examples

```plain text theme={null}
MySQL > select approx_count_distinct(query_id) from log_statis group by datetime;
+-----------------------------------+
| approx_count_distinct(`query_id`) |
+-----------------------------------+
| 17721                             |
+-----------------------------------+
```

## keyword

APPROX\_COUNT\_DISTINCT


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.