我可以使用
COUNT(DISTINCT col)
approx_count_distinct(x)
可能更快但不太准确。 如果您解释一下您想要实现的目标,也许会有所帮助。
或者看看https://duckdb.org/docs/sql/aggregates