title: How to properly index a linking table for many-to-many connection in MySQL?
body: <p>Lets say I have a simple many-to-many table between tables "table1" and "table2" that consists from two int fields: "table1-id" and "table2-id". How should I index this linking table?</p>
  
  <p>I used to just make a composite primary index (table1-id,table2-id), but I read that this index might not work if you change order of the fields in the query. So what's the optimal solution then - make independent indexes for each field without a primary index?</p>
  
  <p>Thanks.</p>