views:

35

answers:

1

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!

+2  A: 

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.

thomasrutter