Find Missing Table and Index Statistics
-
Posted on June 17, 2009 by Derek Dieter
-
0
Missing statistics can severely impact execution plan generation. If the statistics are out of date SQL Server will behave in bizarre ways. When this becomes the problem, it is very hard to troubleshoot because there are no physical indicators. Instead, everything just runs poorly. In order to find missing our out of date statistics, run the following:
[cc lang=”sql”]
SELECT
Last_Updated = STATS_DATE(si.id, si.indid)
,TableName = object_name(si.id)
,Name = RTRIM(si.name)
,Size = DATALENGTH (si.statblob)
FROM
sysindexes si WITH (nolock)
WHERE OBJECTPROPERTY(si.id, N’IsUserTable’) = 1
–AND INDEXPROPERTY (si.id , si.name , ‘IsAutoStatistics’ ) = 0
order by last_updated, tablename
[/cc]
- Comments (RSS)
- Trackback
- Permalink