• 2ndHelping (9/21/2012)


    Yes, if you rebuild an index, then the stats for the associated columns do get automatically updated in a manner equivalent to fullscan. (Although if your only goal is to update stats themselves, then doing an update stats with fullscan usually incurs much more overhead than necessary; and unless you have some "unique" situation with some of your queries, the sp_updatestats command is sufficient in most cases to keep your stats current.)

    However, to your other point, SQL Server maintains NO statistics for columns that are not part of any index, unless you create your own custom statistics with the "CREATE STATISTICS" command. Check Books Online, etc. for details.

    2ndHelping (9/21/2012)


    Yes, if you rebuild an index, then the stats for the associated columns do get automatically updated in a manner equivalent to fullscan. (Although if your only goal is to update stats themselves, then doing an update stats with fullscan usually incurs much more overhead than necessary; and unless you have some "unique" situation with some of your queries, the sp_updatestats command is sufficient in most cases to keep your stats current.)

    However, to your other point, SQL Server maintains NO statistics for columns that are not part of any index, unless you create your own custom statistics with the "CREATE STATISTICS" command. Check Books Online, etc. for details.

    Thank you for the clarification...I guess I was looking at the process as how do I get the best bang for the buck from a limited maintenance window.

    For a given table...

    I determine which indexes need to be rebuilt then the stats are updated as well with 100% sample size...for the given columns of the said indexes.

    To your point all it looks like sp_updatestats does is actually execute UPDATE STATISTICS ALL under the covers with either the default sample size or a defined sample size.

    Also, based on BOL, it says that sp_udatestats won't re-update the same stats just updated when a ALTER INDEX - REBUILD command occurs...but I can't find that same claim against UPDATE STATISTICS...

    Would you say it is safe to assume that the same logic would hold true for UPDATE STATISTICS?

    If that is the case would it be advisable to:

    Blanket run UPDATE STATISTICS WITH FULLSCAN, ALL (which I would presume would do a full scan against each column in the table that had NOT already had the stats updated with the index rebuild)

    OR

    Figure out what the names are of the system generated statistics and then build a process to roll through them and update each one individually with a FULLSCAN?

    update statistics [dbo].[table_A](_WA_Sys_00000001_3F954511) with fullscan

    I suppose the answer is...it DEPENDS lol...

    Any input is appreciated!