mysql学习(七)-索引学习

时间:2024-03-22 16:35:33

常规索引:

在常用查询的字段上使用常规索引

 创建表时一块创建索引

    create table if not exists carshop(id int not null auto_increment, uid int not null, gid int not null, primay key(id), index cuid(uid), key cgid(gid));

    create table if not exists carshop(id int not null auto_increment, uid int not null, gid int not null, primary key(id), index carindex(uid, gid));

    单独创建索引

    create index carindex on carshop(uid, gid);

    删除索引

    drop index carindex on carshop;

全文索引:只能用在char varchar text字符类型