Determine when was Statistics last updated on your Table

The STATS_DATE gives back the date specifying when was the statistics for the specified index last updated.

You can use the following query to get the last updated date of Statistics for the object

USE Northwind
SELECT [name] AS 'Statistic',
STATS_DATE(object_id, index_id) AS 'Last Updated Statistics Date'
FROM sys.indexes
WHERE object_id = OBJECT_ID('Customers');
GO

The query returns NULL in case of an error or if the caller lacks permissions to view the object.

If you need to study more on Statistics, check this link


About The Author

Suprotim Agarwal, MCSD, MCAD, MCDBA, MCSE, is the founder of DotNetCurry, DNC Magazine for Developers, SQLServerCurry and DevCurry. He has also authored a couple of books 51 Recipes using jQuery with ASP.NET Controls and a new one recently at The Absolutely Awesome jQuery CookBook.

Suprotim has received the prestigous Microsoft MVP award for nine times in a row now. In a professional capacity, he is the CEO of A2Z Knowledge Visuals Pvt Ltd, a digital group that represents premium web sites and digital publications comprising of Professional web, windows, mobile and cloud developers, technical managers, and architects.

Get in touch with him on Twitter @suprotimagarwal, LinkedIn or befriend him on Facebook

No comments: