0

I would like to know if it is OK to have both a fulltext index and a "normal" index on the same column (varchar) of a table in MySQL

If my understanding is correct normal index will be used for queries using "=" and "like" and the fulltext will only be used when i do "match()" ?

Thank you for your help!

1 Answer 1

4

Yes it is allowed to have several indexes on the same column, and while it is most of the time useless, it makes perfect sense in your case.

MySQL will indeed use your FULLTEXT index when querying using MATCH...AGAINST syntax, and use the normal index for the rest.

Sign up to request clarification or add additional context in comments.

4 Comments

thank you for your answer, is there a place in the MySQL doc where they mention this behavior ?
not really but its just a logical assumption: When you have several indexes on the same column, it's the MySQL optimizer which choose the right one to use. If it doesnt use the right one, you can force the index you want with HINTS. However for FULLTEXT indexes, you should explicitly code your queries with the MATCH...AGAINST syntax because that tells the optimizer to use the corresponding FULLTEXT index. So in your case it will just do exactly what you want it to do.
Our DBA has just confirmed what you have said as well :)
@sashok_bg c'est rassurant pour l'entreprise ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.