Hope4You Posted June 23, 2011 Share Posted June 23, 2011 I have a question concerning indexing INNER JOIN rows: Example: Table1 has a column "countryKey" (INT), and a column "name" (TEXT). Table2 also has a column "countryKey" (INT), and a column "zipcode" (TEXT). An INNER JOIN query using these tables would look something like this: SELECT Table1.name, Table2.zipcode FROM Table1 INNER JOIN Table2 USING(countryKey). My question: should I index the countryKey column in Table1, Table2, or both? Link to comment Share on other sites More sharing options...
Larry Posted June 24, 2011 Share Posted June 24, 2011 Both. Always make sure columns used as the basis of JOINs have indexes on them (on both). Good question! Link to comment Share on other sites More sharing options...
Recommended Posts