Database updating statistics

There are multiple paths a database can use to answer a query, some of them being faster and more efficient than others.

It is the job of the query optimizer to evaluate and choose the best path, or execution plan, for a given query.

-Table had less than 500 rows and there is an increase of 500 rows or more since the last update -Table has over 500 rows and there is an increase of 500 20% of the table size since the last update Maintenance plan: You can also proactively update the statistics yourself using TSQL (sp_updatestats for all stats in a database or UPDATE STATISTICS for a single one) or a maintenance plan task.

This information is stored in a histogram; the histogram contains up to 200 steps with a lower and upper limit and contains the count of values that fall between both limits.Outdated statistics can lead the optimizer in choosing inefficient execution plan and can dramatically affect overall performance.Steps must therefore be taken in order to keep statistics up to date.To view this histogram, go to the details tab of the statistic’s properties or use the command DBCC SHOW_STATISTICS.The screenshot below shows the histogram of an index statistic; the RANGE_HI_KEY is the upper limit of the step, the RANGE_HI_KEY of the previous step 1 is the lower limit, and the RANGE_ROWS is the count of rows between the limits.