sqlrx logo
SQLRx® Tip of the Month
 

June 2011
Greetings!
  
  
Your SQL database uses statistics to choose the most efficient plan for retrieving or updating data, so you want them accurate and up-to-date. Otherwise, it can cause the SQL Server engine to take the wrong path, and taking the wrong path means slower performance. Check out the code below to see when your stats were last updated.
 
If you need help with SQL server, please contact me. It's also good practice to regularly monitor the 11 VitalSigns used by SQLRx to debug performance bottlenecks.
SQL 2008     

SQL Server Administration Find out when statistics were last updated.   Out of date statistics are a common cause of poor performance.  Tables that are active should have statistics updated regularly.  Use the query below to find out if your databases have old statistics. 

 

 

USE <<database>>

GO

-- find last time when stats had been updated.

SELECT object_id AS [TableId], index_id AS [IndexId], OBJECT_NAME(object_id) AS [TableName], name AS [IndexName], stats_date(object_id,index_id) stat_update_date, INDEXPROPERTY(object_id, name,'IsAutoStatistics') is_system_generated_stats

FROM sys.indexes WITH (NOLOCK) OPTION(MAXDOP 1)

GO

________________________________________________________________________________
You can access SQLRx training videos at www.msdev.com, a Microsoft training site!  Check the site periodically to view new training videos.
 
If you have a SQL question you'd like us to answer, and possibly use for the next SQLRx Tip of the Month or msdev video, email it to us!  If you missed any of our previous tips, you can view them here.

For assistance or more information on optimizing your SQL Server Environment, visit us at www.sqlrx.com or email Lori Brown at lorib@isi85.com.


Sincerely,

Lori Brown | SQLRx Senior Consultant | Integrated Services, Inc.
4144 N. Central Expwy, Suite 430  |  Dallas, TX  75204
Phone: 214.526.7680 x 113 | lorib@isi85.com 

 

 

Integrated Services, Inc.                                    
2008 winner logo small
Turning Data Into Profit

 

25 Years of Credibility & Trust

 

Join our email list          Check out our events          SQLRx Downloads