I am looking into adding a composite index to a table in a MySQL database which will likely be several million rows in size. The composite will be comprised of two varchar
columns as well as three int columns.
My question is as stated in the title: Is there an optimal order in which to create this composite index?
For instance, one of the int
rows will likely only have 6 possible values, would it better for that column to be closer to the front of the index definition? Likewise, one of the varchar
columns will likely have millions of different values, should that be near the front or back of the index definition?