title: Are UNIQUE SQL indexes also used for speeding up searches?
body: <p>Suppose a SQL database of "values of series". Each <code>Value</code> belongs to a <code>Series</code>, and has a date:</p>
  
  <pre><code>@Entity
  class Series { … }
  
  Value {
     Series series;
     Date date;
     …
     }
  </code></pre>
  
  <p>Each value is unique for each combination of series and date, which is guaranteed by this index:</p>
  
  <pre><code>UkSeries UNIQUE INDEX value (series ASC, data ASC)
  </code></pre>
  
  <p>In Hibernate, the above index is created by this annotation:</p>
  
  <pre><code>@Table (
      uniqueConstraints = @UniqueConstraint (columnNames = {"series", "data"}))
  </code></pre>
  
  <p>Now, please compare it to this possible alternative index definition:</p>
  
  <pre><code>UkSeries UNIQUE INDEX value (series ASC, data ASC)
  IdxSeries INDEX value (series ASC, data ASC)
  
  @Table (
      uniqueConstraints = @UniqueConstraint (columnNames = {"series", "data"}),
      indexes = { @Index (name = "IdxSeries", columnList = "series, data") })
  </code></pre>
  
  <p>Considering I also want to speed up the search for values in the database, <strong>my question is</strong>:</p>
  
  <p><strong>Will the "UNIQUE INDEX" alone, apart from guaranteeing uniqueness, also be used to speed the searches? Or do I really need both indexes, as presented in my alternative index definition above?</strong></p>
  
  <p>Note: I am using MySQL, but I believe this question is simple enough so that my specific database doesn't matter.</p>