Mysql considers to make full scan instead of reading the index better because most of the values in the index has value 1. If it decides to scan index and fetch data from it then it will require to make additional lookup to fetch real data from table. It's not optimal way. Try to create a third team with one member only and in this case mysql must use index. Mysql will start using the index as your db will grow and more unique data will be stored in TEAM_ID in comparison to whole data. It's called index cardinality. See explanation here What is cardinality in MySQL?.
↧