Sql Server index statistics
Does the following seem normal for a histogram on an index?
开发者_StackOverflowHistogram Steps
RANGE_HI_KEY RANGE_ROWS EQ_ROWS DISTINCT_RANGE_ROWS AVG_RANGE_ROWS
2264548 0 1 0 1
2302473 36550 1 36550 1
2303523 767 1 767 1
2383218 77051 1 77051 1
2383219 0 1 0 1
The main point of interest for me is the RANGE_ROWS column it's split into 5 ranges for 114368 rows and two ranges have 99.3% of the rows in them. Is this normal. If not how can I fix this?
Without knowing anything about your data (amount of data, how it's distributed etc.), there's really not much to be said about those histogramm values.
But in order to have up to date statistics on your tables, use
UPDATE STATISTICS (tablename)
See the MSDN docs for the command here. This will bring your stats up to date.
Why don't you run that command on this table in question, and see how the index histogramm looks after you've explicitly updated the statistics on the table?
In order to make your life easier, I'd suggest creating a nightly maintenance job that will run and update the statistics as needed. Check your SQL Server Books Online for the concepts and details about maintenance jobs.
精彩评论