Mysql show unused indexes

Mysql show unused indexes, also while i run a explain query on a select <> <table> having two indexes on the same column it shows both the indexes in possible keys but only one in used keys
Who is Participating?
Ioannis AnifantakisSoftware EngineerCommented:
Assume you have 3 indeces

1) surname, name
2) surnname, occupation
3) name

if you search only by surname then (1) will fire because it contains it and is declared first and (2) will be unused.

But if you search for surname, occupation (2) will be fired because it will fit better

Now if you have

1) surname, name
2) surname, occupation
3) surname

then if you search for surname only its unessesary to have (3) because the search tree already contains it in (1) and (2).

Also if you search for name, surname then none of your indeces fits this tree as it has to start by searching for the name first.
theGhost_k8Database ConsultantCommented:
Because only 1 index can be used at once.
npglobalAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.