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
18/03/2005 11:06:02
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:
00997275
Views:
10
This message has been marked as the solution to the initial question of the thread.
>Hilmar
>
>>It seems it is the last SELECT statement that takes too long, right?
>>
>>Do you have indices on the most important expressions?
>
>Yes I have the table indexed (see line 2)
>
>>>Select RZSTOP
>>>Set Order To RGDSNum && RTE_NO+RTE_LET+DIRECTN+STR(SEQNO,4)+STR(NUMBER,

If you have an index on the combined expression, a SEEK on the combined expression would be extremely fast. On the other hand, this index would not be used to optimize the SELECT statement as you posted it. For example, an index on Field1 + Field2 would only be used if you include a WHERE Field1 + Field2 = ...". IOW, the index has to exactly match part of the WHERE clause, or all of it.

>Well, as there could be many J rec's with the same RTE_NO + RTE_LET + DIRECTN (c.f. Composite PK), but, of course, incrementally differnnet SEQNOs, do you mean I should knock off the PK?

No, apart from the fact that you need it, the primary key has unique value, and will cause no problem. I mean to knock of indices that have only a few possible values.
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
Next
Reply
Map
View

Click here to load this message in the networking platform