Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
approx_count_distinct 返回类似 COUNT(DISTINCT col) 的近似值,速度更快且使用固定大小内存。
COUNT(DISTINCT col)
它比 COUNT 和 DISTINCT 组合的速度更快,并使用固定大小的内存,因此对于高基数的列可以使用更少的内存。
APPROX_COUNT_DISTINCT(expr)
epxr
MySQL > select approx_count_distinct(query_id) from log_statis group by datetime; +-----------------------------------+ | approx_count_distinct(`query_id`) | +-----------------------------------+ | 17721 | +-----------------------------------+