0

Short question: with this: foo like '%%', MySQL go through all records or through none?

If you are thinking why i need this, it's because i'm concatenating a search string and if this have no performance problem, i have to write less code.

1

Simple answer LIKE '%%' will always trigger an FULL index scan if the column is indexed.

see http://sqlfiddle.com/#!2/382bca

if not indexed it will always trigger an FULL table scan.

see http://sqlfiddle.com/#!2/a0fd0/1

Note an FULL index scan and FULL table scan is almost the same but an FULL index scan is more likely to be faster if the index size is smaller what is most likely the case..

  • Beyond answering my question you taught me how to learn by myself, thank you. – Rafael Barros Nov 12 '13 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.