What is the best way of searching mysql table field for the ending of a fiels?
I have been开发者_开发百科 told that searching in a MySQL database with LIKE '%wordend'
is bad because it takes very long time.
What is the best way of searching on the end of a field?
Should I make an extra field where field that needs to be searched backwards is stored backwards, seems like an ok idea to me since it will give the benefit of indexing!
Should I make an extra field where field that needs to be searched backwards is stored backwards
Yep, store the text field in reverse. Then you can search for it LIKE 'dnedrow%'
('wordend' spelled backwards).
You are correct in that indexes on character fields start from the left.
精彩评论