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:
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
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
No comments:
Post a Comment