MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Shawn Green (MySQL) Date:August 2 2011 6:46pm
Subject:Re: Which is better
View as plain text  
On 8/2/2011 02:41, Adarsh Sharma wrote:
> Dear all,
> Just want to know which join is better for querying data faster.
> I have 2 tables A ( 70 GB ) & B ( 7 MB )
> A has 10 columns & B has 3 columns.Indexes exist on both tables's ids.
> select p.* from table A p, B q where
> or
> select p.* from table B q , A p where
> Thanks

There is no difference in performance. The optimizer will change the 
sequence it uses to read the tables according to its own rules.

If you had used STRAIGHT JOIN to force a particular execution path, the 
it would normally be faster to read the smaller table first.

Shawn Green
MySQL Principal Technical Support Engineer
Oracle USA, Inc. - Hardware and Software, Engineered to Work Together.
Office: Blountville, TN
Which is betterAdarsh Sharma2 Aug
  • RE: Which is betterShafi AHMED2 Aug
  • Too many aliases(Halász Sándor)2 Aug
    • Re: Too many aliasesRik Wasmus3 Aug
      • RE: Too many aliasesDavid Lerer3 Aug
        • RE: Too many aliasesshawn wilson3 Aug
        • RE: Too many aliasesJerry Schwartz4 Aug
      • Re: Too many aliases(Halász Sándor)4 Aug
        • RE: Too many aliasesDavid Lerer4 Aug
          • Re: Too many aliasesMike Diehl4 Aug
            • Re: Too many aliasesJohnny Withers4 Aug
              • Re: Too many aliases(Halász Sándor)6 Aug
                • Re: Too many aliasesJohnny Withers7 Aug
  • Re: Which is betterMySQL)2 Aug
    • RE: Which is betterDavid Lerer2 Aug
Re: Which is betterPrabhat Kumar2 Aug