![]() ![]() For more information about disabling and re-enabling statistics updates, see Statistics. For databases with a compatibility level of 90 or higher, sp_updatestats does preserve the latest NORECOMPUTE option for specific statistics. A recompilation would be unnecessary in these cases even if statistics are updated.įor databases with a compatibility level below 90, executing sp_updatestats does not preserve the latest NORECOMPUTE setting for specific statistics. However, sp_updatestats might not cause a recompile, if only one query plan is possible for the tables referenced and the indexes on them. Sp_updatestats can trigger a recompile of stored procedures or other compiled code. Therefore do not execute sp_updatestats more than necessary. Statistics on memory-optimized tables are always updated when executing sp_updatestats. Sp_updatestats updates statistics on disabled nonclustered indexes and does not update statistics on disabled clustered indexes.įor disk-based tables, sp_updatestats updates statistics based on the modification_counter information in the sys.dm_db_stats_properties catalog view, updating statistics where at least one row has been modified. When the update is completed, it reports that statistics have been updated for all tables. sp_updatestats displays messages that indicate its progress. Sp_updatestats executes UPDATE STATISTICS, by specifying the ALL keyword, on all user-defined and internal tables in the database. The resample argument is varchar(8) with a default value of NO. If 'resample' is not specified, sp_updatestats updates statistics by using the default sampling. Specifies that sp_updatestats will use the RESAMPLE option of the UPDATE STATISTICS statement. Transact-SQL syntax conventions Syntax sp_updatestats 'resample']Ġ (success) or 1 (failure) Arguments 'resample' For more information about statistics, see Statistics. ![]() Runs UPDATE STATISTICS against all user-defined and internal tables in the current database.įor more information about UPDATE STATISTICS, see UPDATE STATISTICS (Transact-SQL). Applies to: SQL Server Azure SQL Database
0 Comments
Leave a Reply. |