From the course: Developing Microsoft SQL Server 2016 Databases

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Obtain index statistics

Obtain index statistics

- [Instructor] When running a query we've seen the SQL server uses a query execution plan to determine the best way to perform the task. It evaluates all of the indexes available and takes a look at the underlying tables in order to make the determination. The key to knowing which index will perform the best lies in the Index Statistics. We can take a peek at these stats to better understand how a particular execution plan is chosen. First, I'm going to switch into the WideWorldImporters database by running lines two and three. Now in the last exercise we looked at an index on the Application.People table. To view the statistics for this index, go ahead and run this command that says DBCC show_statistics and then inside the parentheses we supply the two parameters first the name of the table; Application.People and then the name of the index, which is right here IX_Application_People_Perf_ and then that long number. Both of…

Contents