Hi Guys,There is a scalar function inside a stored procedure. When the proc is called once, this function is executed multiple times (execution_count on one SP call is close to 2 Million) and the procedure overall execution time is taking longer and the cpu usage is high when this SP is called multiple times during the same time.Tried to simulate this issue on a different environment with one day old data and the execution count of the function in one procedure call is 4500 which is much different.The associated tables called from the function has no fragmented indexes and no outdated stats.Cleared the plan cache/recompile the proc/function didn't help. Also cleared the procedure cache by running DBCC FREEPROCCACHE which didn't help either. Sometimes after running DBCC FREEPROCCACHE the proc execution is faster.Can you guys share your thoughts on how to troubleshoot this. Many thanks in advance!
↧