ITeye博客

mysql inner join性能

floydd · 2008-10-09 16:48 · Markdown

select count(1) from (
select login_id,id from PlatformPassPort where login_id like 'ab%'
) t1 inner join
pp_PlatformAccount t2 on t1.id = t2.passportId

select count(1) from PlatformPassPort t1 inner join
pp_PlatformAccount t2 on t1.id = t2.passportId
where login_id like 'ab%'

本来以为inner join先执行的话可能会导致速度变慢(测试的是160w的数据量,基本是表表的全连接) ,但是发现结果2者时间差不多,可能mysql做了优化。100条以内的数据量应该感觉不到时间。所以,我的结论是:有限条目的查询条件(尤其是单表的查询)
可以放心使用inner join -- 即使数据上百万。

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。