If your goal is to test if a string exists in a MySQL column (of type ‘varchar’, ‘text’, ‘blob’, etc) which of the following is faster / more efficient / better to use, and why?
Or, is there some other method that tops either of these?
INSTR( columnname, 'mystring' ) > 0
vs
columnname LIKE '%mystring%'
FULLTEXT searches are absolutely going to be faster, as kibibu noted in the comments above.
However:
In my tests, they perform exactly the same. They are both case-insensitive, and generally they perform full-table scans, a general no-no when dealing with high-performance MySQL.
Unless you are doing a prefix search on an indexed column:
In which case, the LIKE with only a suffix wildcard is much faster.