I am using MySQL.
I have several lookups like this:
SELECT * from users WHERE user_name LIKE '%search_term%'
What index do I need to make these lookups fast?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
We used to run these kinds of queries too, but soon realized that relational databases like MySQL aren’t ideal for full-text searching. Depending on what kind of other lookups you have, you might want to look at Lucene and Solr.
Lucene supports indexing and search, completely separate from your database. It’s extremely fast and also supports spell checking, stemming, relevancy, and wildcard searches.
Solr is a search server powered by Lucene and also supports MySQL database integration. Highly recommended.