简单分析MySQL中的primary key功能

上传:qqsevere72746 浏览: 24 推荐: 0 文件:pdf 大小:80.21 KB 上传时间:2021-08-29 06:35:44 版权申诉

在5.1.46中优化器在对primary key的选择上做了一点改动:Performance: While looking for the shortest index for a covering index scan, the optimizer did not consider the full row length for a clustered primary key, as in InnoDB. Secondary covering indexes will now be preferred, making full table scans less likely。该版本中增加了find_shortest_key函数,该函数的作用可以认为是选择最小key length的索引来满足我们的查询。该函数是怎么工作的:调用Primary_key_is_clustered(),当返回值为true,执行find_shortest_key:选择key length最小的覆盖索引,然后来满足查询。

上传资源
用户评论