title: database index: why pairing
body: <p>I have a table with multiple indexes, several of which duplicate the same columns:</p>
  
  <pre><code>Index 1 columns: X, B, C, D
  Index 2 columns: Y, B, C, D
  Index 3 columns: Z, B, C, D
  </code></pre>
  
  <p>I'm not very knowledgeable on indexing in practice, so I'm wondering if somebody can explain why X, Y and Z were paired with these same columns.  B is an effective date. C is a semi-unique key ID for this table for a specific effective date B.  D is a sequence that identifies the priority of this record for the identifier C.</p>
  
  <p>Why not just create 6 indexes, one for each X, Y, Z, B, C, D?</p>
  
  <p>I want to add an index to another column T, but in some contexts I'll only be querying on T alone while in others I will also be specifying the B, C and D columns... so should I create just one index like above or should I create one for T and one for (T, B, C, D)?</p>
  
  <p>I've not had as much luck as expected when googling for comprehensive coverage of indexing.  Any resources where I can get a through explanation and lots of examples of B-tree indexing?</p>