I quite often need to filter records in a specific table on the basis of the existence of a substring in a text column. Specifically I need to exclude records that contain a /.
I currently use a WHERE statement such as:
WHERE table_name.text_col NOT LIKE "%/%"
My hunch is that searching the strings of every record for this substring takes a long time (relatively) and could be improved by indexing in some way. I could create a new binary indexed column and populate this based on whether the text column contains / but I was wondering if there is a neater solution for this?
I found this question which refers to a LEFT() style solution but I didn't understand the syntax and I'm looking for something that can cope with the substring being anywhere in the string.