2

I would like to find all rows that would match the predicate MyColumn LIKE '%FooBar' but by by using an index seek rather than a scan.

One approach is essentially to create a reversed version of MyColumn and search for the reversed pattern (ooF%) on that column with a conventional index on the reversed column.

I do not like manually creating this reversed column, however. Oracle has the concept of reversed key indexes that can automatically index on REVERSE(MyColumn) without the need for manually materializing reversed versions of the column (either in form of a physical column on the table or by creating an indexed view).

Are there any other ways to perform suffix substring searches in SQL Server efficiently?

4

1 回答 1

2

只需使用带有索引的计算字段,或带有反向字段的索引视图。

是的,这将实现反向字段。但是您认为 Oracle 的反向索引是如何工作的?

为了使搜索有效,必须有一个物化的数据结构来搜索。

于 2013-10-02T10:56:59.360 回答