I have a MySQL table for which I do very frequent SELECT x, y, z FROM table WHERE x LIKE '%text%' OR y LIKE '%text%' OR z LIKE '%text%'
queries. Would any kind of index help speed things up?
There are a few million records in the table. If there is anything that would speed up the search, would it seriously impact disk usage by the database files and the speed of INSERT
and DELETE
statements? (no UPDATE
is ever performed)
Update: Quickly after posting, I have seen a lot of information and discussion about the way LIKE
is used in the query; I would like to point out that the solution must use LIKE '%text%'
(that is, the text I am looking for is prepended and appended with a % wildcard). The database also has to be local, for many reasons, including security.