SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


CROSS JOIN vs INNER JOIN performance issue.


CROSS JOIN vs INNER JOIN performance issue.

Author
Message
T.Ashish
T.Ashish
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1317 Visits: 607
So should I say that it is the old way of INNER JOINing tables, that will not be supported in future versions !!

Also, when we write "x IN (2,4,6)", optimizer converts it into "x=2 OR x=4 OR x=6", we can see it in execution plan. Does Sql store this optimized query somewhere?
GilaMonster
GilaMonster
SSC Guru
SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)SSC Guru (210K reputation)

Group: General Forum Members
Points: 210962 Visits: 46251
T.Ashish (5/17/2013)
So should I say that it is the old way of INNER JOINing tables, that will not be supported in future versions !!


It's the old way, but it's not deprecated.

Also, when we write "x IN (2,4,6)", optimizer converts it into "x=2 OR x=4 OR x=6", we can see it in execution plan. Does Sql store this optimized query somewhere?


The execution plan is cached in the plan cache.

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


Eugene Elutin
Eugene Elutin
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11654 Visits: 5478
T.Ashish (5/17/2013)
So should I say that it is the old way of INNER JOINing tables, that will not be supported in future versions !!

No, that's incorrect. The older (non ANSI) version of outer joins using =* and *= is deprecated. You should be able "INNER JOIN" in where clause...

Also, when we write "x IN (2,4,6)", optimizer converts it into "x=2 OR x=4 OR x=6", we can see it in execution plan. Does Sql store this optimized query somewhere?


Yes it does. In a query plan cache. You can access it using sys.dm_exec_text_query_plan

_____________________________________________
"The only true wisdom is in knowing you know nothing"
"O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
(So many miracle inventions provided by MS to us...)

How to post your question to get the best and quick help
Lynn Pettis
Lynn Pettis
SSC Guru
SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)SSC Guru (89K reputation)

Group: General Forum Members
Points: 89764 Visits: 38936
Eugene Elutin (5/17/2013)
T.Ashish (5/17/2013)
So should I say that it is the old way of INNER JOINing tables, that will not be supported in future versions !!

No, that's incorrect. The older (non ANSI) version of outer joins using =* and *= is deprecated. You should be able "INNER JOIN" in where clause...

Also, when we write "x IN (2,4,6)", optimizer converts it into "x=2 OR x=4 OR x=6", we can see it in execution plan. Does Sql store this optimized query somewhere?


Yes it does. In a query plan cache. You can access it using sys.dm_exec_text_query_plan





Actually outer joins using =*, *=, and *=* are the ANSI 89 style joins and are no longer support in SQL Server since the release of SQL Server 2005 (well, it is supported when you run in compatibility mode 80 iirc).

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search