CST 363 - Week 5 - Slow Index
We've learned a lot about indexes. Indexes are like the index at the back of a textbook. If we need to read on a topic like "Video Games", we turn straight to page 150 (listed in the Index) and voila -- done. Fast search for something. In essence -- that's how an index works.
But how could it be "slow"? What would cause a slow index. I guess to extend the book metaphor it would be like if the index for "Video Games" said page 150, 200, 231, 240, 250, 400, 656, 800, etc. It would take you a LONG time to flip from Index Page to Information Page to Index Page to Information Page and so on. That back and forth gets slower and slower the more pages you have to go through. That's a slow index.
In the case of a DB, sometimes if data is scattered -- you should just do a full table scan! Which is what the article on https://use-the-index-luke.com/sql/anatomy/slow-indexes talks through.
Comments
Post a Comment