前言 大家好吖,欢迎来到 YY 滴MySQL系列 ,热烈欢迎! 本章主要内容面向接触过C++的老铁 主要内容含:
关于插入数据优化,主要有以下三个方面
Insert into tb test values(1,'Tom'),(2,'cat'),(3, jerry');
#客户端连接服务端时,加上参数--local-infile
mysql --local-infile -u root -p
#设置全局参数local infile为1,开启从本地加载文件导入数据的开关
set global local infile=1;
#执行load指令将准备好的数据,加载到表结构中
#逗号分隔,换行符截止
load data local infile '/root/sql1.log’ into table 'tb user’ fields terminated by ',’ lines terminated by '\n' ;
下面演示页分裂:
演示:
演示:
#没有创建索引时,根据age,phone进行排序
explain select id,age,phone from tb user order by age , phone;
#创建索引
create index idx user age phone aa on tb user(age,phone);
#创建索引后,根据age,phone进行升序排序
explain select id,age,phone from tb user order by age , phone;
#创建索引后,根据age,phone进行降序排序
explain select id,age,phone from tb user order by age desc , phone desc;
#根据age,phone进行降序一个升序,一个降序
explain select id,age,phone from tb_user order by age asc , phone desc;
#创建索引
create index idx user age phone ad on tb user(age asc ,phone desc);
#根据age,phone进行降序一个升序,一个降序
explain select id,age,phone from tb user order by age asc , phone desc;
演示:
优化思路:
演示:
count的几种用法:
update sludent set no='2000100100' where id =l;
update student setno='2000100105' where namne='韦一笑';