From the course: SQL Server 2022 Administration
Unlock this course with a free trial
Join today to access over 24,700 courses taught by industry experts.
Use index statistics - SQL Server Tutorial
From the course: SQL Server 2022 Administration
Use index statistics
So in this lesson, we want to take a look at index statistics. Now indexes, clustered and non-clustered indexes, are used to help improve the performance of your queries and your SQL Servers. With statistics that's information that the index tracks about your tables to help it make decisions about which indexes to use and how to go about getting your data. Now, in general, these are updated automatically and you don't have to worry about them too much, but sometimes they get out of whack and you need to know what they are, how to look at them, and how to rebuild them if need be. So let's take a look at just that. So here I've got just some sample code and we're going to walk through what all this does. So before we get started, I want to turn off updating statistics for this particular index so that we can kind of mess around with the statistics on our own. So to do that, I'm going to expand the database. I'm going to go down to the OrdersCopy table, which is the table this is in, and…