Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Does left right position matter on joined table/views
Hello everyone,
I am working to make my data access faster. I have combinations of table joins and views joined to other tables. I have added compound indexes for all my joins and where conditions.
(1) My question is does the left or right table position in a join condition matter?
For example:
(A) Select * from table1 inner join table 2 on table1.field1 == table2.field1
Verses:
(B) Select * from table1 inner join table 2 on table2.field1 == table1.field1
Are (A) and (B) equivalent? Does it matter that table1 was listed first so table1 in the join should be listed first?
Sometimes I have a view in place of table1 (which have no indexes), but table2 still does.
(2) I know FoxPro always looks at the left side of an equal sign for any existing indexes for where conditions, but is that the same for join conditions where the left side (view side) has no indexes or will it see and actually use the indexes on the right side (table2)?
For example:
(C) Select * from View1 inner join table 2 on View1.field1 == table2.field1
Verses:
(D) Select * from View1 inner join table 2 on table2.field1 == View1.field1
Will example (D) perform better than (C) based on the left side available indexes still on the table2?
If you know the answer to these issues I would appreciate learning from your experience.
Thanks Gary.
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement