Statistics are one of the most important factors of a database as it contains information about how data is distributed in the database objects (tables, indexes etc). It is quite common to listen people talking about not optimal plan and expired statistics. Quite often I have heard the suggestion to update the statistics if query is not optimal. Please note that there are many other factors for query to not perform well; expired statistics are one of them for sure.
If you want to know when your statistics was last updated, you can run the following query.
SELECT name AS index_name,
STATS_DATE(OBJECT_ID, index_id) AS StatsUpdated
WHERE OBJECT_ID = OBJECT_ID('HumanResources.Department')
If due to any reason you think that your statistics outdated and you want to update them, you can run following statement. In following statement, I have specified an additional option of FULLSCAN, which implies that the complete table is scanned to update the statistics.
UPDATE STATISTICS HumanResources.Department
Please note that you should only run update statistics if you think they will benefit your query and when your server is not very busy. If you have auto update “usually” on, the SQL Server takes care of updating stats when necessary. Here, is a quick example where you can see the updating of older statistics using fullscan.
Statistics is very deep subject, and a lot of things can be discussed over it. We will discuss about many other in-depth topics in some other article in future.
Reference: Pinal Dave (http://blog.SQLAuthority.com)