33.16. Update Statistics
This is going to sound obvious, but the optimizer cannot work without valid statistics. Some signs that your statistics need to be updated are:
Two queries with the same basic structure have different execution times. This usually means that the statistical distribution has changed, so one of the queries is being executed under old assumptions.
You have just loaded a lot of new data. This is often a good time to do the update to the statistics, because some products can get them as part of the loading operation.
You have just deleted a lot of old data. Unfortunately, deletion operations do not change statistics like insertions.
You have changed the query mix. For example, the end-of-the-month reports depend on shared views ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access