Optimization of MySQL search using "like" and wildcards -


how can queries like

select * sometable somefield '%value%' 

be optimized?

the main issue here first wildcard prevents dbms using index.

edit: more, somefield value solid string (not piece of text) fulltext search not performed.

two ways:

(1) use in-memory table goes fast.

(2) cook better index , search algorithm foo '%bar%'. it's not possible make suggestions without knowing more problem.

as have pointed out, %bar% pattern guarantees table-scan every lookup, nullifies possible search ingenuity in database software.


Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -