SQL Server Performance

How to know the statistics are upto date.

Discussion in 'Performance Tuning for DBAs' started by haridba, Oct 11, 2007.

  1. haridba New Member

    Hi Guys
    How to know the statistics on tables and indexes are upto date.
    Thanks in advance.
  2. MichaelB Member

  3. Luis Martin Moderator

    SELECT 'Index Name' = i.name,
    'Statistics Date' = STATS_DATE(i.id, i.indid)
    FROM sysobjects o, sysindexes i
    WHERE o.name = 'your table' AND o.id = i.id
  4. ranjitjain New Member

    When you execute sp_updatestats, it actually shows you whether any updates on statistics happened or not under Messages tab
  5. MichaelB Member

    How do you know if the optimizer thinks it is out of date (date means very little sometimes) and how can you reach this info programtically rather than seeing it in the showplan? I am looking for a job I could run that some t-sql, loop thru stats for each table (or DMV) and tell me what the optimizer thinks needs a look?
  6. satya Moderator

    This is where it lacks on SQL 2000, with 2005 yes you can hand in with DMVs.

Share This Page