【发布时间】:2018-01-05 14:25:20
【问题描述】:
我想知道INTERSECT 或EXISTS 在Oracle 11g 中的性能是否更好。考虑一下我有以下两个表。
Student_Master
STUDENT_ID NAME
---------- ------
STUD01 ALEX
STUD02 JAMES
STUD03 HANS
学生状态
STUDENT_ID STATUS
---------- ------
STUD01 Fail
STUD02 Pass
STUD03 Pass
考虑到表 Student_Status 与表 Student_Master 相比,表的记录数更多,以下哪个查询会执行得更好。
SELECT STUDENT_ID FROM Student_Master
INTERSECT
SELECT STUDENT_ID FROM Student_Status
SELECT STUDENT_ID FROM Student_Master M
WHERE EXISTS
(SELECT STUDENT_ID FROM Student_Status S WHERE M.STUDENT_ID=S.STUDENT_ID)
【问题讨论】:
-
您是否尝试比较解释计划?
-
要么更快,要么相同。
-
11g 的性能比什么好?
标签: sql oracle oracle11g exists intersect