Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Whole Word SQL Search Trouble
Message
 
To
31/10/1997 17:25:49
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00056125
Message ID:
00057882
Views:
39
>>Results from test:
>>
>>1) All the LIKE code missed the simple case where myfield = 'FORD' That's
>>enough to disqualify it already...
>>2) The '$' search was slightly faster at pulling 500 recs out of 10,000,
>>about .21 to .23 for LIKE on average
>>Conclusion: The '$' method is faster and more accurate. It's actually kind
>>of elegant in an odd sort of way... :~))
>
>ad 1) I should have guessed. The "%" expects something non-blank. If
>there's only "FORD" in the field (left, right or middle), there's
>nothing around it, so the LIKE clause finds nothing. If it's a feature,
>it's not really documented, and I'd rather call it a bug.
>
>ad 2) I really expected that the $ trick should work some 20% slower,
>but then... another idea. If you'll need this sort of thing real often,
>maybe you could index on " "+myfield+" " and see if it's getting any
>faster (I doubt it, but may be worth one try).

Using the '$' method is definitely slower compared to each LIKE, but when you have 3 or more ORs (and add 1 more for the myfield = 'FORD' case), the '$' method becomes the faster one...It's really not bad for small tables, less than maybe 25,000 records it's (surprisingly) virtually instant. I'll give the index a shot, though technically it probably shouldn't help (but you never know :~)). Thanks again for the idea.
The Anonymous Bureaucrat,
and frankly, quite content not to be
a member of either major US political party.
Previous
Reply
Map
View

Click here to load this message in the networking platform