mysqlleftjoin执行顺序逻辑

database

select * from user left join info

on user.uid=info.uid

where user.uid in (2,3);

 

mysql的执行逻辑如下

user_rows = select * from user where uid in (2,3);

for(user_rows : user_row){

info_rows = select * from info where uid = user_row.uid;

for(info_rows : info_row){

输出: {user_row,info_row}

}

}

 

参见:高性能mysql P215

 

 

需要注意的是,如果是info命中的行数少,mysql会自动调整顺序

 

以上是 mysqlleftjoin执行顺序逻辑 的全部内容, 来源链接: utcz.com/z/531667.html

回到顶部