Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
SQL Server 2008 - General
»
Please explain the difference between...
Please explain the difference between "Parameter Sniffing and With Recompile"
Rate Topic
Display Mode
Topic Options
Author
Message
riddhi.mishra1
riddhi.mishra1
Posted Tuesday, November 06, 2012 4:00 AM
Forum Newbie
Group: General Forum Members
Last Login: Monday, March 11, 2013 1:17 AM
Points: 1,
Visits: 22
[size="5"][/size]
Post #1381479
bleroy
bleroy
Posted Tuesday, November 06, 2012 4:23 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 4:59 PM
Points: 137,
Visits: 546
With recompile, you are telling SQL Server to throw away the existing query plan and build another one but only for this once.
With parameter sniffing, the optimizer pretends that the values passed to the stored procedure (the first time?) are fixed and uses those for the query plan stored in the cache. This may be useful is the values passed are appropriate, but if the first time you run the SP, and the values passed are 'extra-ordinary' then you will be storing an inefficient query plan and your performance will suffer.
See
http://blogs.technet.com/b/mdegre/archive/2012/03/19/what-is-parameter-sniffing.aspx
for more on parameter sniffing.
HTH,
B
Post #1381485
GSquared
GSquared
Posted Tuesday, November 06, 2012 7:40 AM
SSCoach
Group: General Forum Members
Last Login: Monday, May 06, 2013 1:09 PM
Points: 15,439,
Visits: 9,569
There's a very good article on Gail Shaw's blog:
http://sqlinthewild.co.za/index.php/2007/11/27/parameter-sniffing/
Read that and see if it answers your questions. It's quite helpful to most people with questions about these things.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Post #1381567
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.