您的位置:首页 > 数据库 > MySQL

mysql 性能优化(order by limit , inner join 、 left join)

2020-02-20 21:16 351 查看

1、order by limit

优化前:
select t1.id, t1.create_time, t1.account, t2.name from tab1 t1 inner join tab2 t2 on t1.account = t2.bip order by t1.create_time limit 0,10
优化后:
select tamp.*, t2.name from
( select t1.id, t1.create_time, t1.account, t2.name from tab1 t1 order by t1.create_time limit 0,10 ) tamp
inner join tab2 t2 on tamp.account = t2.bip

2、inner join

3、left join

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  MySQL