Skip to content
Advertisement

Does Adding Indexes speed up String Wildcard % searches?

We are conducting a wildcard search on a database table with column string. Does creating a non-clustered index on columns help with wildcard searches? Will this improve performance?

Proposed Index:

for this query

Currently using Microsoft SQL Server 2019.

Advertisement

Answer

Creating a normal index will not help(*), but a full-text index will, though you would have to change your query to something like this:

(* — well, it can be slightly helpful, in that it can reduce a scan over every row and column in your table into a scan over merely every row and only the relevant columns. However, it will not achieve the orders of magnitude performance boost that we normally expect from indexes that turn scans into single seeks.)

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement