Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Binary index based on field value
Message
From
22/01/2007 03:03:24
 
 
To
21/01/2007 20:10:51
Neil Mc Donald
Cencom Systems P/L
The Sun, Australia
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01187555
Message ID:
01187580
Views:
17
This message has been marked as the solution to the initial question of the thread.
>Hi,
>With binary indexes are you able to create a logical binary index based on the value of a numeric field i.e. IIF(osbalance=0,.F.,.T.) and have rushmore optimize it within a select.
>i.e. Select * from invoice where osbalance=.T.
>
>It would save a lot of space in the index and should be faster as well.

Yes, you can use a binary index in this case. However, you can simplify your index expression a lot.
IIF(osbalance=0,.F.,.T.) can be simplified to osbalance#0, in other words
Index on IIF(osbalance=0,.F.,.T.) tag yourtag && will work, but "overkill"
Index on osbalance#0 tag yourtag && much shorter and faster
The same simplifiation can be used in many cases which many programmers clearly are not aware of.
lValue=.T.
?lValue=.T. && Bad code
?lValue && Good code
Unfortunately youi can not set order to a binary index, but a binary index will be used to optimize queries.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform