views:

67

answers:

1

Is there a quick and easy way to list when every index in the database last had their statistics updated? The preferred answer would be a query. Also, is it possible to determine the "quality" of the statistics: FULLSCAN, SAMPLE n, etc.

EDIT
this worked for what I needed, a slight mod to @OrbMan great answer...

SELECT
    STATS_DATE(i.object_id, i.index_id) AS LastStatisticsDate
        ,o.Name AS TableName
        ,i.name AS IndexName
    FROM sys.objects            o
        INNER JOIN sys.indexes  i ON o.object_id = i.object_id
    WHERE o.is_ms_shipped=0
    ORDER BY 1 DESC
+3  A: 

You can do: STATS_DATE ( table_id , index_id )

So:

USE AdventureWorks;
GO
SELECT 'Index Name' = i.name, 'Statistics Date' = STATS_DATE(i.object_id, i.index_id)
FROM sys.objects o
JOIN sys.indexes i ON o.name = 'Address' AND o.object_id = i.object_id;
GO

where Address is the name of the table whose indexes you would like to examine.

RedFilter
Works on my machine
Sung Meister