mysql left join 优化

 

select * from a left join b on a.id=b.id  (a大表、b小表)

select * from b left join a on a.id=b.id  ---优化

大表 左关联 小表,很慢;小表 左关联 大表,很快。

 

select * from a join b on a.id=b.id -----自动选择小表作为驱动表

等于 select * from a left join b on a.id=b.id where b.id is null

转载地址:https://www.cnblogs.com/zgzf/p/10613627.html 

posted @ 2020-08-17 19:54  笨笨韩  阅读(623)  评论(0)    收藏  举报