exists里面会走索引吗
答案:2 悬赏:20
解决时间 2021-02-27 17:08
- 提问者网友:纹身骑士
- 2021-02-27 14:16
exists里面会走索引吗
最佳答案
- 二级知识专家网友:为你轻狂半世殇
- 2021-02-27 14:22
给你举个例子:
select * from tab_a where not exists(select * from tab_b where tab_a.id = tab_b.id);
如果id在两个表中都是索引项的话,肯定是走索引的。
select * from tab_a where not exists(select * from tab_b where tab_a.id = tab_b.id);
如果id在两个表中都是索引项的话,肯定是走索引的。
全部回答
- 1楼网友:深街酒徒
- 2021-02-27 15:50
不关not exists 的事,要看where子句,想用上索引,就要给where子句引用的字段建立索引.
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯