Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
User Defined Function in Index....Rushmore ?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00131555
Message ID:
00131566
Vues:
23
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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform