Indexes and table Statistics play a big role in an OLTP database for better query performance. Maintaining statistics on a weekly basis is important but a heavily updated database tables need more emphasis on Statistics and frequent updates. Instead of trying to issue “sp_updatestats” for the entire database, you can choose tables which are heavily updated and maintain them as needed.
The following script (stored procedure) is useful in getting the information what tables are updated and how many rows are updated since last stats update. The script also generates script to run on the databases to update statistics for the tables, which have out-of-date statistics.
Harnessing SQL Server Metadata- Disabling and Rebuilding Indexes
When doing bulk data changes it may be beneficial to disable indexes prior to starting the operation. Fortunately, SQL's rich metadata makes this very easy to automate in a robust fashion.
2018-05-18 (first published: 2015-10-19)
4,845 reads