对于msSql中exists操作符求值的疑惑
看
SQL.Server.2008编程入门经典(第3版).pdf
这书时.其中page 169中说到
用exists关键字时.不需要一行行地查找.只要找到一行符合条件的记录就返回true
也就是优势在于不用扫整张的表.
可是我用下面的两组语句去扫表却得不出这个结论
1.
if exists( select 1 from M_DynamicConfig where nodeid = 5242881 or nodeid & 0xfff80000 = 5242881 ) begin print 'y' end
2.
if exists( select 1 from M_DynamicConfig where nodeid = 5242881 or nodeid & 0xfff80000 = 5242881 ) begin print 'y' end
如按原文,1.应比二快才对.可是现在还是2比1 快.在于多扫了一次表(1)...
不解.