sp_updatestats
-- Update statistics for the entire database using the default method EXEC sp_updatestats;
rows
rows_sampled
-- Table Statistics UPDATE STATISTICS TableName WITH FULLSCAN; --Example UPDATE STATISTICS AuditLog WITH FULLSCAN; --T-SQL to Check Table Statistics SELECT sp.stats_id, name, filter_definition, last_updated, rows, rows_sampled, steps, unfiltered_rows, modification_counter FROM sys.stats AS stat CROSS APPLY sys.dm_db_stats_properties(stat.object_id, stat.stats_id) AS sp WHERE stat.object_id = OBJECT_ID('AuditLog');
-- Index Statistics UPDATE STATISTICS TableName IndexName WITH FULLSCAN;
-- Update statistics for the entire database using FULLSCAN EXEC sp_msforeachtable 'UPDATE STATISTICS ? WITH FULLSCAN';
-- Update Database statistics with a specified sample size EXEC sp_msforeachtable 'UPDATE STATISTICS ? WITH SAMPLE 50 PERCENT';