May 7, 2010 at 7:51 am
Hi, can any one tell me when we need to use recompile option in Stored proc ?
How can we figure out it ?
Is execution plan show any sign that SP needs recompilation?
-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
May 7, 2010 at 7:53 am
When the query(s) have no single optimal plan. One example is when you have severe parameter sniffing, data skew or similar.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
May 7, 2010 at 8:05 am
GilaMonster (5/7/2010)
When the query(s) have no single optimal plan. One example is when you have severe parameter sniffing, data skew or similar.
how do we come to know this ?
through exec plan ? how ? please explain or direct me to any link ?
-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
May 7, 2010 at 9:25 am
There is no hard and fast formula as in "You MUST use it here, you MAY NOT use it there." It's a case by case basis.
However, one general rule you could apply, if the procedure builds dynamic TSQL statements, then it might benefit from the recompile option.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply