performance of two columns

Tools & Utilities
Enthusiast

performance of two columns

Hi,

could you please let me know whether there will be any difference in performance between the following two queries. As i don't have any internal knowledge about sql, i have this doubt.

table A: column alpha has 100 million records

table B: column beta has 45 million records 

Query 1

SELECT 
A.alpha
FROM A
WHERE
A.alpha = B.beta

Query 2

SELECT 
A.alpha
FROM A
WHERE
B.beta = A.alpha

will query 2 run faster than query 1 ?

Thank you.

2 REPLIES
Senior Supporter

Re: performance of two columns

Test your self by checking the explain

So run

explain
SELECT
A.alpha
FROM A
WHERE
A.alpha = B.beta

and

Explain
SELECT
A.alpha
FROM A
WHERE
B.beta = A.alpha

if the plan is the same - which I would expect - no differences can be expected.

If it is different you might also see some differences in the real resource consumption.

Enthusiast

Re: performance of two columns

i tried it.

the results were same.

Thank you!