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 2005 Forums
 Transact-SQL (2005)
 sp_updatestats Question

Author  Topic 

denis_the_thief
Aged Yak Warrior

596 Posts

Posted - 2009-11-19 : 11:30:49
If I understand correctly, running sp_updatestats will help SQL server make better descisions in terms for accessing the data quicker. And that SQL server will only update Execution Plans during compilation.

Does that mean running sp_updatestats is pointless unless we flag Stored Procedures for re-compile afterwards (with sp_recompile)? Is sp_recompile pointless without first running sp_updatestats.

(I wasn't sure if this should have been posted in the Database Administration forum - to me it is both Database Administration and T-SQL)

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-11-19 : 11:32:57
No and no.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

denis_the_thief
Aged Yak Warrior

596 Posts

Posted - 2009-11-20 : 10:41:31
quote:
Originally posted by tkizer

No and no.



Hmmmm?

quote:

Does that mean running sp_updatestats is pointless unless we flag Stored Procedures for re-compile afterwards (with sp_recompile)?



I can see this being a 'no' if there is dynamic SQL in the Stored Proc or in the case of writing ad-hoc SQL. Otherwise I think it would be pointless.


quote:

Is sp_recompile pointless without first running sp_updatestats.



OK, I see why that is a 'no', SQL Server updates the statistics automatically periodically as rows inserted/modified/deleted.
Go to Top of Page
   

- Advertisement -