Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Indexed date field
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00341249
Message ID:
00341258
Vues:
19
>Is there a performance difference in creating an index on a date field as such?
>
>1) index on date tag date
>2) index on dtoc(date) tag date
>3) index on dtos(date tag date

Yep. Number 1 is the way to go unless the index is compound and the other field is a string. This is because the others require a function to be evaluated each time the index is re-built or a record is added.

Number two should be avoided since you probably won't get the records in the order that's desired. Unless the optional 1 parameter is added, the result of the function will be MM/DD/YYYY (unless SET DATE is set to something different than AMERICAN or MDY).

Number three will return a string in the format of YYYYDDMM (the same as DTOC(date, 1)), but should be only be used when the index expression contains multiple string fields.
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform