![]() If I know that a particular statement always returns the same number of rows and uses the same plan (and, I’d know this from testing), then I’ll create the stored procedure normally and let the plan get cached. ![]() Here’s the way I think about stored procedures and recompilation: Personally, I think that developers that know the data and know the application – will be a lot better at creating the RIGHT code especially when they understand all of the options available to them. Now, the other two questions – these are a lot more interesting and this is where I think that stored procedures should be used. If I go back and execute without the OPTION (RECOMPILE) then I will get the prior plan (to use the index). And, it will NOT affect future executions. It was used solely for the execution with OPTION (RECOMPILE). Using the same statement, I’ll again query the plan cache:Įven though this is the third time we have executed this statement, this final execution was NOT put in cache. I’ll go with answering #3 first as that one is easy to answer.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |