Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Speed Test
Message
From
04/08/2000 07:47:24
Walter Meester
HoogkarspelNetherlands
 
 
To
04/08/2000 07:13:06
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00400917
Message ID:
00400925
Views:
14
Kevin,

First off all, When using SQL-SELECT performance tests, you should be aware that VFP stores information about the SQL-SELECT statements that has been executed.

Therefore, make sure that each time you execute the SQL SELECT command you either:

- Have rebooted your computer to clean the cache.
- Alway query for another value, so VFP can't use the cached results of a former executed query.

Further, you mush ensure that the requeried table is large enough to do a fair comparision. It is known that differences between a SQL SELECT and SEEK, scan while, grow larger when the resultset is growing larger.

Also, when using a SEEK, do use a SCAN WHILE instead of a DO WHILE. Your implementation is know as being slower than a SCAN ... ENDSCAN.

Be ware that the sourcetable itself doesn't contain large amounts of delete records when SET DELETE = ON. Also if there is another filter in effect, performance of seek drops, as filters are not optimizable when using SEEK.

If your test is confirm these reqiurements, you'll see that seek is faster than using SQL - SELECT, esspecially when the resultset and/or the table is growing larger.

Walter,


>I have been debating on child records, whether to SELECT the related records or SEEK and SKIP through them.
>
>I have always regarded the SEEK as the fastest method, but have usually run SELECT INTO CURSOR, and then SCAN the cursor.
>
>I ran a simple test and the SELECT came out quicker - can this be right.
>
>Here are my 2 methods:
>
>*** SEEK Method ***
>
>SELECT ChildTable
>IF SEEK(ParentTable.PriKey)
>DO WHILE ChildTable.ForKey = ParentTable.PriKey
>**** Some Code Here ****
>SKIP
>ENDDO
>*******************
>
>*** SELECT Method ***
>
>SELECT * FROM ChildTable;
>WHERE ForKey = ParentTable.PriKey;
>INTO CURSOR Cursor1
>
>SELECT Cursor1
>SCAN
>**** Some Code Here ****
>ENDSCAN
>*********************
>
>
>Could someone advise me if this is correct - why would the SEEK be slower if the SELECT has to input the Query into a CURSOR and then SCAN?
>
>Replies much appreciated
>Thanks
>Kev
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform