dbTalk Databases Forums  

Performance between Standard Join and Inner Join

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss Performance between Standard Join and Inner Join in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Chamnap
 
Posts: n/a

Default Performance between Standard Join and Inner Join - 06-28-2007 , 12:04 AM






Hello, everyone

I have one question about the standard join and inner join, which one
is faster and more reliable? Can you recommend me to use? Please,
explain me...

Thanks
Chamnap


Reply With Quote
  #2  
Old   
Ed Murphy
 
Posts: n/a

Default Re: Performance between Standard Join and Inner Join - 06-28-2007 , 12:20 AM






Chamnap wrote:

Quote:
I have one question about the standard join and inner join, which one
is faster and more reliable? Can you recommend me to use? Please,
explain me...
If by "standard join" you mean just JOIN, then they're
identical in effect.


Reply With Quote
  #3  
Old   
Chamnap
 
Posts: n/a

Default Re: Performance between Standard Join and Inner Join - 06-28-2007 , 01:43 AM



I mean standard join by:
Select * From Quiz, Question Where Quiz.id = Question.id


Reply With Quote
  #4  
Old   
news.onet.pl
 
Posts: n/a

Default Re: Performance between Standard Join and Inner Join - 06-28-2007 , 02:33 AM



Quote:
Select * From Quiz, Question Where Quiz.id = Question.id
IMHO today inner join is a standard

BTW left join is faster than inner join...


Regards, Wojtas
www.e-krug.com




Reply With Quote
  #5  
Old   
Ed Murphy
 
Posts: n/a

Default Re: Performance between Standard Join and Inner Join - 06-28-2007 , 04:00 AM



Chamnap wrote:

Quote:
I mean standard join by:
Select * From Quiz, Question Where Quiz.id = Question.id
That's arguably not a join at all, though any reasonable database
server will optimize it into one under the covers. These days,
recommended practice is to do something like

select (list of columns)
from quiz x
join question y on x.id = y.id

For one thing, when you have a less trivial case than this example,
it makes it harder to leave out a join condition by mistake.


Reply With Quote
  #6  
Old   
Dan Guzman
 
Posts: n/a

Default Re: Performance between Standard Join and Inner Join - 06-28-2007 , 05:10 AM



Quote:
I have one question about the standard join and inner join, which one
is faster and more reliable? Can you recommend me to use? Please,
explain me...
The ANSI-92 style INNER JOIN syntax is is recommended in Microsoft SQL
Server. The older join syntax is still accepted and both should provide the
same level of performance and reliability.

In the case of OUTER JOINs, older style joins (*= and =*) are sometimes
ambiguous (unreliable) so the ANSI-92 style OUTER JOIN syntax is strongly
recommended. The older style outer joins are only allowed in databases
with compatibility level lower than 90 and may not be supported in future
SQL Server versions.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Chamnap" <chamnapchhorn (AT) gmail (DOT) com> wrote

Quote:
Hello, everyone

I have one question about the standard join and inner join, which one
is faster and more reliable? Can you recommend me to use? Please,
explain me...

Thanks
Chamnap



Reply With Quote
  #7  
Old   
Roy Harvey
 
Posts: n/a

Default Re: Performance between Standard Join and Inner Join - 06-28-2007 , 06:00 AM



On Thu, 28 Jun 2007 09:33:07 +0200, "news.onet.pl"
<wkrugiolka (AT) poczta (DOT) onet.pl> wrote:

Quote:
BTW left join is faster than inner join...
Really? What makes you think that? It is certainly not what I have
experienced, or heard about.

Roy Harvey
Beacon Falls, CT


Reply With Quote
  #8  
Old   
Gert-Jan Strik
 
Posts: n/a

Default Re: Performance between Standard Join and Inner Join - 06-28-2007 , 02:38 PM



"news.onet.pl" wrote:
Quote:
Select * From Quiz, Question Where Quiz.id = Question.id

IMHO today inner join is a standard

BTW left join is faster than inner join...
No it isn't.

For starters, an outer join (such as left join) will only return the
same result as an inner join if no rows from the outer table would be
eliminated when running the inner join.

Next, using inner join gives the optimizer more options how to process
the query which on average should lead to better performance then using
the outer join equivalent.

As usual, course there is a disclaimer here too. There could be
situations where the optimizer might select a suboptimal plan, or when
the optimizer shortcuts its optimization process because of the many
possible access paths. In those situations a rule based approach, or an
outer join approach might accidentally run faster.

Gert-Jan


Reply With Quote
  #9  
Old   
bill.bertovich@gmail.com
 
Posts: n/a

Default Re: Performance between Standard Join and Inner Join - 06-28-2007 , 05:42 PM



On Jun 28, 12:38 pm, Gert-Jan Strik <s... (AT) toomuchspamalready (DOT) nl>
wrote:
Quote:
"news.onet.pl" wrote:

Select * From Quiz, Question Where Quiz.id = Question.id

IMHO today inner join is a standard

BTW left join is faster than inner join...

No it isn't.

For starters, an outer join (such as left join) will only return the
same result as an inner join if no rows from the outer table would be
eliminated when running the inner join.

Next, using inner join gives the optimizer more options how to process
the query which on average should lead to better performance then using
the outer join equivalent.

As usual, course there is a disclaimer here too. There could be
situations where the optimizer might select a suboptimal plan, or when
the optimizer shortcuts its optimization process because of the many
possible access paths. In those situations a rule based approach, or an
outer join approach might accidentally run faster.

Gert-Jan
Cardinality, distribution, indexing strategy and the optimizer
strategy are the determinants. Every posting reply is correct given
the appropriate data sets. The bottom line: prototype and test in your
environment with your data sets and system loads if you want a
definitive answer.

-- Bill



Reply With Quote
  #10  
Old   
--CELKO--
 
Posts: n/a

Default Re: Performance between Standard Join and Inner Join - 06-29-2007 , 06:41 PM



Quote:
the standard join and inner join, which one is faster and more reliable?
The infixed INNER JOIN and the WHERE clause join produce the same
results. In SQL Server, they also produce the same execution plan and
I thought that the choice was a matter of style. It turns out that is
not true in DB2. A friend asked for help optimizing a very large
query for a report and found out that the older syntax did better.

I am still trying to figure out why this happened. My best guess is
that the infixed operators are required to behave as if they are
executed in left to right order. This is vital or OUTER JOINs, but
should not make a difference for INNER JOINs. But does their
optimizer (which is pretty darn good) get fooled into an acceptable
result with infixed notation, but do more investigation with a FROM
simple clause? I am still waiting to hear back from DB2 experts.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.