As the title states, what is a fulltext index and when should I use it?
Share
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.
In databases indices are usually used to enhance performance when looking for something defined in your where clause. However when it comes to filtering some text, e.g. using something like
WHERE TextColumn LIKE '%searchstring%'then searches are slow, because the way regular database indices work are optimized for matches against the ‘whole content’ of a column and not just a part of it. In specific the LIKE search which includes wildcards can not make use of any kind of index.As mentioned in the comment below MySQL needs the
MATCH () ... AGAINSTsyntax to search within a fulltext index; BTW this varies depending on the database vendor. In MS SQL you can useCONTAINSso keep this in mind when you plan to support other databases too.Fulltext indices work better for regular text, because they are optimized for these type of columns. Very simplified: They split the text into words and make an index over the words and not the whole text. This works a lot faster for text searches when looking for specific words.