There is a function that is used by many people and sometimes it is terribly dull.
If I create a copy of this function and execute it exclusively for myself in the request where the original function fails, the request is executed instantly, and if it’s 2 minutes from the old one.
What could be the problem?
Does MS SQL have any object level locks?
Query plans are built identical.
Inside the function, all sorts of connections with tables are executed, and so on.
Could it be that the old function used some old statistics on the tables, and the new function received updated statistics and works faster?
UPD
It looks like it's not statistics. If I change the functions in places, then my newly compiled procedure starts to blunt, and the old procedure works fine ...
DBCC FREEPROCCACHE- helps? - PashaPash ♦