【发布时间】:2014-08-27 22:07:47
【问题描述】:
我有一个包含 1M 行的 Oracle 表。我在 SAS 中有一个 oracle 表的子集,其中有 3000 行。我想从 oracle 表中删除这 3000 行。
Oracle Table columns are
Col1 Col2 Col3 timestamp
SAS Table columns are:
Col1 Col2 Col3
Oracle 表唯一的附加列是时间戳。这是我目前使用的代码,但它需要很多时间。
libname ora oracle user='xxx' password='ppp' path = abcd;
PROC SQL;
DELETE from ora.oracle_table a
where exists (select * from sas_table b where a.col1=B.col1 AND a.col2=B.col2 AND A.col3=B.col3 );
QUIT;
请告知如何使其更快、更高效。
谢谢!
【问题讨论】:
-
表有主键吗?
-
没有。三列组合构成主键。
-
Oracle中col1、2、3是否有联合索引?
-
Oracle中有联合索引。