Hi,
I'm rewriting a stored procedure at work, primarily to stop it from doing dirty reading and have not made any significant structural changes. However, running the new version against the current version I have found the new version to run almost twice as long on a dev database which doesn't have a lot of activity!
Following the advice from this site: http://www.sql-server-performance.com/articles/per/optimizing_sp_recompiles_p1.aspx I used profiler to see what was happening and to my surprise there are a lot of "Cache Remove" for the new version but none for the current version!
Can anyone tell me what triggers the cache to be dropped?
I have all the temp table definition and index building up front (though the textbook says building indicies after INSERTs are generally better I've experimented with this approach and found that the sproc actually runs slower); and I've not made any schema changes to any referenced objects.
Thanks,