Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
User Defined Function in Index....Rushmore ?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00131555
Message ID:
00131566
Views:
22
Renato,

A index that uses a UDF in the expression may or may not be optimizable, but either way it is NOT a good idea. Here are some reasons why this is not a good idea;

1. The expression is only evaluated when the record is updated, therefore anything that the udf does to calculate its return value will not affect existing records unless the index is totally recreated ro every record is updated somehow.

2. The table can NEVER be opened without the UDF being present.

3. The index expression is not self documenting, meaning that the purpose of the index is hidden.

4. It is too easy to make an error in the UDF that would cause index keys to vary in length, which in turn will cause errors or data access problems.

5. The simple fact that you need to run code on the data in order to index it is indicative of the overall data design being flawed.

6. It is much easier to REPLACE a field in the table with the result of the UDF and then use that for the index.

There are many other reasons to NOT use UDF's in index expressions.
Previous
Reply
Map
View

Click here to load this message in the networking platform