I've searched around but I can't seem to find an appropriate explaination behind the concept of unique and non unique indexes in a database.
In Rails, for example, you can create unique and non unique indexes for a given field, as explained at http://railsguides.net/advanced-rails-model-generators/
What I don't understand is: if the purpose of an index is to "set a shortcut" to a value position in a table for faster accessing it, then how could multiple values share the same index?
Say for example I'm storing emails in a table, and I want to index their values positions. If so far I get it right, in case I have non unique indexes, then the DB could have [email protected] indexed at position 150 and [email protected] also indexed at position 150. So if I end up having say 100 different values at position 150, doesn't this defeat the purpose of indexing in the first place if the DB would still have to search through all the values at 150 to find the exact record I need?
How does this make sense ??
Thanks