6 ms·
> I think LIKE can use indexes where the left is anchored with enough text for an index to be useful. LIKE 'this is fun%' will be more likely than LIKE 'a%' LIK
by AlisdairO 13y ago
> I think LIKE can use indexes where the left is anchored with enough text for an index to be useful. LIKE 'this is fun%' will be more likely than LIKE 'a%' LIKE '%fun vacation' won't but if you have an index on reverse(mycolumn) and you have where reverse(mycolumn) like reverse('%fun vacation'), it might.
That's the case for the C locale, but (as I understand it) not for other locales.
- einhverfr 13y agoReading a bit more it looks like you have to specify the text_pattern_ops on the index. This makes some sense actually, since it means that the index is ordered by the localized string order (so the index can be used).