mysql查询优化
Posted saber-xi
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql查询优化相关的知识,希望对你有一定的参考价值。
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查询优化的主要内容,如果未能解决你的问题,请参考以下文章