Files
doris/docs/en/sql-reference/sql-functions/aggregate-functions/approx_count_distinct.md
HangyuanLiu 116d7ffa3c [SQL][Function] Add approx_count_distinct() function (#4221)
Add approx_count_distinct() function to replace the ndv() function
2020-08-01 17:54:19 +08:00

1.4 KiB

title, language
title language
APPROX_COUNT_DISTINCT en

APPROX_COUNT_DISTINCT

Description

Syntax

APPROX_COUNT_DISTINCT (expr)

Returns an approximate aggregation function similar to the result of COUNT (DISTINCT col).

It combines COUNT and DISTINCT faster and uses fixed-size memory, so less memory can be used for columns with high cardinality.

example

MySQL > select approx_count_distinct(query_id) from log_statis group by datetime;
+-----------------+
| approx_count_distinct(`query_id`) |
+-----------------+
| 17721           |
+-----------------+

##keyword APPROX_COUNT_DISTINCT