SQL Server Performance

Using Statistics

Discussion in 'SQL Server 2005 Performance Tuning for DBAs' started by avdhoot_saple, Apr 18, 2007.

  1. avdhoot_saple New Member

    I am able to collect and display statistics using sp_createstats and DBCC SHOW_STATISTICS, but I need to use those values for some calculations. Is there any way by which I can query those values to extract them ? or is there any table where those values are stored ?
  2. MohammedU New Member

  3. joechang New Member

    explain in more detail
    you probably will have to use the options below:

    DBCC SHOW_STATISTICS ( 'table_name' | 'view_name' , target )
    WITH STAT_HEADER | DENSITY_VECTOR | HISTOGRAM

    basically, run each option, inserting results into a table,
    then query it
    this is not a cheap option
  4. avdhoot_saple New Member

    Hi joechang,

    for instance i am running

    DBCC SHOW_STATISTICS('Employee', sample_stat) WITH DENSITY_VECTOR

    where Employee is my table name and sample_stat is my statistic name (basically the index).
    The result of this is displayed in the results window but it gets stored in form of a blob in the sysindexes table and hence i cannot query it. I was keen to know whether there is any method by which i can access the results by querying them (since i dont get anything from the blob entries)
  5. satya Moderator

    Visit the following link for code samples andhttp://www.microsoft.com/usa/webcasts for the webcasts. If not you can use XML to display the relevant data, as explained there is no easy way.

    Satya SKJ
    Microsoft SQL Server MVP
    Writer, Contributing Editor & Moderator
    http://www.SQL-Server-Performance.Com
    This posting is provided AS IS with no rights for the sake of knowledge sharing. The greatest discovery of my generation is that a human being can alter his life by altering his attitudes of mind.

Share This Page