• Gregory, nice script. But I have some suggestions:

    1. When you rebuild an index then statistics are updated with FULL SCAN, so it's not necessary and even harmful to run sp_updatestats afterwards since it will update stats with some sample rate.

    2. I'm not sure about best practise but instead of rebuild/reorganize all indexes and then update all statistics, I would prefer to do it table by table. It makes more sense in terms of performance. For the server it's easy to do an update stats while some of the indexes are still cached rather than reading everything from disk again after rebuilding all the indexes for the DB.


    Alex Suprun