Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is it possible to speed this loop and/or SQL up?
Message
De
21/03/2005 09:32:50
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
21/03/2005 09:10:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
00997258
Message ID:
00997804
Vues:
9
>>What is the index expression for your table?
>
>Not sure what you mean by that but the order is:
>
>Set Order To RGDSNum && RTE_NO + RTE_LET + DIRECTN + STR(SEQNO,4) + STR(NUMBER,3)

An index doesn't need to be active in order to be used for optimization - although optimization is supposed to work best if NO index order is set.

If you have this index, the WHERE clause, or part of it, must match it in order to use this index for optimization. Assuming you have the appropriate variables:
SELECT ...;
  WHERE RTE_NO + RTE_LET + DIRECTN + STR(SEQNO,4) + STR(NUMBER,3);
    = m.rte_no + m.rte_let + m.directn + str(m.seqno,4) + str(m.number,3);
  ...
On the other hand, if you already have this index active, it might be faster to just SEEK for the correct record. If there can be more than one matching record, something like this:
if seek (m.rte_no + m.rte_let...)
  scan while rte_no + rte_let ... = m.rte_no + m.rte_let...
    * Process record here
  endscan
endif
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform