例子:visit_trace 表的domain_params列为例:
方法一,准确,但性能低:(推荐)
select (select count(distinct(domain_params)) from visit_trace )/(select count(1) from visit_trace)
结果:0.0167
方法二,大概结果,要求数据至少1万条:
select (select count(distinct(domain_params)) from (select * from visit_trace limit 0,10000) b )/10000
结果:0.1242