Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What is the best index expression?
Message
From
18/04/2005 14:35:13
 
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:
01005918
Views:
22
My vote would go to this solution:
*-- Have an index on these two fields:

INDEX ON EMPTY (InsCommand) TAG E_InsCmd
INDEX ON SearchTB TAG SearchTB
SET ORDER TO

*-- Scan the table

SCAN FOR SearchTB = m.lcSearch AND NOT EMPTY (InsCommand)
   ...

   IF m.plError
      EXIT
   ENDIF
ENDSCAN
>Right now I just have an index on SearchTB. I'm thinking, do I need to try to optimize the rest of the expression, e.g. have an index on empty(InsCommand) as you suggest or use the scan for as it is or do the check inside the scan...
>
>Or use the "scan while" technique and use filtered index.
>
>I just can not test every possible scenario, and these tests are very costly...
>
>>>I'm thinking, could it be better to use filtered index instead.
>>>
>>>E.g. currently I do:
>scan for m.plError=.f. and SearchTB = m.lcSearch and not empty(InsCommand)
>May be it would be faster to set a filtered index and do seek, when scan while?
>>>
>>>However, as I recall, I tried similar idea (in another context, though) and it actually slowed it down.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform