Wednesday, December 2, 2009

Methods to find table INDEX or Statistics age for better performance

Original Post

 
SELECT OBJECT_NAME(tbl.object_id),
'Index Name' = ind.name ,
'Statistics Date' = STATS_DATE(ind.object_id, ind.index_id)
FROM SYS.INDEXES ind
INNER JOIN SYS.TABLES tbl
ON tbl.OBJECT_ID = ind.object_id
WHERE tbl.TYPE = 'U'

--USE babu;
--GO
--EXEC sp_updatestats --To update all STATISTICS in the DB

No comments: