利用索引与不用索引区别(profiles)

1、定义
  对数据库表的一列或多列的值进行排序的一种结构(Btree方式)=(相当于二分查找法)
2、优点
  加快数据检索速度
3、缺点
  1、占用物理存储空间
  2、当对表中数据更新时,索引需要动态维护,降低数据维护速度
4、索引示例
  1、开启运行时间检测 :set profiling=1;
  2、执行查询语句
  select name from t1 where name="lucy99999";
3、查看执行时间
  show profiles;
4、在name字段创建索引
  create index name on t1(name);
5、再执行查询语句
  select name from t1 where name="lucy88888";
6、查看执行时间
  show profiles;

猜你喜欢

转载自www.cnblogs.com/zengsf/p/9572900.html