Skip to content
Advertisement

Syntax performance of INNER JOIN

Is the performance of both these examples the same?

Example 1:

Example 2:

I am using example #2 at the moment since I am joining 15+ tables, each table with many unnecessary columns and many rows (1 million+)

Advertisement

Answer

Oracle is smart enough and does not take all columns from table 1 and join them with all columns from table 2 and only presents the few columns you need in the result (what you probably fear)

To see it simple use explain plan of the query

You get this result

The most importat information is the column projection part where you can see that only referenced columns are considered.

You may also check the execution plan of the second query to see that except for minor details you get the same result.

So the consequence IMO would be that despite less readable query you will not see any significant difference while using query 2.

You own test should confim it.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement