SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 sp_recompile on tables
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mlike
Starting Member

USA
3 Posts

Posted - 07/21/2013 :  12:47:24  Show Profile  Reply with Quote
Hello -

After we deploy to prod, we notice that sometimes stored procedures are running slow. After we run sp_recompile, then the run normal. We are thinking about proactively running sp_recomile on on all tables that will be modified during a deployment. Are their potential negative consequences to this? If 50 stored procs reference a table, then all 50 of those procs will then be marked for recompile, and will be recompiled on next execution, correct? Also, if the parms going into any of those procs start to vary outside of their normal bounds, will this have a negative impact on performance?

Thank you in advance!


mlike

SwePeso
Patron Saint of Lost Yaks

Sweden
30187 Posts

Posted - 07/21/2013 :  13:24:31  Show Profile  Visit SwePeso's Homepage  Reply with Quote
sp_recompile does not "recompile" tables. It flushes the current execution plan(s) and stores a new one.
However, DBCC UPDATESTATS will update statistics on a table or index and recompile all procedures referencing to this table or index.



Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 07/22/2013 :  02:51:10  Show Profile  Reply with Quote
The reason why you see intermittent bad performance may be due to bad plan being cacahed for the procedures. Are your procedures parameterized. I think this may be one of the causes for the bad plan

https://www.simple-talk.com/sql/t-sql-programming/parameter-sniffing/

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000