SQL> show user
USER 为 "SYS"
SQL> alter system flush buffer_cache;
系统已更改。
SQL> alter system flush shared_pool;
系统已更改。
SQL> set time on
21:51:31 SQL> set timing on
21:51:34 SQL> merge /*+ use_merge(t tmp) */ into t_big t using t_big_tmp tmp on
(t.big_id=tmp.big_id) when not matched then insert (t.big_id,big_name) values(tm
p.big_id,tmp.big_name);
1000000 行已合并。
已用时间: 00: 00: 02.43
21:52:08 SQL> rollback;
回退已完成。
已用时间: 00: 00: 00.20
21:52:14 SQL> alter system flush buffer_cache;
系统已更改。
已用时间: 00: 00: 06.25
21:52:30 SQL> alter system flush shared_pool;
系统已更改。
已用时间: 00: 00: 00.03
21:52:37 SQL> merge /*+ use_hash(t tmp) */ into t_big t using t_big_tmp tmp on (
t.big_id=tmp.big_id) when not matched then insert (t.big_id,big_name) values(tmp
.big_id,tmp.big_name);
1000000 行已合并。
已用时间: 00: 00: 04.16
21:52:55 SQL> rollback;
回退已完成。
已用时间: 00: 00: 00.17
21:53:14 SQL> alter system flush buffer_cache;
系统已更改。
已用时间: 00: 00: 08.48
21:53:33 SQL> alter system flush shared_pool;
系统已更改。
已用时间: 00: 00: 00.01
21:53:37 SQL> merge /*+ use_nl(t tmp) */ into t_big t using t_big_tmp tmp on (t.
big_id=tmp.big_id) when not matched then insert (t.big_id,big_name) values(tmp.b
ig_id,tmp.big_name);
^C
C:\Users\123>
C:\Users\123>
C:\Users\123>
C:\Users\123>
小结:真正表100w记录,临时表无记录,二表相同表结构
二表皆无索引,use_merge>use_hash>use_nl
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9240380/viewspace-750844/
,如需转载,请注明出处,否则将追究法律责任。