Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SEEK or LOCATE?
Message
From
12/08/1999 13:30:02
 
 
To
12/08/1999 13:23:10
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00253099
Message ID:
00253103
Views:
23
>If i'm only going to search for 1-2 records which of the following two methods is best (fastest)?
>
>LOCATE FOR idnr = 'something'
>or
>SET ORDER TO idnr
>seek 'something'
>
>I've almost always used the first method simply becouse it saves one row of code... but I'm now in finetuning stage of my application and want to know which method is the fastest and how many records I must search to take great speed advantages of that method.
>
>/Mårten Törnquist

The only time that you will notice a performane difference between LOCATE and SEEK is when you are LOCATEing in a tight loop. LOCATE takes a very small amount of time longer while it scans the available indexes for one whose expression matches the expression you are LOCATEing for. The amount of time this takes is nearly insignificant, and unnoticeable on a single LOCATE. For this reason, I always use LOCATE, except when I need to change the record pointer in another work area (LOCATE has no IN clause), or when I need to know the results in the same line (then I use the SEEK() function).
Erik Moore
Clientelligence
Previous
Reply
Map
View

Click here to load this message in the networking platform