Wednesday, 9 May 2012

What is Indexing in a Database

You keep wondering why you need to set those indexes on databases columns?

Well here is a little insight into that.

Lets say you boss comes up and gives you a bunch of resumes for some 100 candidates.
What is the first thing you will do?
Well atleast I will get a cabinet and put them in folders with  some thing like Last Names from A-D in one folder, E-H in another folder etc.

Ok that work is done.
My boss comes back and says he want all the candidates with OBIEE experience.
Not that easy, but I will try coming up with an easy way so next time I don't shuffle through all the 100 resumes again.

I will have Card separators in each folder i.e Lets say the A-D folder I will arrange the A-D Last name candidates grouping them there technology experience.

So Next time my boss comes up  and asks me for the list of  candidats with Open-Systems experience, I just have to go through each main folder labeled with A-D, E-H etc and pull out the bunch of resumes under the section Open-Systems or OBIEE which ever he asks  for.
So instead of searching through 100 resumes I just need to search under 6 Folders and pull out the relevant technology resume bunch.

So that is  how indexing works in databases to improve the overall performance of  SQL Queries.
Next time when you are asked to index, now you know that you should be indexing on
LastName and Technology columns instead of  Age or other irrelevant columns which does not help the SQL Queries.

No comments:

Post a Comment