Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Locate in large table
Message
From
15/04/2009 04:46:22
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01394873
Message ID:
01394912
Views:
89
This message has been marked as a message which has helped to the initial question of the thread.
>I have a very large table over 300,000 records
>
>I am using locate for command
>I can not use seek because I have conditions seek does not fulfill
>
>The first time a use the command locate,it is very slow
>
>The second time and then, locate is very fast
>
>The command is in a button of a form and table in date environment
>If I close the form, the first time I use locate it is slow again
>
>Is there any explanation for it ?

300K is not very large IMHO. I don't really have an explanation w/o knowing the indexes and the criteria you use, deleted etc (and explanation wouldn't help you much anyway).
Instead, you say that you can't use seek because it doesn't fulfill your conditions, but does current order at least fulfill part of your conditions? If it does then you can combine a seek with a locate which would be very fast. i.e:
USE (_samples+'data\orders') order tag cust_id
lcId = 'ERNSH'
seek m.lcid
locate for order_amt < 500 WHILE cust_id = m.lcid
This 'locate' Unlike:
LOCATE FOR cust_id = m.lcid and order_amt < 500
benefits from the index and does the subsequent movement in a portion of the table (where ordered records' cust_id is 'ERNSH').

Locate is said to be rushmore optimizable but I doubt and there are reasons that would beat the optimization anyway. Using seek+locate you would have at least have a controlled optimization.

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform