r u asking about the
WITH RECOMPILE option that prevents reusing the stored procedure execution plan
Main Topics
Browse All TopicsHI, what is the stored proc that updates the execution plan?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
"Reusing an execution plan saves the time spent on the stored procedure compilation, but in many queries, especially complex joins on large tables, the compilation time is significantly less than the time needed for execution. Therefore, you may need to recompile the stored procedure execution plan to increase the chance that the best plan be used. There are three ways to cause SQL Server to recompile the stored procedure execution plan:
Including a WITH RECOMPILE clause in a CREATE PROCEDURE statement. When you include a WITH RECOMPILE clause in a CREATE PROCEDURE statement, SQL Server will not cache a plan for this procedure and the procedure will be recompiled every time it runs. Since the stored procedure execution plan will never be cached, you should use the RECOMPILE option in a CREATE PROCEDURE statement very carefully.
Including a WITH RECOMPILE clause in a EXECUTE statement. When you include a WITH RECOMPILE clause in a EXECUTE statement, the stored procedure execution plan will be recompiled when you run this EXECUTE statement. You can use this option if the parameters you are supplying are atypical or if the data has significantly changed.
Using the sp_recompile system stored procedure causes stored procedures to be recompiled the next time they are run. To cause stored procedures to be recompiled the next time they are run, you can use the sp_recompile system stored procedure. You can use the sp_recompile system stored procedure when you want your stored procedure to reflect changes in indexes or data values.
Because SQL Server 2000 can recompile stored procedures and execution plans automatically, in most cases it is not necessary to use the sp_recompile system stored procedure or a WITH RECOMPILE clause, and you can rely on SQL Server decisions to recompile the execution plan."
http://www.databasejournal
There are many thing that can cause a stored procedure to run slow!
Was it run fast before? Is there lots of activity on referenced tables\indexes? are there many users? Many sessions?
Business Accounts
Answer for Membership
by: gkernPosted on 2009-01-07 at 05:33:55ID: 23314362
What?