Slow query with cfqueryparam searching on indexed column containing hashes

后端 未结 3 413
北海茫月
北海茫月 2020-12-04 02:27

I have the following query that runs in 16ms - 30ms.


    SELECT hash FROM jobs WHERE hash in(
           


        
3条回答
  •  离开以前
    2020-12-04 03:06

    As Mark points out it is is probably got a bad execution plan in the cache. One of the advantages of cfqueryparam is that when you pass in different values it can reuse the cached plan it has for that statement. This is why when you try it with a smaller list you see no improvement. When you do not use cfqueryparam SQL Server has to work out the Execution Plan each time. This normally a bad thing unless it has a sub optimal plan in the cache. Try clearing the cache as explained here http://www.devx.com/tips/Tip/14401 this hopefully will mean that the next time you run your statement with cfqueryparam in it'll cache the better plan.

    Make sense?

提交回复
热议问题