title: Understanding multiple column indexes in MySQL query
body: <p>Here is the query:</p>
  
  <pre><code>SELECT * FROM table WHERE accountid = 1 ORDER BY logindate DESC LIMIT 1
  </code></pre>
  
  <p>Now if I added an index with multiple columns on the fields:</p>
  
  <pre><code>INDEX(accountid,logindate)
  </code></pre>
  
  <p>Would MySQL take advantage of this multiple column index? Or would it not use it because one field is in the where clause and the other is in an order statement? Or does it not matter as long as I use the fields in the order of the multiple column index?</p>