1、我们现在查询角色与角色的权限的数据。select * from role r left join role_action ra on r.rid=ra.rid;

3、现在是type有all,现在有左连接,现在在右边上添加索引优化。create index rid on role_action(rid);

5、现在可以看到type变为了热风,rows也变成了优化比较明显,这是左连接的特性决定的,left join条件用于确定如何从右边搜索行,左边一定都有,

时间:2024-10-17 03:17:12
1、我们现在查询角色与角色的权限的数据。select * from role r left join role_action ra on r.rid=ra.rid;
3、现在是type有all,现在有左连接,现在在右边上添加索引优化。create index rid on role_action(rid);
5、现在可以看到type变为了热风,rows也变成了优化比较明显,这是左连接的特性决定的,left join条件用于确定如何从右边搜索行,左边一定都有,