Unix Technical Forum

Performance between Standard Join and Inner Join

This is a discussion on Performance between Standard Join and Inner Join within the SQL Server forums, part of the Microsoft SQL Server category; --> Hello, everyone I have one question about the standard join and inner join, which one is faster and more ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-01-2008, 03:23 PM
Chamnap
 
Posts: n/a
Default Performance between Standard Join and Inner Join

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-01-2008, 03:23 PM
Ed Murphy
 
Posts: n/a
Default Re: Performance between Standard Join and Inner Join

Chamnap wrote:

> 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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-01-2008, 03:23 PM
Chamnap
 
Posts: n/a
Default Re: Performance between Standard Join and Inner Join

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-01-2008, 03:23 PM
news.onet.pl
 
Posts: n/a
Default Re: Performance between Standard Join and Inner Join

> 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


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 03-01-2008, 03:23 PM
Ed Murphy
 
Posts: n/a
Default Re: Performance between Standard Join and Inner Join

Chamnap wrote:

> 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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 03-01-2008, 03:23 PM
Dan Guzman
 
Posts: n/a
Default Re: Performance between Standard Join and Inner Join

> 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@gmail.com> wrote in message
news:1183007085.051745.221660@i38g2000prf.googlegr oups.com...
> 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
>


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 03-01-2008, 03:23 PM
Roy Harvey
 
Posts: n/a
Default Re: Performance between Standard Join and Inner Join

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

>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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 03-01-2008, 03:23 PM
Gert-Jan Strik
 
Posts: n/a
Default Re: Performance between Standard Join and Inner Join

"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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 03-01-2008, 03:24 PM
bill.bertovich@gmail.com
 
Posts: n/a
Default Re: Performance between Standard Join and Inner Join

On Jun 28, 12:38 pm, Gert-Jan Strik <s...@toomuchspamalready.nl>
wrote:
> "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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 03-01-2008, 03:24 PM
--CELKO--
 
Posts: n/a
Default Re: Performance between Standard Join and Inner Join

>> 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.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:40 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com