SQL Server function intermittent performance issues
问题 We have a function in our database that searches two large tables to see if a value exists. It is a pretty large query, but it is optimized to use indexes and generally runs pretty fast. Three times over the past 2 weeks, this function decided to go haywire and run extremely slow, which causes deadlocking and bad performance all around. This happens even at times of less than peak usage. Rebuilding the function using "Alter Function" in SQL Server seems to take care of the issue. Once we do