Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MySQL index key which one is the right way?
Message
 
 
À
11/05/2012 06:46:23
Hee Lim Wang
Fantasy Software Enterprise
Malaisie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01543457
Message ID:
01543459
Vues:
36
>Hi all !
>in MySQL table index key which one is the right way ?
>key (branch)
>key (reference)
>key (date)
>select * from transaction where branch=?m.branch and reference=?m.ref and date=?m.date order by branch,reference,date
>or
>key (branch,reference,date)
>select * from transaction where branch=?m.branch and reference=?m.ref and date=?m.date order by branch

It depends on your queries. If you always select based on all 3 keys, then the second variation is correct (you need to put the column which is most selective first). If you anticipate queries based on 1 key, then the first variation will be good.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform