首页 > 数据库技术 > 详细

mysql查询优化

时间:2020-06-11 21:09:19      阅读:35      评论:0      收藏:0      [点我收藏+]

select * from a where id in (select id from b)

等价于:

for select id from b

for select 8 from a where a.id = b.id

当b表数据必须小于a表数据时,in优于exists

select * from a where exists (select 1 from b where b.id = a.id)

等价于:

for select * from a 

for select * from b where b.id = a.id 

防止exists优于in

mysql查询优化

原文:https://www.cnblogs.com/saber-xi/p/13096018.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!