FROM: https://dev.mysql.com/doc/refman/5.5/en/multiple-column-indexes.html
MySQL can use multiple-column indexes for queries that test all the columns in the index, or queries that test just the first column, the first two columns, the first three columns, and so on. If you specify the columns in the right order in the index definition, a single composite index can speed up several kinds of queries on the same table.
Does the order of how the columns are used matter?
Example: id, first name, last name, middle name, address
index (first name, last name, middle name)
Indexes:
- first name
- first name, last name
- first name, last name, middle name
When doing the query does the order of the WHERE matter?
EXAMPLE:
WHERE first_name = 'Chris' and last_name = 'Smith'
VS
WHERE last_name='Smith' and first_name = 'Chris'
Are these basically the same?