Database Reference
In-Depth Information
Basics of indexes
Just imagine that we are entering a hypermarket to purchase a few grocery items, which we
have already noted on a piece of paper. It's a multistorey store. Being a hypermarket, it has
almost all the products, such as grocery items, home appliances, electronics, footwear, and
lifestyle items. Since our intention is to purchase grocery items, we start with olive oil, and
we find it located on the first floor, but the cookware is not available on the same floor; it's
available on the top floor (let's say the tenth floor). After dragging ourselves from the bot-
tom floor to the top floor, we find that we were especially looking to buy a microwave
oven, but guess what? It is available on the fifth floor. So we are thinking of getting the el-
evator and going to the fifth floor. In spite of the badly-arranged items (not only with gro-
cery items), almost all the people are using the elevator, because of which we couldn't pur-
chase the microwave oven (along with some other items). So it's a loss of money for the
store as well as a waste of time for the customers.
We are entering another hypermarket, that has all the grocery items placed on the first floor.
Along with the items noted on the paper, we are purchasing a few more items that we
missed out while writing. In this way both the customer and the store will benefit. Which
store will you choose to shop in the next time? If you say that I love the first store and I
will always choose to purchase items only from that store, then please read Chapter 4 ,
Working with Secondary Indexes , which covers the usage of secondary index.
So you can call a store or hypermarket perfectly managed only if it helps the customer
complete his/her purchase easily. This can be done by organizing the items properly. Simil-
arly you can call a database properly managed only if the elements or items are organized
in such a way that it allows easy and fast retrieval of items in the table (in NoSQL, we don't
care much about insertion speed, since the data is read multiple times when it is written or
updated).
Indexes make retrieval much faster and minimize your billing in many ways. We are going
to discuss a few secondary index basics here, and a much more detailed discussion will
continue in Chapter 4 , Working with Secondary Indexes .
Search WWH ::




Custom Search