Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What is faster, locate or seek ?
Message
From
10/03/2000 13:58:25
Walter Meester
HoogkarspelNetherlands
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00344153
Message ID:
00344338
Views:
31
Joe,

>Sometimes, and different situations call for different approaches, it makes sense to do a combination of seek and locate. For instance, this one seek might not be as fast as:

>if seek(3, "TableAlias", "myId")
> locate for myCheckNumber = 5 and between(myDate, dDate1, dDate2) while myId = 3
>endif

That's a good one !!! I never did come to this solution. I did use an empty SCAN WHILE to do the same.

>If the table will have more than a small number of records, this will almost definitely be faster.

>You would probably also want to seek on the most unique key of the conditions. In other words, if there are most likely hundreds of records with myId equaling 3 and only a few records with myCheckNumber equaling 5, you would want to do this instead:
>
>if seek(5, "TableAlias", "myCheckNumber ")
> locate for myId = 3 and between(myDate, dDate1, dDate2) while myCheckNumber = 5
>endif

Hmmm.. Using both FOR and WHILE ? I really doubt if rushmore kicks in here and uses the MyId index. I'd rather choose for making a composite index if speed really is a requirement.


Thanks for the new idea's and insights.

Walter,
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform