Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rushmore with Index Set
Message
From
21/07/1999 16:41:54
Charlie Schreiner
Myers and Stauffer Consulting
Topeka, Kansas, United States
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00243464
Message ID:
00244367
Views:
26
Snipped
>I made a slight mistake in my first message, sorry, it's been a while since I looked at the code. I'll clarify for the non-believers. :)
>
Hi Lance. I'm glad you took my seriousness correctly.

>The application is written to display a large table in a grid, and the user types in a string and then I use a LOCATE to find the first record with that string. My previous post that said it was an SQL statement was wrong. Sorry to mislead all of you.

>The code looks like this:
>
> ThisForm.LockScreen = .T.
> lcOrder = ORDER()
> SET ORDER TO
> LOCATE FOR &lcSrchField = &lcSrchStr
> SET ORDER TO &lcOrder
> ThisForm.LockScreen = .F.
> IF FOUND()
> [I'm sure you get the picture...]
>
>If I take out the SET ORDER TO and just leave it in whatever order it was previously in it takes around half an hour to find (even if the order it's set to is the field I'm searching on!). Search time depends on what record number I'm searching for, I measured the network traffic and if I search for the last record it moves the entire size of the table over the network, the first record comes up in about 1 second--it's doing a sequential search.
>
I still don't believe you, but I'm having some trouble knowing what to believe. <s>. I have tested your scenario over the WAN where my speed is severely curtailed. I see much slower LOCATE performance with an order set, but it's only really, really slow the first time. If I repeat the LOCATE immediately, the performance is better, but not as good as with no order. The LOCATE I'm performing moves to a record about 90% to the bottom of the file's natural order. The file is 14.2 MB DBF with a 6.3 MB CDX. It takes over 4 minutes to get the CDX copied across the WAN, yet with an order set my locate takes about 90 seconds--no order about 2--so the table is definitly NOT getting transmitted in my case. I have no DelTag (Tag on DELETED()), do you?? Whether Deleted is set on or off doesn't seem important in my test. My guess is that VFP gets the CDX portion that has the ORDER that your SETting. It caches this CDX portion so subsequent LOCATEs are aided considerably. If the CDX is updated by a user changing or adding data, the CDX portion must be updated again. This checking to see if and cached CDX chunk is insync with the server's is why it's a bit slower than with no order.
You say LOCATE FOR Condition, and VFP gets the pointers for the records from the CDX that match your condition. But to know how to order the records, VFP needs to get the CDX chunk dealing with your desired order until it finds the pointer that is satisfied in the LOCATE. Perhaps that is what generates the traffic. This would explain why it is faster based on the sequence of the index but doesn't explain the 30 minute elapsed time for your locate. In your example, are the tables being updated constantly?
Charlie
Charlie
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform