死磕mysql(2)

想测试自己的查询语句,导入批量的数据,一开始很慢以为是自己的语句有问题,后来是这个autocommit,效率相差好多好多。。。。。。。。。。。。

delimiter // create procedure new(in num int)  begin  declare i int;  set i=0;  while i<num do

  insert into new values (i,"name");   set i=i+1;  end while;  end // delimiter ;

没建索引,测试

mysql> select * from new where name='haha'; +-----------+------+ | id        | name | +-----------+------+ | 100000000 | haha | +-----------+------+ 1 row in set (0.13 sec)

mysql> select * from new where id=100000000; +-----------+------+ | id        | name | +-----------+------+ | 100000000 | haha | +-----------+------+ 1 row in set (0.00 sec)

mysql> select * from new where name='haha'; +-----------+------+ | id        | name | +-----------+------+ | 100000000 | haha | +-----------+------+ 1 row in set (0.09 sec)

同样的数据查询整形和字符相差好大啊

切记以后多查整形。。。。。

原文地址:https://www.cnblogs.com/ututuut/p/4333248.html