• Sean Pearce (7/5/2013)


    Hi,

    Stats are stored in a binary large object called a statsblob. These are very small, even with very large tables, and you will not find any performance gains by cleaning them up.

    You can see the blob by using a DAC to run the following code.

    SELECT

    OBJECT_NAME(s.object_id),

    s.name,

    DATALENGTH(o.imageval) / 1024. AS StatsSize_Kb

    FROM

    sys.stats AS s

    INNER JOIN

    sys.sysobjvalues AS o

    ON s.object_id = o.objid

    AND s.stats_id = o.subobjid

    WHERE

    OBJECTPROPERTY(s.object_id, 'IsSystemTable') = 0

    ORDER BY

    3 DESC;

    Great! Thank you, I will add this script to my library.

    I actually did a check; measured free space in my db files before and after dropping duplicate statistics and found the space savings to be indeed very small, of the order of 1 MB on my 100-GB database.

    Having said that, don't the duplicate stats add overhead to update-stats operations? For example, if a large table has duplicate stats and one performs an "UPDATE STATISTICS .. WITH FULLSCAN" on it, then the performance of this operation would be expected to improve after dropping the duplicate stats.

    Any thoughts on that?

    Thanks again for the input!

    __________________________________________________________________________________
    SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
    Persisting SQL Server Index-Usage Statistics with MERGE[/url]
    Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]