关系型数据库 Mysql
索引
1.什么是索引?
类似于书的目录,可以提高数据检索的效率,降低数据库的IO成本。
通过索引列队数据进行排序,降低数据排序的成本,降低了cpu的消耗。
1.alter table t1 add index index_name (col_name(20));
2.在表中创建索引 create table t2 ( id int , name varchar(50),index singleindex(name(20)));
3.create index t3idx on t3 (name);
索引的几种形式:
1.单列索引 singleindex /index
2.组合索引 multiIdx/
3.全文索引 fulltext index/fulltxtidx
4.空间索引
删除索引:
alter table t4 drop index 索引名;
drop index 索引名 on 表名;