Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LOCATE Issues

Status
Not open for further replies.

davidb88

Technical User
May 3, 2012
5
GB
Hello,

Are there any known issues with LOCATE?

I am experiencing an intermittent fault, whereby the locate function works instantly on the majority of occasion and then inexplicably takes about a minute to process. I am running everything locally with nothing else touching the data and no other applications running.

Thanks,

David
 
The speed of a LOCATE is very much dependent on what indexes you have in force.

If the expression in the FOR clause matches an index tag, then the LOCATE should be very fast. If it doesn't, then VFP will have to step through all the records until it finds the first one, which could be slow.

Also, make sure there is no filter in force. If there is, that's a sure way of slowing down a LOCATE.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Thanks Mike,

I have now updated the index tags, so I will see what happens. It does seem odd though, when the save takes 1 second on the majority of occasion and then randomly 1 minute.

Regards,

David
 
David,

You say it "randomly" takes a minute in some cases. Do you mean that literally? Or, can you put your finger on what is different between the one minute and the one second cases?

Also, you say the "save" takes a second. Where does a "save" come into the picture? You said you were doing a LOCATE, which doesn't save anything.

That said, do check the indexes. Let us know how that works out.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
You say it "randomly" takes a minute in some cases

I'll echo Mike's question...

Do you mean that if you do a LOCATE for something like:
Firstname = 'GEORGE' (or whatever is applicable to you)
One time it is QUICK!
And then a LOCATE for the EXACT SAME THING may take noticeably longer the next time?

Good Luck,
JRB-Bldr
 
And echo the other question: Where does a "save" come into the picture?

Bye, Olaf.
 
One thing I've personally noticed when running Vista and later Microsoft operating systems, is that the kernel itself (Windows) is sending out auto-indexing commands, or commands which utilize the hard drive in some way (SuperFetch, et al).

I've seen absolutely tremendous slowdowns (not just in VFP, but also in other C++ apps) when this happens. Tasks that read through 1000 files (about 20MB, parsing them for whatever purpose) normally takes 5-8 seconds, will sometimes take 20-30 seconds, and for no other reason that I can find other than Windows is doing something by itself in the background.

In fact, I would even suggest going so far as to try to run the same apps or perform the same tasks on a Windows XP box and see if it isn't more consistent.

I've found with Microsoft, upgrading from Windows XP is not always desirable. In fact, I typically run Linux and use Windows only in a virtual machine, which also makes a difference in performance as Linux does a lot of disk caching for you, which can greatly speedup the virtual machine to make it outperform even a native install on the same box. Linux is quite amazing in that regard.

Best regards,
Rick C. Hodgin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top