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
 Other SQL Server Topics (2005)
 SP_Updatestats

Author  Topic 

raguyazhin
Posting Yak Master

105 Posts

Posted - 2010-09-29 : 04:24:56
Why We Use Sp_Updatestats in Database


Thanks in advance
Ragu Thangavel

mfemenel
Professor Frink

1421 Posts

Posted - 2010-09-29 : 05:56:08
Here is the condensed version. The stats give sql server the information it needs in order to determine the best execution plan for a query. Imagine a table with 10 rows in it. SQL Server could pretty efficiently do a table scan on that and move on. Now imagine that same table gets an insert of 10 million rows. That same table scan may no longer be the most efficient way to query the data in that table. It might be faster (and probably is) at that point to do a form of index seek if your query is specific enough. The update stats procedure essentially tells sql server "go reevaluate the data in this table and update your information about it" so that sql server can be more accurate in generating it's execution plan to query the data.

Mike
"oh, that monkey is going to pay"
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-09-29 : 06:04:10
http://sqlinthewild.co.za/index.php/2008/11/04/what-are-statistics-and-why-do-we-need-them/

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -