MYSQL 索引篇(上)

1.索引比较
mysql 数据库是关系型数据库中的杰出代表,在选择关系型数据库的时候,mysql 都会作为优先选择,一方面由于开源的特点,还有 mysql 自身一些好的设计,优异的性能,备受开发者青睐;而索引作为数据库加速查询的通用手段,mysql 自然也有自己一套索引设计机制,现在就让我们从最简单的索引分类开始分享吧。
1.1 建表语句
复制代码
1.2 数据准备
复制代码
1.3 索引验证
1.3.1 无索引查询
复制代码
执行耗时:

执行计划:

1.3.2 普通索引验证
复制代码
执行耗时:

执行计划:

1.3.3 主键索引验证
复制代码
执行耗时:

执行计划:

1.3.4 唯一索引验证
复制代码
执行耗时:

执行计划:

1.3.5 覆盖索引验证
复制代码
执行耗时:

执行计划:

版权声明: 本文为 InfoQ 作者【new life】的原创文章。
原文链接:【http://xie.infoq.cn/article/917aa3f228db55bedb08dbec2】。
本文遵守【CC-BY 4.0】协议,转载请保留原文出处及本版权声明。
评论