The Query Optimizer uses statistics to create query plans to improve query performance and Statistics are one of the most important factors of a database because it contains information about how data is distributed in the database objects.The statistics provide the optimizer with clues on the best ways to process the query and consequently maximize performance.Expired statistics are one of the reasons for query to not perform well.

Through below query you are able to find out when your statistics was last updated.

USE AdventureWorks2012 GO SELECT name AS index_name,type_desc as index_type, STATS_DATE(OBJECT_ID, index_id) AS StatsUpdated FROM sys.indexes WHERE OBJECT_ID = OBJECT_ID('HumanResources.Employee') GO

Output:-

If your statistics is outdated and you want to update them, you can use the below query to update the statistics in SQL Server:-

USE AdventureWorks2012; GO UPDATE STATISTICS HumanResources.Employee WITH FULLSCAN GO

Please make sure that you should only run update statistics if you think they will benefit your query and when your server is not very busy. If you have already configured auto update statistics is On then SQL Server takes care of that and update the statistics when needed.

Now we can check that statistics has been updated or not on HumanResources.Employee table through below query.

USE AdventureWorks2012 GO SELECT name AS index_name,type_desc as index_type, STATS_DATE(OBJECT_ID, index_id) AS StatsUpdated FROM sys.indexes WHERE OBJECT_ID = OBJECT_ID('HumanResources.Employee') GO