一、简介
二、统计信息流程
三、基数统计算法
Go root@:26257/defaultdb> select count(*) from t1; count --------- 10000 (1 row) Time: 3.300613ms root@:26257/defaultdb> Show statistics for table t1; statistics_name | column_names | created | row_count |distinct_count|null_count|histogram_id ------------------+--------------+----------------------------------+-----------+----------------+------------+--------------------- t1s | {c1} | 2023-05-28 00:53:09.573502+00:00 | 10000 | 9920 | 0 | 868891982501675009 (1 row) Time: 2.021244ms
Go root@:26257/defaultdb> select count(*) from t1; count --------- 10000 (1 row) Time: 4.210306ms root@:26257/defaultdb> Show statistics for table t1; statistics_name | column_names | created | row_count | distinct_count | null_count | histogram_id ------------------+--------------+----------------------------------+-----------+----------------+------------+--------------------- t1s | {c1} | 2023-05-28 01:02:29.997638+00:00 | 10000 | 9999 | 0 | 868893818901430273 (1 row) Time: 3.056793ms
四、 蓄水池算法
五、直方图计算流程
六、应用统计信息计算选择率
SQL selectivity = (output row count) / (input row count) 其中: output row count = nonNullSelectivity*输入的非空值数量 + nullSelectivity*输入空值数量 input row count:该列总行数 nonNullSelectivity:桶过滤后的非空值行数/桶过滤前的非空值的行数 nullSelectivity:过滤前后空值的占比
Hi,访客,请登录!欢迎分享,一起交流~
体验全新的分布式多模数据库解决方案
企业版 社区版
KaiwuDB 是浪潮控股的数据库企业,面向工业物联网、数字能源、车联网、智慧产业等行业领域,提供稳定安全、高性能、易运维的创新数据软件与服务。
友情链接:浪潮