[AccessD] Why is using "=" faster than "LIKE" in Dlookup orelsewhere?

Erwin Craps - IT Helps Erwin.Craps at ithelps.be
Thu Dec 4 06:10:29 CST 2003


Aha....

Better take a look at al my slow running code...
This would explain why I noticed a long time ago that I had a huge
diference in run time of a function that runs trough a large recordset.
At a moment I found out that Findfirst runs very much slower than
Dlookup.
I tought it came from having multiple parameters but what you are saying
would clearly explain my experiances from 2 years ago.

I probably would have mixed "=" and "like" in my tests.

Makes all sense now, it did took me two years....


He he



-----Oorspronkelijk bericht-----
Van: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] Namens Stuart McLachlan
Verzonden: donderdag 4 december 2003 12:31
Aan: Access Developers discussion and problem solving
Onderwerp: Re: [AccessD] Why is using "=" faster than "LIKE" in Dlookup
orelsewhere?


On 4 Dec 2003 at 11:38, Erwin Craps - IT Helps wrote:

> I was just dooing some stuff when I noticed this.
>  
> Using the = sign is much much faster in retrieving the ID than using 
> LIKE in the line below.  using "=" is instantly, using "LIKE" is 
> something between half a second and a second.
>  
> DLookup("HTML_LID", "HTML_PageTable", 
> "[ReceiveDateAndFileInArchiveDir]=" & Chr(34) & oItem.ReceivedTime &
> Chr(8) & oItem.EntryID & Chr(34))
>  
>  
> Correct me if I'm wrong but is the reason that "=" uses a bitcompare 
> and "LIKE" a databasecompare?
>  
> meaning
> using "="
> "a" <> "A"
>  
> using "LIKE"
> "a" = "A"
>  

Both "=" and "Like"  can use binary or database compare so quite 
frequently "a" ="A"  as well.

The difference is that "=" does a straight comparison of strings, 
"Like" can use wildcards and limited regular expressions, so there is 
a lot of overhead in parsing the comparison string, whether you are 
actually using these extended capabilities or not.

 
-- 
Lexacorp Ltd
http://www.lexacorp.com.pg
Information Technology Consultancy, Software Development,System 
Support.



_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


More information about the AccessD mailing list