MySQL Forums
Forum List  »  Optimizer & Parser

Re: Two general MySQL questions
Posted by: KimSeong Loh
Date: January 03, 2007 06:10PM

A. table1 should have the least amount of (expected) results
Not sure about why you say this.


B. table1 should be have a good index
For the 1st table, index on the WHERE clause column, index on join column is not required.
example: select * from table1 inner join table2 on ... where table1.idx=123
This is to filter the rows in table1 first, reduce the nubmer of rows that need to be joined.


C. table2 should have a good index (with the join key in it???)
You definitely need this one, to have an index on the join column of the 2nd table to perform the join efficiently.

Options: ReplyQuote


Subject
Views
Written By
Posted
4408
January 02, 2007 09:24AM
2212
January 02, 2007 08:11PM
2186
January 03, 2007 05:35PM
Re: Two general MySQL questions
2193
January 03, 2007 06:10PM
2182
January 04, 2007 05:49AM
2220
January 04, 2007 10:53AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.