Query Performance

T

TomHinkle

Can Anybody tell me what performs better in a where clause looking for
several text strings:

Method 1:
Like "Example_A" or like "Example_B"

Method 2:
In ("Example_A","Example_B")
 
V

Van T. Dinh

The first method probably won't work as you exepect as you are not using
wild cards with Like.
If you don't use wild cards, Like is the same with =.

The 2nd one won't work if you look for a String like "This string contains
Example_A" or even "Example". The value must be either "Example_A" or
"Example_B".

If you meant ask the comparison between:

(FieldX = "Example_A") Or (FieldX = "Example_B")

and

FieldX In ("Example_A", "Example_B")

then the difference in execution time (if any) will be so tiny that most
users won't be able to observe it. I tend to use "In" since it is shorter
to type, especially if I have a few "Or"s.
 
Top