数据库索引(index)记录

创建索引

  • 单列的索引:create index 索引名 on 表名(列名)
  • 复合索引: create index 索引名 on 表名(列名1,列名2)

注意,复合索引的列的位置不同,索引不同:

create index emp_idx1 on emp(name,id);

create index emp_idx1 on emp(id,name);
组合是不同的。

使用原则:

  • 只有在大表上建立索引才有意义。
  • 在where子句或者连接条件上经常引用的列上建立索引。
  • 索引的层次不要超过4层

关于索引的博客:
https://www.cnblogs.com/wishyouhappy/p/3681771.html

猜你喜欢

转载自blog.csdn.net/u013146766/article/details/78651566
今日推荐