title: What is the purpose of non unique indexes in a database?
body: <p>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.</p>
  
  <p>In Rails, for example, you can create unique and non unique indexes for a given field, as explained at <a href="http://railsguides.net/advanced-rails-model-generators/" rel="noreferrer">http://railsguides.net/advanced-rails-model-generators/</a> </p>
  
  <p>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?</p>
  
  <p>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 foo@bar.com indexed at position 150 and bar@foo.com 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?</p>
  
  <p>How does this make sense ??</p>
  
  <p>Thanks</p>