Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What is the best index expression?
Message
From
19/04/2005 05:22:51
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01005870
Message ID:
01006091
Views:
24
Hi Nadya,

(just read this thread...)
The fastest way "traditional" way would probably be "overindexing" with complex indices.
This will cost you only a little bit in creating larger cdx file size. There are some objections against creating too many indices and using a column in many times in different index expressions, but since this is a readonly table, most of these are irrelevant.

For instance to walk in the insert case
[index on upper(ChildTB) + Padl(InsTrigger, 2) tag ChildIns] && create multiple indices at design!!!
set order to ChildIns
lcSeekSearch = m.lcSearch + Padl(1, 2)
if seek(lcSeekSearch)
  scan while upper(ChildTB) + Padl(InsTrigger, 2) = m.lcSeekSearch for not m.plError
  endscan
endif
should be the most efficient code when viewed visualing the internal commands vfp has to execute on each run.

BUT sometimes using rushmore IS faster: if vfp has results from reading the cdx on a previous check still cached and decides this cache is current enough so the index isn't read again. This beats the seek()-scan while approach. Even then using only one compound index should be faster than using 2 or more. But when using rushmored "for" take care not to have set an order.
lcSeekSearch = m.lcSearch + Padl(1, 2)
scan for upper(ChildTB) + Padl(InsTrigger, 2) = m.lcSeekSearch and not m.plError
endscan
regards

thomas
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform