Statistics and sql server. When people ask me what are statistics I answer with a Google maps analogy: while we know the roads are there, the traffic changes and, therefore, in the same way we know it is best to patiently wait for the traffic to get updated before choose what route to take, we have to give sql server a way to keep up with the data present in the tables. I choose to have all statistics updated at a fixed time – 7 pm actually – unless there are large loads overnight. If that is the case then the job runs after the loads.
This is the sql I use for updating statistics. As you can see, it does reference other objects and while I’ll eventually get to sharing, it won’t run properly without them. Why a custom procedure? Check out what these smart people say:
What I got from these posts is don’t run the default procedure because it’ll reread your data and items will get updated which don’t need attention. That sounds inefficient. What I also wanted was logging to see what was requiring updates and avoid blocking. I include an input parameter to give the count of objects requiring updates in case I am curious.