小编dex*_*xon的帖子

执行计划 - 由于 ISNULL 而不使用索引查找

我有一个我想要改进的程序,它使用这个 where 子句:

WHERE   p.PlatformId = ISNULL(@PlatformId, p.PlatformId)
and p.PayeeStsId     = 1
and p.PlatformPayeeId   = ISNULL(@platformPayeeId, p.PlatformPayeeId)
and pba.PayeeBankStsId=1
and a.Gcid = ISNULL(@Gcid, a.Gcid)
Run Code Online (Sandbox Code Playgroud)

ISNULL给我使用索引带来了问题,我怎样才能避免使用这种格式ISNULL

p.PlatformId = ISNULL(@PlatformAccountId, p.PlatformId)
Run Code Online (Sandbox Code Playgroud)

这种格式导致执行计划进行索引扫描。

sql-server performance-tuning

2
推荐指数
1
解决办法
300
查看次数

标签 统计

performance-tuning ×1

sql-server ×1