From the course: SQL Server 2014: Installation and Administration

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Using indexes to improve query performance

Using indexes to improve query performance - SQL Server Tutorial

From the course: SQL Server 2014: Installation and Administration

Start my 1-month free trial

Using indexes to improve query performance

- So what is an index? The standard metaphor are a phone book and a Rolodex or a library index card. Anyway, think of it this way, so I have a collection of three by five cards and I shuffle them up and I dump them down and now I want to find somebody. What you have then is my desk. What I should have done was taken them and put them in order so now I can find them much quicker and that's what an index is. I think everybody understands that. Now does SQL always use an index if it's available? So think this over again and let's say I have a table of data and I have 100 rows in there, 1,000 rows, I don't care. And there is an index that has this information sorted. Will SQL use that index if it's available and the answer is, of course, no. SQL may use the index. The Query Optimizer uses an algorithm that look at the query, then to look at the data and makes the decision if the indexes are the most optimal way of retrieving the information. Sometimes, actually many times SQL will make…

Contents