Query Performance

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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")
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top