Faster LIKE '% XXX'

MySQL searches for the type:

SELECT * FROM people WHERE surname LIKE '%ton';

Slowly even if the column subject to the LIKE index is indexed. Are there any methods to speed this up?

Best idea I can think of:

  • Create a new column in which the column is mixed up. So Washington => notgnihsaW And Jefferson => nosreffeJ

  • If you want to search for LIKE '% ton', cancel your suffix, for example. ton> not, and then search LIKE 'not%' in your new column.

This is a simple solution, but each time you add new data, you need to recompile the inverse column.

+4
source share
1 answer

... . , .

, , , , ..

, FULLTEXT ; .

+1

Source: https://habr.com/ru/post/1543104/


All Articles