Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is it possible to speed this loop and/or SQL up?
Message
From
21/03/2005 09:32:50
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00997258
Message ID:
00997804
Views:
10
>>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)
Previous
Reply
Map
View

Click here to load this message in the networking platform