Best technique to search for matching substrings with Linq & SQL Server -


I need to find rows in the table with 200,000 entries. Some people can not think of this 'big' , But enough to tell performance ideas.

In the table, strings are only digits, for example, the user can enter something like '12340-0560-78', or some fraction of it, e.g. '0560', and I need to match prices

12345678 and 123405678 and 0123456780 etc.

These NDCs are national drug codes, and in spite of the standard manufacturers have given them their By adding or subtracting zero in different positions in barcode, in different ways.

I remove the zero and non-numeric characters from the search string and work on the column after removing all its zeroes. It is very slow.

So I added a calculation column to the table, in which the Search column contains all the zeros. It's better, but I'm still scanning a table due to joining.

Then I prepared a full text index, but I realized that with full text index I can not search for substring, only words, phrases and prefixes are weird, but this is the solution to this problem does not do.

What are the other options?

How about creating a simple cluster index on the calculated column? What is the right thing to do?

For example

  Make Table [DBO]. [FU] ([code] [vaachar] (20) tap, [cocal] AS (replace [[code], '-', '', '', '')) [primary]  

and

  change CLUSTERED INDEX [IX_foo] ON [dbo]. [Foo] ([ccol] ASC) ...  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -