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

Stuart McLachlan stuart at lexacorp.com.pg
Thu Dec 4 05:31:12 CST 2003


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.





More information about the AccessD mailing list