About Me

Barking, Essex, United Kingdom
MCITP DBA ,MCITP BI & Oracle OCP 11G

Wednesday, September 30, 2015

Statistics Out of date


SELECT sp.stats_id,
       name,
       filter_definition,
       last_updated,
       rows,
       rows_sampled,
       steps,
       unfiltered_rows,
       modification_counter
FROM sys.stats AS stat
     CROSS APPLY sys.dm_db_stats_properties(stat.object_id, stat.stats_id) AS sp
WHERE stat.object_id = OBJECT_ID('tablename');
 
view statistics data
  • Stats_ID: It is the unique ID of the statistics object
  • Name: It is the statistics name
  • Last_updated: It is the date and time of the last statistics update
  • Rows: It shows the total number of rows at the time of the last statistics update
  • Rows_sampled: It gives the total number of sample rows for the statistics
  • Unfiltered_rows: In the screenshot, you can see both rows_sampled and unfiltered_rows value the same because we did not use any filter in the statistics
  • Modification_counter: It is a vital column to look. We get the total number of modifications since the last statistics update

No comments:

Post a Comment