select
*
from table_a a
left join table_b b
on a.id = b.id
left join table_c c
on a.id = c.id
where a.id > 100
and b.id < 200
优化后:
select
*
from (
select
*
from table_a
where id > 100
) a
left join(
select
*
from table_b
where id < 200
)b
on a.id = b.id
left join table_c
on a.id = c.id
select username,email from system_user where age > 10
5 建议五:使用批量插入节省交互
优化前:
insert into system_user(username,passwd) values('test1','123456')
insert into system_user(username,passwd) values('test2','123456')
insert into system_user(username,passwd) values('test3','123456')
优化后:
insert into system_user(username,passwd) values('test1','123456'),('test2','123456'),('test3','123456')