深入浅出解析mssql在高频,高并发访问时键查找死锁问题(2)
a.2 根据查询需求,分步执行,通过聚集索引获取查询列,避免键查找. declare @cont2 char(3000)declare @clskey intwhile 1=1begin select @clskey=clskey from testklup where nlskey=1 sel
a.2 根据查询需求,分步执行,通过聚集索引获取查询列,避免键查找.
declare @cont2 char(3000) declare @clskey int while 1=1 begin select @clskey=clskey from testklup where nlskey=1 select @cont2=cont2 from testklup where clskey=@clskey end
b 通过改变隔离级别,使用乐观并发模式,读操作时源行无需锁
declare @cont2 char(3000) while 1=1 begin select @cont2=cont2 from testklup with(nolock) where nlskey=1 end
结束语.我们在解决问题时,最好弄清问题的本质原因,通过问题点寻找出适合自己的环境的解决方案再实施.
精彩图集
精彩文章