Skip to content
Advertisement

SQL inner join and where performance comparison

If we have 2 tables, tableA (with column1, column2) and tableB (with column1, column2), what’s the difference between the following two queries? Which one has better performance? What if we have indexing for both tables?

Query #1:

select
    b.column2
from
    tableA a,
    tableB b
where
    a.column1 = b.column1
    and a.column2 = ?;

Query #2:

select
    b.column2
from
    tableA a
inner join 
    tableB b on a.column1 = b.column1
where
    a.column2 = ?;

Advertisement

Answer

Both will perform equally. One is an ansi style and the other is old fashioned style of joining You may compare the explain plans and most likely you will find them to be the same.

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