Files
doris/docs/documentation/en/sql-reference/sql-functions/aggregate-functions/ndv_EN.md
2019-08-30 22:07:24 +08:00

466 B

NDV

Description

Syntax

NDV (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 ndv(query_id) from log_statis group by datetime;
+-----------------+
| ndv(`query_id`) |
+-----------------+
| 17721           |
+-----------------+

##keyword NDV