Thursday, July 20, 2017
 
SQL Server Script Repository
Facebook Twitter LinkedIn Google+ Addthis
 
     
Term: Outdated Statistics
1 post(s)

SQL Script - Update Statistics in SQL Server

By Saleem Hakani on 8/24/2014

Statistics are important for query optimizer to generate optimal query plans. If you have outdated or stale statistics for your index then your query's performance will suffer. Therefore, it is important to update the statistics to make sure query optimizer always generates the best and optimal plan.

This script allows you to report and/or update outdated/stale statistics for either individual indexes or for all indexes in a databases and for all indexes across all user databases.

This script provides the following information:
1. Name of the Database
 2. Table Name
 3. Index Name
 4. Last date when Statistics was Updated
 5. Row Count of the Table
 6. Number of Rows Changed
 7. Percentage of Row Changes Occurred Since Last time Statistics were Updated
 8. Script for you to manually execute Update Statistics on individual objects

DBCC SHOWCONTIG
Outdated Statistics
SP_UpdateStats
Stale Statistics
Minimize
Script Categories
HOME   |   SQL ARTICLES   |   SCRIPTS   |   DISCUSSIONS   |   SQL TEAMS   |   JOBS   |   ABOUT US
Copyright [2014] by SQLCOMMUNITY.COM