Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Speed Test
Message
De
04/08/2000 07:51:45
 
 
À
04/08/2000 07:13:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00400917
Message ID:
00400927
Vues:
18
>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

Kevin,

Both Skip and While commands are not rushmore optimized and do not take advantage of indexes. Scan and select will utilise indexes where possible to maximise performance, seek is Rushmore optimized.

You could also write you're code like this...

SELECT ChildTable
SCAN FOR ForKey = ParentTable.PriKey
**** Some Code Here ****
ENDSCAN

Mace
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform