Showing posts with label match. Show all posts
Showing posts with label match. Show all posts

Friday, March 23, 2012

Fuzzy Street Address Search Code

Anybody have any good code for this case...

Given @.address1 as a parameter.

Look in the providers table for providers that match that Address.

But it needs to be a fuzzy lookup. Meaning it has to find these to be matched

123 Fake St.

123 Fake Street

Even possible some misspellings like

123 Fke St would be nice as well.

I know it will possibly involve a Split function, and/or Soundex and Difference functions. But what is best?

I can't find any code when I google this subject.

Help?!?!?

You may be best served to establish FULL TEXT SEARCH for the address column.

Refer to Books Online, Topic: Full Text Search

|||

I just set up the full-text search... This does not seem to be helpful. I can't do a search like:

SELECT *

FROM providers

WHERE CONTAINS (sv_addr, '"123 Fake St"')

Because it will pull up nothing... However I would need to break up the values with some sort of Split function. Then even still it would not pull up ST as matching Street... or get me results spelled wrong like 123 Fke St.

Help?!?! Is there some functionality I'm missing for using a Full-text Search? Or does someone have code already. It would seem that this functionality is needed in all kinds of projects, and that my inquery would be answered completely immediately.

-Robert

|||

This underscores the need to have a good address validation process in place BEFORE bad and/or mis-spelled addressed are put into your server. You may wish to investigate using the US Postal Service web service for addresses and address correction.

I have assisted in incorporating the USPS web service in applications and the results have been excellent. For example, I can misspell my street name and it will still come back with the correct address. In addition, the Zip+4 is provided, there is cross-check between city and zipcode, abbreviations are standardized, etc.

https://secure.shippingapis.com/Registration/

http://www.codeproject.com/useritems/USPS_Web_Tools_Wrapper.asp

|||

umm... no. I have a legacy address database... and I'm hired to write code to search it. I'm not hired to correct the database. The code I'm looking for has to be out there, I just have to look hard enough... or someone will help me and post it.

Thank you for your suggestions.

|||

I've been there, spent quite a bit of time researching Name and Address issues (on a client's nickel of course.)

There are excellent third party 'add-ins' -very expensive though ($100k+) But not too much that really solves the problems.

Deconstruction can help, storing the address components in separate columns -but still a groaner...

Good luck, and keep us posted. Perhaps there is a new approach out there that would be wonderful to share.

|||bump|||There is no "good" way to do what you want with one field called "Address", with any number of values in it.

What I have done in the past is use an exact search for the value and if that does not return any values, use the SOUNDEX() function to try to match something. On large string lengths, this will have a very large number of hits.

Good luck
|||

Here is a beginning to what I want

Code Snippet

CREATE Function [dbo].[AddressFuzzy] (

@.var1 as Varchar(200),

@.var2 as Varchar(200))

RETURNS int AS

--

-- Function Address --

-- ? Matches street name

--

BEGIN

DECLARE

@.a varchar(100), -- street name in var1

@.b varchar(100), -- street name in var2

@.i int

select @.a = Value from dbo.Split(@.var1, ' ') where TokenID = 2

select @.b = Value from dbo.Split(@.var2, ' ') where TokenID = 2

set @.i = difference(@.a, @.b)

RETURN (@.i)

END

The Split function is available as well, if you don't have or understand. This will do a fuzzy match on whatever the second word in the street address is.

so 1) 123 2) Fake 3) Street

It'll fuzzy match 2. I think I can work with this till I get somewhere...

|||

Code Snippet

ALTER Function [dbo].[AddressFuzzy] (

@.var1 as Varchar(200),

@.var2 as Varchar(200))

RETURNS int AS

--

-- Function Address --

-- ? Matches street name

--

BEGIN

DECLARE

@.a varchar(100), -- street name in var1

@.b varchar(100), -- street name in var2

@.c varchar(100), -- street name in var1

@.d varchar(100), -- street name in var2

@.e varchar(100), -- street name in var1

@.f varchar(100), -- street name in var2

@.i char(1),

@.j char(1),

@.k char(1),

@.var1Tokens int,

@.var2Tokens int,

@.var1Plus int,

@.var2Plus int

set @.var1Plus = 0

set @.var2Plus = 0

select @.var1tokens = TokenID from dbo.Split(@.var1, ' ')

select @.var2tokens = TokenID from dbo.Split(@.var2, ' ')

set @.k = '0'

select @.a = Value from dbo.Split(@.var1, ' ') where TokenID = 1

select @.b = Value from dbo.Split(@.var2, ' ') where TokenID = 1

if @.a = @.b set @.k = '1'

select @.c = value from dbo.Split(@.var1, ' ') where TokenID = 2

select @.d = Value from dbo.Split(@.var2, ' ') where TokenID = 2

set @.i = Convert(varchar, difference(@.c, @.d))

if Convert(int, @.i) < 3 begin

if @.var1tokens > 3 begin

-- select @.c = @.c + ' ' + value from dbo.Split(@.var1, ' ') where TokenID = 3

select @.c = value from dbo.Split(@.var1, ' ') where TokenID = 3

set @.var1Plus = 1

end

if @.var2tokens > 3 begin

-- select @.d = @.d + ' ' + Value from dbo.Split(@.var2, ' ') where TokenID = 3

select @.d = value from dbo.Split(@.var1, ' ') where TokenID = 3

set @.var2Plus = 1

end

set @.i = Convert(varchar, difference(@.c, @.d))

end

select @.e = Value from dbo.Split(@.var1, ' ') where TokenID = 3 + @.var1Plus

select @.f = Value from dbo.Split(@.var2, ' ') where TokenID = 3 + @.var2Plus

if @.e is null or @.f is null or @.e = '' or @.f = ''

set @.j = '4'

else

set @.j = Convert(varchar, difference(@.e, @.f))

RETURN Convert(int, (@.k + @.i + @.j))

END

It works fine...

|||

And then, without address standardization, there will be:

123 N Fake St

123 N E Fake St

123 North East Fake St

123 Fake N

123 N Fake St S

As you will discover, there is no 'easy or simple' way to handle addresses unless you follow the USPS rules of standardization -and even then it will still be a major headache. (That's partially why the third party tools are so expensive.) Almost all situations where addressing is a mission critical part of the database structure, addresses are deconstructed into constuitent parts, Number, Direction, StreetName, StreetType, etc. -Think Fire, Police, 911 services. Fuzzy doesn't handle it.

A great many of us have had to tackle this problem. If you 'blow off' our suggestions, you most likely won't find a workable solution.

You would do your client a better service by opening the conversation about why and how to standardize the existing data. It is not a complex process.

|||

The above solution I have found does work. I complained of it's slow-ness but once you narrow down the field using Zip &/or city,state it becomes manageable and an acceptable slowness.

I understand your concerns about the USPS address. Our company has had clients that give us raw addresses from there database, and I've been on the task of turning those into distinct locations.

A lot of the time I have to eye-ball address after address and assign them the same location-id because of the above...
123 N fake st = 123 fake st = .... and so on.

In the future your suggestion does make sense... But for now a fuzzy search on the current database is acceptable.

Now you bring up another point however, a bit unrelated to the question.

The USPS would standardize the database and make it...

123 N Fake St...

And i have a guy search for 123 Fake St... and I would send that to get standarized...

How would the USPS system resolve the two above to be equal?

Would I then take the searched address and see if USPS has it on file? Because it would not match my now standardized database. Or would I take each search and get USPS to tell me the correct way to represent the search and then match it to my database?

-Robert

|||

If there was only a N Fake Street, the return is a standardized address.

If there is both a N and S Fake St, usually 123 would be one North (or South), and 125 would be the other. Rarely would exact same numbering scheme be both North and South. Or the ZIP will be used to determine which is correct.

Again, if address searching is mission critical, you MUST deconstruct

|||I agree with Arnie.

The way the USPS standardization service will return a standard address in the form:
House Number, Direction, Street Name, Modifier (DR, ST, AVE, etc), and city/st/zip, etc

The only way to do any kind of search is you have to know if you are looking for N or S or ST or DR or Ave or whatever. Then you prompt the user for 4 fields, which can have blanks representing "any". Then you can use SOUNDEX on the street name to find something similar.

|||

I spent quite a bit of time for several clients working out the name/address matching possibilities for very large databases. Here is a summary of the super-condensed executive briefing abstract. Wink

None of the available 'free' options can hold a candle to some of the third party products (a couple of which are 'Homeland Securty certified' and often paid for by Homeland Security for governmental requirements). But the cost is high. Obviously, some of these folks have made a large investment in working out name search algorythms, and they rightfully expect a 'good' ROI -and with HS's backing, they are getting it.

Soundex was created to solve a Census Bureau problem at the 20th century, and is biased toward northern european names (primary immigrant influx at the time.) That bias still exists and soundex does NOT handle asian, eastern european, and arabic names worth a crap.

Double Metaphone and NYSIIS are a 'recent' alternatives to soundex (there is documentation and SQL functions available on the 'interweb'.) Double Metaphone and NYSIIS are more robust than soundex(), doing a 'plausible' job handling eastern european, asian, and arabic names.

If you are attempting to 'roll you own' name/address search algorythms, DON"T! Explore using Double Metaphone instead. Don't use soundex() -you will be disappointed.

The Double Metaphone code is publically available, expand on it and publish your enhancements to the larger SQL Community. For addresses, use the USPS web service to standardize the address, and deconstruct the address, storing the 'street' name in its own column.

Fuzzy Street Address Search Code

Anybody have any good code for this case...

Given @.address1 as a parameter.

Look in the providers table for providers that match that Address.

But it needs to be a fuzzy lookup. Meaning it has to find these to be matched

123 Fake St.

123 Fake Street

Even possible some misspellings like

123 Fke St would be nice as well.

I know it will possibly involve a Split function, and/or Soundex and Difference functions. But what is best?

I can't find any code when I google this subject.

Help?!?!?

You may be best served to establish FULL TEXT SEARCH for the address column.

Refer to Books Online, Topic: Full Text Search

|||

I just set up the full-text search... This does not seem to be helpful. I can't do a search like:

SELECT*

FROM providers

WHERECONTAINS(sv_addr,'"123 Fake St"')

Because it will pull up nothing... However I would need to break up the values with some sort of Split function. Then even still it would not pull up ST as matching Street... or get me results spelled wrong like 123 Fke St.

Help?!?! Is there some functionality I'm missing for using a Full-text Search? Or does someone have code already. It would seem that this functionality is needed in all kinds of projects, and that my inquery would be answered completely immediately.

-Robert

|||

This underscores the need to have a good address validation process in place BEFORE bad and/or mis-spelled addressed are put into your server. You may wish to investigate using the US Postal Service web service for addresses and address correction.

I have assisted in incorporating the USPS web service in applications and the results have been excellent. For example, I can misspell my street name and it will still come back with the correct address. In addition, the Zip+4 is provided, there is cross-check between city and zipcode, abbreviations are standardized, etc.

https://secure.shippingapis.com/Registration/

http://www.codeproject.com/useritems/USPS_Web_Tools_Wrapper.asp

|||

umm... no. I have a legacy address database... and I'm hired to write code to search it. I'm not hired to correct the database. The code I'm looking for has to be out there, I just have to look hard enough... or someone will help me and post it.

Thank you for your suggestions.

|||

I've been there, spent quite a bit of time researching Name and Address issues (on a client's nickel of course.)

There are excellent third party 'add-ins' -very expensive though ($100k+) But not too much that really solves the problems.

Deconstruction can help, storing the address components in separate columns -but still a groaner...

Good luck, and keep us posted. Perhaps there is a new approach out there that would be wonderful to share.

|||bump|||There is no "good" way to do what you want with one field called "Address", with any number of values in it.

What I have done in the past is use an exact search for the value and if that does not return any values, use the SOUNDEX() function to try to match something. On large string lengths, this will have a very large number of hits.

Good luck
|||

Here is a beginning to what I want

Code Snippet

CREATEFunction [dbo].[AddressFuzzy] (

@.var1 as Varchar(200),

@.var2 as Varchar(200))

RETURNS intAS

--

-- Function Address --

-- ? Matches street name

--

BEGIN

DECLARE

@.a varchar(100),-- street name in var1

@.b varchar(100),-- street name in var2

@.i int

select @.a = Value from dbo.Split(@.var1,' ')where TokenID = 2

select @.b = Value from dbo.Split(@.var2,' ')where TokenID = 2

set @.i =difference(@.a, @.b)

RETURN(@.i)

END

The Split function is available as well, if you don't have or understand. This will do a fuzzy match on whatever the second word in the street address is.

so 1) 123 2) Fake 3) Street

It'll fuzzy match 2. I think I can work with this till I get somewhere...

|||

Code Snippet

ALTERFunction [dbo].[AddressFuzzy] (

@.var1 as Varchar(200),

@.var2 as Varchar(200))

RETURNS intAS

--

-- Function Address --

-- ? Matches street name

--

BEGIN

DECLARE

@.a varchar(100),-- street name in var1

@.b varchar(100),-- street name in var2

@.c varchar(100),-- street name in var1

@.d varchar(100),-- street name in var2

@.e varchar(100),-- street name in var1

@.f varchar(100),-- street name in var2

@.i char(1),

@.j char(1),

@.k char(1),

@.var1Tokens int,

@.var2Tokens int,

@.var1Plus int,

@.var2Plus int

set @.var1Plus = 0

set @.var2Plus = 0

select @.var1tokens = TokenID from dbo.Split(@.var1,' ')

select @.var2tokens = TokenID from dbo.Split(@.var2,' ')

set @.k ='0'

select @.a = Value from dbo.Split(@.var1,' ')where TokenID = 1

select @.b = Value from dbo.Split(@.var2,' ')where TokenID = 1

if @.a = @.b set @.k ='1'

select @.c = value from dbo.Split(@.var1,' ')where TokenID = 2

select @.d = Value from dbo.Split(@.var2,' ')where TokenID = 2

set @.i =Convert(varchar,difference(@.c, @.d))

ifConvert(int, @.i)< 3 begin

if @.var1tokens > 3 begin

-- select @.c = @.c + ' ' + value from dbo.Split(@.var1, ' ') where TokenID = 3

select @.c = value from dbo.Split(@.var1,' ')where TokenID = 3

set @.var1Plus = 1

end

if @.var2tokens > 3 begin

-- select @.d = @.d + ' ' + Value from dbo.Split(@.var2, ' ') where TokenID = 3

select @.d = value from dbo.Split(@.var1,' ')where TokenID = 3

set @.var2Plus = 1

end

set @.i =Convert(varchar,difference(@.c, @.d))

end

select @.e = Value from dbo.Split(@.var1,' ')where TokenID = 3 + @.var1Plus

select @.f = Value from dbo.Split(@.var2,' ')where TokenID = 3 + @.var2Plus

if @.e isnullor @.f isnullor @.e =''or @.f =''

set @.j ='4'

else

set @.j =Convert(varchar,difference(@.e, @.f))

RETURNConvert(int,(@.k + @.i + @.j))

END

It works fine...

|||

And then, without address standardization, there will be:

123 N Fake St

123 N E Fake St

123 North East Fake St

123 Fake N

123 N Fake St S

As you will discover, there is no 'easy or simple' way to handle addresses unless you follow the USPS rules of standardization -and even then it will still be a major headache. (That's partially why the third party tools are so expensive.) Almost all situations where addressing is a mission critical part of the database structure, addresses are deconstructed into constuitent parts, Number, Direction, StreetName, StreetType, etc. -Think Fire, Police, 911 services. Fuzzy doesn't handle it.

A great many of us have had to tackle this problem. If you 'blow off' our suggestions, you most likely won't find a workable solution.

You would do your client a better service by opening the conversation about why and how to standardize the existing data. It is not a complex process.

|||

The above solution I have found does work. I complained of it's slow-ness but once you narrow down the field using Zip &/or city,state it becomes manageable and an acceptable slowness.

I understand your concerns about the USPS address. Our company has had clients that give us raw addresses from there database, and I've been on the task of turning those into distinct locations.

A lot of the time I have to eye-ball address after address and assign them the same location-id because of the above...
123 N fake st = 123 fake st = .... and so on.

In the future your suggestion does make sense... But for now a fuzzy search on the current database is acceptable.

Now you bring up another point however, a bit unrelated to the question.

The USPS would standardize the database and make it...

123 N Fake St...

And i have a guy search for 123 Fake St... and I would send that to get standarized...

How would the USPS system resolve the two above to be equal?

Would I then take the searched address and see if USPS has it on file? Because it would not match my now standardized database. Or would I take each search and get USPS to tell me the correct way to represent the search and then match it to my database?

-Robert

|||

If there was only a N Fake Street, the return is a standardized address.

If there is both a N and S Fake St, usually 123 would be one North (or South), and 125 would be the other. Rarely would exact same numbering scheme be both North and South. Or the ZIP will be used to determine which is correct.

Again, if address searching is mission critical, you MUST deconstruct

|||I agree with Arnie.

The way the USPS standardization service will return a standard address in the form:
House Number, Direction, Street Name, Modifier (DR, ST, AVE, etc), and city/st/zip, etc

The only way to do any kind of search is you have to know if you are looking for N or S or ST or DR or Ave or whatever. Then you prompt the user for 4 fields, which can have blanks representing "any". Then you can use SOUNDEX on the street name to find something similar.

|||

I spent quite a bit of time for several clients working out the name/address matching possibilities for very large databases. Here is a summary of the super-condensed executive briefing abstract. Wink

None of the available 'free' options can hold a candle to some of the third party products (a couple of which are 'Homeland Securty certified' and often paid for by Homeland Security for governmental requirements). But the cost is high. Obviously, some of these folks have made a large investment in working out name search algorythms, and they rightfully expect a 'good' ROI -and with HS's backing, they are getting it.

Soundex was created to solve a Census Bureau problem at the 20th century, and is biased toward northern european names (primary immigrant influx at the time.) That bias still exists and soundex does NOT handle asian, eastern european, and arabic names worth a crap.

Double Metaphone and NYSIIS are a 'recent' alternatives to soundex (there is documentation and SQL functions available on the 'interweb'.) Double Metaphone and NYSIIS are more robust than soundex(), doing a 'plausible' job handling eastern european, asian, and arabic names.

If you are attempting to 'roll you own' name/address search algorythms, DON"T! Explore using Double Metaphone instead. Don't use soundex() -you will be disappointed.

The Double Metaphone code is publically available, expand on it and publish your enhancements to the larger SQL Community. For addresses, use the USPS web service to standardize the address, and deconstruct the address, storing the 'street' name in its own column.

Fuzzy lookup transform row scores 'inconsistent' with individual column scores

I am trying to interpret some of the results I observe when trying to match similar records using a fuzzy lookup transform, but it's not entirely clear how the overall row similarity score is calculated. In particular, sometimes rows with lower individual column similarity scores will achieve a higher similarity and confidence score than a matching row with higher individual column scores.

The transform is configured with 6 text fields set to fuzzy mapping and a minimum similarity of 0, and 3 additional numeric fields with an exact mapping. It is set to return a maximum of 2 matches per lookup and to do an exhaustive search of the reference table.

For example, from the following matching pair of records Match 1 is picked over Match 2 even though it's individual scores are lower.

Match 1 Match 2
-- --
_similarity_author 1.0 1.0
_similarity_title 0.85344648 1.0
_similarity_headline 0.0125 0.0125
_similarity_summary 0.0125 0.0125
_similarity_picture 1.0 1.0
_similarity_caption 1.0 1.0

_similarity 7.8429267E-2 7.3196657E-2
_confidence 0.55728668 0.44271332

In another case both matching records have *identical* scores for every mapped column and yet their similarity and confidence scores are different.

Clearly there are other factors involved in calculating the overall row score. Anybody know what these are?


Fernando Tubio

Can't even begin to describe it in my own words. This article describes the Fuzzy Math real well. Don't know if you've seen it.

http://msdn.microsoft.com/msdnmag/issues/05/09/SQLServer2005/

|||

Thank you Martin.

I've read the article and it explains the lookup process well. Unfortunately it doesn't answer my question. Specifically, having found two matches, why does the matching algorithm discard what appears to be a better match, at least judging from individual column similarity scores.

I am trying to understand the mechanism to determine if there is anything I can tweak in order to force the algorithm to make a better choice.

Fuzzy lookup match issue

Hello,

I have a peculiar problem in my project. My project design is like this

The number in (...) are count of records.

File feed (1000)

|

|

Fuzzy Lookup

against Table2

|

|

Split Fz Lookup results

(_Similarity >= 0.60 && _Confidence >= 0.85)

| |

| |

| Write matches to Table1 (250)

|

Fuzzy Group

Remaining rows (750)

|

|

Split Fz Group results

| |

| |

Write Canonicals Write Dupes

to Table2 to Table1

(300) (450)

This is basically a customer de-dupification project.

The Table2 has the canonicals and Table1 has the dupes (of the canonicals).

I already have some data in these tables and the new data is matched against the existing data

in these tables and classified as new customers and duplicate customers.

In the above process one could notice that the rows identified as dupes of already exsting canonicals

by the Fuzzy Lookup task are written into the dupes table (Table1) and will not be processed further down

the line in the project.

But in my case I see that those matches identified by Fuzzy lookup are further being included in the

Fuzzy Grouping also.

When I run this in debug mode in BIDS, it shows the correct numbers as I have depicted in the

illustration above. But, after execution, when I query the tables it shows that all 1000 rows

went through Fuzzy Grouping.

Any thoughts?

Btw, is there anyway to upload attachments to the postings here?

I also tried introducing a Derived Column between the 'Split Fz Lookup Results' and 'Write matches to Table1' to write some string into one of the table columns. It did not.

Wednesday, March 21, 2012

Fuzzy Lookup componant eating all available virtual memory

Hey,

I have a large set of data that I need to match against another large set of data. The reference table has 9.8mill rows and my input has 14.6mill rows. I started with a new project. I added my connection, then a task to clear the result table, then my data flow, then my OLE source, then my Fuzzy Lookup task, then my SQL Server Destination. I set the connection of my OLE source and set the query to pull the data. Then I set the connection of my Fuzzy Lookup task, set the reference table and told it to create a new index (the problem also occurs if I use a generated index) and then set up the matching criteria. Then I set the connection and destination for the SQL Server Destination.

After setting all this up, I hit Run. The thing ran great until ~ 800k rows and then it failed. I ran it several times and it always failed right around 800k with a message saying there was not enough space and then an error with buffers being passed to the Fuzzy Lookup component. I opened Task Manager and watched the resources as it ran and was amazed at what I saw. The Fuzzy Lookup component eats up every bit of Virtual Memory available and when it can't take any more, it errors out. I tried setting the Max Memory setting on the component and it seems to have no effect. I also played with the buffer settings on the data flow task to no avail. I even went as far as to put an identity on my input table and create a function that outputs selects that use a between on the identity to break the data into 600k chunks. I set up a ForEach component and DTS variables, but the Fuzzy Lookup component does not free the VM after the iteration of the ForEach component!

I ended up running each chunk of 600k one at a time. I have to automate this for the future, so I need a solution. Does anyone have an idea for me?

The errors I get are:

[Fuzzy Lookup 1 [3067]] Warning: Not enough storage is available to complete this operation.

[DTS.Pipeline] Warning: A call to the ProcessInput method for input 3068 on component "Fuzzy Lookup 1" (3067) unexpectedly kept a reference to the buffer it was passed. The refcount on that buffer was 2 before the call, and 1 after the call returned.

[DTS.Pipeline] Error: The ProcessInput method on component "Fuzzy Lookup 1" (3067) failed with error code 0x8007000E. The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.

[DTS.Pipeline] Error: Thread "WorkThread0" has exited with error code 0x8007000E.

[OLE DB Source [1923]] Error: The attempt to add a row to the Data Flow task buffer failed with error code 0xC0047020.

[DTS.Pipeline] Error: The PrimeOutput method on component "OLE DB Source" (1923) returned error code 0xC02020C4. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.

[DTS.Pipeline] Error: Thread "SourceThread0" has exited with error code 0xC0047038.

[DTS.Pipeline] Error: Thread "WorkThread1" received a shutdown signal and is terminating. The user requested a shutdown, or an error in another thread is causing the pipeline to shutdown.

[DTS.Pipeline] Error: Thread "WorkThread1" has exited with error code 0xC0047039.

|||

Pls check to see whether http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=191199&SiteID=1 helps.

Thanks

Wenyang

|||

I found that thread after posting and tried the solutions there, but they had no effect on the package. It still almost linearly eats up all virtual memory. By the time it is at 800k records, it has eaten up 40gb of virtual memory.

The server is:

Dual AMD 64bit Processors

2TB storage with 650GB free

8GB ram

Windows Server 2003 64bit

SQL Server 2005 64bit

Of note also is that I have tried running the package from the command line with identical results. Here is what I used:

dtexec /f package1.dtsx /ref n

|||I had the VM size increased to 200gb and I can do 3m sets now. It still isn't to where I need to to be for automation, but it will let me get the job done for now. If anyone has some ideas on what might be wrong, please please let me know!!|||

Hey James,

Did you have any luck with this? I'm in exactly the same situation you are in regarding fuzzy lookup taking all memory. If you or anyone else figured out a work around it would be great to hear.

Thanks,

SL

|||There's been fixes for memory leak issues with the fuzzy components in the past. Could you check KB 912423: "FIX: Memory leaks occur when you use Fuzzy Lookup and Fuzzy Grouping to transform a SQL Server 2005 Integration Services package"?

Fuzzy Lookup componant eating all available virtual memory

Hey,

I have a large set of data that I need to match against another large set of data. The reference table has 9.8mill rows and my input has 14.6mill rows. I started with a new project. I added my connection, then a task to clear the result table, then my data flow, then my OLE source, then my Fuzzy Lookup task, then my SQL Server Destination. I set the connection of my OLE source and set the query to pull the data. Then I set the connection of my Fuzzy Lookup task, set the reference table and told it to create a new index (the problem also occurs if I use a generated index) and then set up the matching criteria. Then I set the connection and destination for the SQL Server Destination.

After setting all this up, I hit Run. The thing ran great until ~ 800k rows and then it failed. I ran it several times and it always failed right around 800k with a message saying there was not enough space and then an error with buffers being passed to the Fuzzy Lookup component. I opened Task Manager and watched the resources as it ran and was amazed at what I saw. The Fuzzy Lookup component eats up every bit of Virtual Memory available and when it can't take any more, it errors out. I tried setting the Max Memory setting on the component and it seems to have no effect. I also played with the buffer settings on the data flow task to no avail. I even went as far as to put an identity on my input table and create a function that outputs selects that use a between on the identity to break the data into 600k chunks. I set up a ForEach component and DTS variables, but the Fuzzy Lookup component does not free the VM after the iteration of the ForEach component!

I ended up running each chunk of 600k one at a time. I have to automate this for the future, so I need a solution. Does anyone have an idea for me?

The errors I get are:

[Fuzzy Lookup 1 [3067]] Warning: Not enough storage is available to complete this operation.

[DTS.Pipeline] Warning: A call to the ProcessInput method for input 3068 on component "Fuzzy Lookup 1" (3067) unexpectedly kept a reference to the buffer it was passed. The refcount on that buffer was 2 before the call, and 1 after the call returned.

[DTS.Pipeline] Error: The ProcessInput method on component "Fuzzy Lookup 1" (3067) failed with error code 0x8007000E. The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.

[DTS.Pipeline] Error: Thread "WorkThread0" has exited with error code 0x8007000E.

[OLE DB Source [1923]] Error: The attempt to add a row to the Data Flow task buffer failed with error code 0xC0047020.

[DTS.Pipeline] Error: The PrimeOutput method on component "OLE DB Source" (1923) returned error code 0xC02020C4. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.

[DTS.Pipeline] Error: Thread "SourceThread0" has exited with error code 0xC0047038.

[DTS.Pipeline] Error: Thread "WorkThread1" received a shutdown signal and is terminating. The user requested a shutdown, or an error in another thread is causing the pipeline to shutdown.

[DTS.Pipeline] Error: Thread "WorkThread1" has exited with error code 0xC0047039.

|||

Pls check to see whether http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=191199&SiteID=1 helps.

Thanks

Wenyang

|||

I found that thread after posting and tried the solutions there, but they had no effect on the package. It still almost linearly eats up all virtual memory. By the time it is at 800k records, it has eaten up 40gb of virtual memory.

The server is:

Dual AMD 64bit Processors

2TB storage with 650GB free

8GB ram

Windows Server 2003 64bit

SQL Server 2005 64bit

Of note also is that I have tried running the package from the command line with identical results. Here is what I used:

dtexec /f package1.dtsx /ref n

|||I had the VM size increased to 200gb and I can do 3m sets now. It still isn't to where I need to to be for automation, but it will let me get the job done for now. If anyone has some ideas on what might be wrong, please please let me know!!|||

Hey James,

Did you have any luck with this? I'm in exactly the same situation you are in regarding fuzzy lookup taking all memory. If you or anyone else figured out a work around it would be great to hear.

Thanks,

SL

|||There's been fixes for memory leak issues with the fuzzy components in the past. Could you check KB 912423: "FIX: Memory leaks occur when you use Fuzzy Lookup and Fuzzy Grouping to transform a SQL Server 2005 Integration Services package"?

Fuzzy grouping matching nulls to empty strings/spaces

Will the fuzzy grouping task match a null value to an empty string (or spaces)? I've got 5 columns I'm matching on, and one of them may be null for certain rows but an empty string for others. Given the 4 other columns may match, will this difference stop similar columns being grouped together?

(Someone's modified my grouped data since it was deduped, which takes a while, and I'm hoping for a quick answer on this).

Thanks in advance.

Ben

Not sure, but building a quick package and adding a data viewer should give you the answer.

I would hope that a NULL wouldn't match to spaces...

Couldn't you run an update query to "fix" the data?|||

Computer says "no"

<cough>

No duplicate matching between null and empty string/spaces, as you suspected. Thanks for the idea of the quick test - seems obvious in retrospect, if only it had been beforehand Smile Unfortunately I can't fix the data, other than rerunning the grouping task, but good to know the source of the problem - thanks Phil!

Friday, February 24, 2012

full-text search and wildcard

hello,

i want to search for "any phrase here*" where i want it to match the exact same phrase and followed by anything. but the problem is that when using the following syntax: contains(myTbl,'"my phrase here*"') i will get results like "my123 phrases here" so the wildcard will be applied to the consecutive words and not the last word.

How can i search for an exact phrase followed by anything?

ps: i cant omit the wildcard becoz the last word is not exact

so treating the space as any other character and not as a seperator in the search_expression may be a solution but how to do it

Thanks
samhamMaybe this would work?

where PATINDEX ( 'any phrase here%' , YourTextColumn) <> 0|||patindex has nothing to do with full-text search functionality|||thx blindman for the reply but as ms_sql_dba said this is not full-text search, using the full-text search functionality is a must|||I guess I don't understand why, if the full-text search logic is too fuzzy for your requirements, you can't use a normal character-string searching function.|||i wanted to make my search as fast as possible but it seems that full-text search is a wrong decision in my case becoz am searching in a column containing file Path which contains back slashes and back slashes r considered as white spaces while indexing so my search wont be accurate anyway.

becoz the following 2 path will be the same if using fts:

folder 1/folder 2
and
folder/1/folder 2

so i'll give up using fts

:(