Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 175888

RE: CROSS JOIN VS INNER JOIN

$
0
0

By default the inner joins you create in Ax are converted to cross joins when you look at the SQL statements between AOS and SQL server. But if you look at the execution plan of SQL you'll notice that SQL converts the cross joins to inner joins again. This is because a cross join with a where clause will act like a inner join with an ON clause. see: technet.microsoft.com/.../ms190690(v=sql.105).aspx

What I also found is that if you mix joins (inner joins, outer joins) and exists Ax will sometimes do something completely different than you would aspect. Creating an unwanted SQL statement.

So to fully understand what the difference is between the statement created by Ax and the one you created by hand. Please compare the execution plans.

Go To Sql Server Management Studio.

Create a new Query

put both Queries in on the same new Query page.

Hit the button (estimated execution plan)

And you'll be able to compare the 2

first of all you see the difference in percentage (one taking a higher percentage of total execution time than the other, that one is slower)

In the execution plan you can also see what indexes are used by SQL for the statements, maybe it uses different ones or is missing one.(It will tell you in green text see my blog: kaya-consulting.com/view-slow-maybe-sql-missing-index-can-help-you)


Viewing all articles
Browse latest Browse all 175888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>