Database Indexing as Easy as Fruits and Vegetables?
John Snyder, DTR, RD
Have you or anyone
you know at work ever said, “Why is this report taking so long to run?” or
“Why is it taking so long to find this patient record?” It is possibly
because of indexing or lack thereof. So, what is an index?
administrators or developers and they most likely will answer that “indexes
create groups of like data in a database.” (LOL...clear as mud right?) Think
about it like this. Imagine you walk into the fruit and vegetable section
at your local grocery store to buy five plums. At the
grocery store, all the fruits and vegetables are just mixed together on a
table, and you need to go through each piece and determine if it is a plum
before putting it in your cart or discarding it and checking the next item.
This is an example of unindexed objects.
The amount of time
it would take to find five plums depends on the size of the mound and the
number of different fruits and vegetables included. Now, go to a grocery store
in which all the fruits and vegetables are organized in their own bins.
All you need to do is find the bin (ie, index) with plums
and pick out five plums. You have just experienced an index and its
groupings of like items, so that it is faster to find them. Indexes are
all around you, even at home and work! Dietitians probably index their
workdays without realizing it, that is unless they do not try to see all the
patients on one floor before moving on to the next floor just so they can
get more exercise.
The faster a
computer can find all the information, the faster it can return it to you. So,
the next time a new report is taking a long time to run, ask if indexing is
possibly the culprit. The response might surprise you.
Thank you for
reading and remember: Knowing the right answer is not nearly as important as
knowing what question to ask next.