建索引,再分析一下表。 create index idx_archives_file_file_id on archives_file(file_id); create index idx_tmp_a_file_id on tmp_a (file_id);analyze table archives_file compute statistics for table for indexes for all indexed columns /analyze table tmp_a compute statistics for table for indexes for all indexed columns /
如上所说,在两个表上创建索引是必要的。 这里提供ORACLE中的一种方法:select 'delete from archives_file where rowid = ' || rowid || '; commit;' from archives_file a, tmp_a b where a.file_id=b.file_id;用SPOOL在SQL PLUS中保存到文件,然后执行该文件即可,效率应该不错。如果进一步提高,那么可以考虑每隔一段加一个commit;而不是每个语句提交。
create index idx_archives_file_file_id on archives_file(file_id);
create index idx_tmp_a_file_id on tmp_a (file_id);analyze table archives_file compute statistics
for table
for indexes
for all indexed columns
/analyze table tmp_a compute statistics
for table
for indexes
for all indexed columns
/
这里提供ORACLE中的一种方法:select 'delete from archives_file where rowid = ' || rowid || '; commit;'
from archives_file a, tmp_a b
where a.file_id=b.file_id;用SPOOL在SQL PLUS中保存到文件,然后执行该文件即可,效率应该不错。如果进一步提高,那么可以考虑每隔一段加一个commit;而不是每个语句提交。