Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 sp_recompile on tables

Author  Topic 

mlike
Starting Member

3 Posts

Posted - 2013-07-21 : 12:47:24
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

30421 Posts

Posted - 2013-07-21 : 13:24:31
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

52326 Posts

Posted - 2013-07-22 : 02:51:10
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
   

- Advertisement -