Over in my GitHub repo, I’ve added a file that will create an Agent Job to update statistics using Ola Hallengren’s IndexOptimize script.
It’s something I hand out enough that I figured people might be interested in it. Currently, it’s not a default offering from Ola, it’s uh… custom code.
There are lots of people who should be using this, too.
Because index maintenance scripts don’t measure a generally useful KPI, and one of the main benefits of index rebuilds is the statistics update.
Some thing to keep in mind here:
- You need to be using a relatively new version of Ola’s scripts
- This script utilizes the
@StatisticsModificationLevelparameter, added 2018-06-16
- That parameter is currently set to 5, and you may need to change that depending on your environement
There are some things you’ll need to change in the script, if you’re doing anything really custom:
- It targets the master database
- It’s owned by the sa account
- It’s set to run at midnight
- It has no failure emails or alerts set up
This is a very vanilla starting place. It’s up to you to make it yours.
To report any issues with Ola’s scripts, head over to this GitHub repo.
To get the Agent Job script, head over to my GitHub repo
Thanks for reading!