When adding a FULLTEXT INDEX on 3 columns, does that add 1 single index on 3 columns, or does it add 3 separate indexes?
I ask this, because at the moment I'm using FULLTEXT like this:
ALTER TABLE myTable ADD FULLTEXT all3colsIndex (col1,col2,col3);
SELECT * FROM myTable WHERE MATCH (col1, col2, col3) AGAINST ('word');
I have just added a user option to my search interface where the user can remove one of the columns from the search. So am I able to do this without losing the index, where I'm only using 2 of the 3 columns:
ALTER TABLE myTable ADD FULLTEXT all3colsIndex (col1,col2,col3);
If (UserOptionRemoveCol == "selected") {
SELECT * FROM myTable WHERE MATCH (col1, col2) AGAINST ('word');
} else {
SELECT * FROM myTable WHERE MATCH (col1, col2, col3) AGAINST ('word');
}
Or would I have to create a new FULLTEXT index on the two columns, as well as the three?
ALTER TABLE myTable ADD FULLTEXT all3colsIndex (col1,col2,col3);
ALTER TABLE myTable ADD FULLTEXT 2colsIndex (col1,col2);
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…