patternsqlMajor
When To Update Statistics?
Viewed 0 times
statisticsupdatewhen
Problem
I've inherited a Maintenance Plans that does the following:
Of the 23 minute Maintenance Plan, Updating the Statistics takes a staggering 13 minutes. During this 13 minute period, access to the database is blocked (or at least, replication from this DB to our others is paused).
My Question Is:
When should we be Updating the Statistics, and why?
This seems like the kind of thing we should do less frequently than every day. I'm trying to get us out of the "just because" mind-set of doing unnecessary Maintenance.
- Cleanup old data
- Checks DB integrity
- Performs Database and Transaction Log Backups
- Reorganizes Our indexes
- Updates Statistics
- Delete old backups and Maintenance Plan files
Of the 23 minute Maintenance Plan, Updating the Statistics takes a staggering 13 minutes. During this 13 minute period, access to the database is blocked (or at least, replication from this DB to our others is paused).
My Question Is:
When should we be Updating the Statistics, and why?
This seems like the kind of thing we should do less frequently than every day. I'm trying to get us out of the "just because" mind-set of doing unnecessary Maintenance.
Solution
If you don't have the maintenance window for it, updating statistics daily is probably a little overkill. Especially if you have Auto Update Statistics turned on for the database. In your original post, you said that users are seeing a performance degredation due to this maintenance plan. Is there no other time to run this maintenance plan? No other window? I see that your plan encompasses index reorganization, when are you rebuilding indexes? When that operation happens, statistics are automatically updated (provided that isn't turned off for the index).
Exactly how often you should be updating statistics depends greatly on how much data modification your indexes and data is receiving. If there is very little modification (
One way to find out if your statistics are stale is to look at the execution plans and if you estimated rows greatly differ from your actual rows returned then that is a good indication that the interval needs to be upped. In your case, you're going the other way and a bit of trial may be in order for you. Update statistics weekly, and if you're starting to see the tell-tale signs of stale stats then go from there.
If you are using Auto Update Statistics for your database, see this reference for the threshold of when statistics are updated.
Exactly how often you should be updating statistics depends greatly on how much data modification your indexes and data is receiving. If there is very little modification (
INSERT, UPDATE, DELETE) to the data, then you could have a more infrequent schedule for the update statistics job.One way to find out if your statistics are stale is to look at the execution plans and if you estimated rows greatly differ from your actual rows returned then that is a good indication that the interval needs to be upped. In your case, you're going the other way and a bit of trial may be in order for you. Update statistics weekly, and if you're starting to see the tell-tale signs of stale stats then go from there.
If you are using Auto Update Statistics for your database, see this reference for the threshold of when statistics are updated.
Context
StackExchange Database Administrators Q#19130, answer score: 31
Revisions (0)
No revisions yet.