Hi there....
Really appreciate some guidance.
I have a stored procedure with 3 parameters. This stored procedure executes 10x per minute. Average row return is less than 100.
Over Time, this STP gets slower and slower and eventually, I need to kill the PROC STORE that holds this execution plan using SP_BLITZCACHE and DBCC FREEPROCE....
Once I remove this STP from PROC CACHE, the STP runs quickly again. half a second versus 8 seconds.
When I compare the execution plan - the one that take 8 seconds (from PROC MEMORY), the plan shows it is doing an INDEX SCAN (NON CLUSTERED)
Using DBCC FREEPROCCACHE ID_from Blitzcache, I clear the execution plan from memory, then run the STP, and it is doing a CLUSTERED INDEX SCAN.
I have zero ideas why the execution plan is changing. Can anyone chime in and point me in the right direction as to how I can fix...