title: Does Order of Fields of Multi-Column Index in MySQL Matter
body: <p>I know the importance of indexes and how order of joins can change performance. I've done a bunch of reading related to multi-column indexes and haven't found the answer to my question.</p>
  
  <p>I'm curious if I do a multi-column index, if the order that they are specified matters at all. My guess is that it would not, and that the engine would treat them as a group, where ordering doesn't matter. But I wish to verify.</p>
  
  <p>For example, from mysql's website (<a href="http://dev.mysql.com/doc/refman/5.0/en/multiple-column-indexes.html">http://dev.mysql.com/doc/refman/5.0/en/multiple-column-indexes.html</a>)</p>
  
  <pre><code>CREATE TABLE test (
      id         INT NOT NULL,
      last_name  CHAR(30) NOT NULL,
      first_name CHAR(30) NOT NULL,
      PRIMARY KEY (id),
      INDEX name (last_name,first_name)
  );
  </code></pre>
  
  <p>Would there be any benifit in any cases where the following would be better, or is it equivalent?</p>
  
  <pre><code>CREATE TABLE test (
      id         INT NOT NULL,
      last_name  CHAR(30) NOT NULL,
      first_name CHAR(30) NOT NULL,
      PRIMARY KEY (id),
      INDEX name (first_name,last_name)
  );
  </code></pre>
  
  <p>Specificially:</p>
  
  <pre><code>INDEX name (last_name,first_name)
  </code></pre>
  
  <p>vs</p>
  
  <pre><code>INDEX name (first_name,last_name)
  </code></pre>