1 索引
create table tb_testindex(
fid int primary key,
sid int unique,
tid int,
name varchar(20),
remark varchar(20)
);
create procedure proc_readydata()
begin
declare i int default 1;
while i <= 50000 do
insert into tb_testindex(fid,sid,tid,name,remark) values (i,i,i,'test_name','test_remark');
set i = i + 1;
end while;
end;
call proc_readydata();
select count(1) from tb_testindex;
select * from books;
show indexes from tb_testindex;
create unique index index_test on tb_testindex(tid);
create index index_test2 on tb_testindex(name);
create index index_test3 on tb_testindex(tid,name);
select * from tb_testindex where tid = 25000;
select * from tb_testindex where name = 'aaa';
select * from tb_testindex where tid = 25000 and name = 'test_name';
select * from tb_testindex where tid = 25000\G;
show create table tb_testindex;
show keys from tb_testindex;
drop index index_test3 on tb_testindex;