Oracle SQL全外部联接 [英] Oracle SQL full outer join
本文介绍了Oracle SQL全外部联接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用FULL OUTER JOIN连接了2个表,这花了6分钟来运行并给出输出.
I was joining 2 tables using FULL OUTER JOIN which took 6 minutes to run and give the output.
SELECT *
FROM tab1 FULL OUTER JOIN tab2
ON tab1.id = tab2.id
;
我使用LEFT OUTER JOIN和RIGHT OUTER JOIN的UNION做了同样的事情.只花了15秒
I did the same thing using UNION of LEFT OUTER JOIN and RIGHT OUTER JOIN. This took only 15 seconds
SELECT *
FROM tab1, tab2
WHERE tab1.id (+) = tab2.id
UNION
SELECT *
FROM tab1, tab2
WHERE tab1.id = tab2.id (+)
;
有人知道为什么会这样吗?
Does anyone know why this is happening?
推荐答案
两个表中可能都有很多行,共有几行,并且所讨论的列上没有索引.
You probably have a lot of rows in both tables, few rows in common, and no index on the columns in question.
这篇关于Oracle SQL全外部联接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文