Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to optimize this simple 'inner join'?
Message
De
29/09/2000 00:35:12
 
 
À
29/09/2000 00:07:20
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00422415
Message ID:
00422430
Vues:
8
>Hi everyone.
>
>I have two tables this way:
>
>Master : Primary key = Field1 + Field2
>
>Detail : Regular index = Field1 + Field2 (Just like Master-Primary key)
>
>I am trying to see how VFP get optimized queries and found this:
>
>Select * from detail where field1+field2 = master.field1 + master.field2.
>
>It is optimized (sys(3054,1)) and works very fast, but of course, it only takes one record from master table.
>
>Now, I want all records using 'inner join' and similar expressions:
>
>Select * from master inner join detail on ;
> master.field1 + master.field2 = detail.field1 + detail.field2
>
>Optimization: None.
>Why this statement is not optimized?
>
>Thanks.
>
>Juan Carlos

Without addressing your question, why are you using compound keys? In most cases you can link tables using a single field in each - an Integer field works well for this. Indexing, JOIN syntax and getting optimized queries become very easy.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform