Monday 29 April 2013

SQL Server - Find last time STATISTICS updated - update statistics

Maintaining statistics is an important factor for SQL Server performance. Accurate information allows SQL Server to make more effective decisions on how  to execute SQL Server code.
The SQL Server optimizer uses cardinality estimations as part of the decision making process. If inaccurate data distribution statistics exist for a table or index, then the Optimizer will make inefficient decisions
To find out the last time statistics were updated on a table or index , use the sys.stats view. This view has a row for each statistic of a tabular object.
The sys.stats view does not provide histogram data. You’ll need to use DBCC SHOW STATISTICS .


 
use db_name
go
DBCC SHOW_STATISTICS('a_table',a_statistic)

No comments:

Post a Comment