I have a large database containing more than five million records, this database has three fields (ID, name, text), the field ID has a primary key, the field name has a FULLTEXT index.
I want to create a search engine for my site that seeks in the field name, I use FULLTEXT index but has the disadvantage not to accept the keywords of less than four characters, so I decided to delete it and put a INDEX KEY on the field name and use the following request:
EXPLAIN SELECT * FROM table WHERE locate ('search', name) > 0;
the problem is that this application does not use the index KEY field name, but this request:
EXPLAIN SELECT name FROM table WHERE locate ('search', name) > 0;
uses the INDEX KEY,
I do not know why when I select all fields MYSQL does not use index.
In your opinion how to solve this problem and if possible a better alternative.