Chapter 45

Indexing Strategies

In This Chapter

Indexing for Improving Performance

Interpreting Query Execution Plans

Improving Database Strategy Performance

Over the years I've amassed a relatively large DVD collection. It's not a huge collection, but it can become somewhat painful when I have a movie I really want to watch and I need to find it among my other movies. What I should do is maintain my movie collection in a sorted order. This would make searching for a movie far less painful and much quicker. However, this approach is not without its own overhead. First, I'd have to perform one large sort of the movies (based on the movie title) and make sure I have them stored on my shelves based on a physical sorted order. This would be a relatively slow operation because I'd have to touch every DVD and move it around to make sure it is where it needs to be. There are, of course, numerous sorting algorithms I could use to perform this operation — but that is a story better discussed in a different book.

After I've performed my initial build of my sorted DVD collection, I then must maintain my list. Anytime I buy a new movie, I must make sure it is placed in the correct spot in the list. I must also make sure to remember to always insert movies that I've taken out into the proper spot on my shelf. This could be more overhead than I want to maintain in the long run, but it sure would make searching for a DVD when I want to watch it a lot easier.

This is similar to how indexes ...

Get Microsoft SQL Server 2012 Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.