MYSQL 的研究
1、常见批量插入的方法
①、以存储方式
drop PROCEDURE if EXISTS insert_a1; delimiter;; create PROCEDURE insert_a1() BEGIN DECLARE i int; set i = 1; while(i<5000) DO insert into a1(name,phone) VALUES(i,18218149622); set i=i+1; end WHILE; end;; delimiter; call insert_a1();
②、???
2、MYSQL优化常见命令
①、explain --- 检测sql查询语句的性能
explain SELECT * from a2 LEFT JOIN a1 on a2.member_id = a1.id LEFT JOIN a3 on a2.item_id = a3.id LEFT JOIN a4 on a2.sku_id = a4.id ;
结果