测试cache对sequence的影响。
环境:
oracle 10.2.0.3.0 RAC
两台小机 4C 8G
测试 开两个窗口 多次同时执行取平均值
create sequence sno nocache; -- 1分.03
create sequence s20 cache 20; -- 2.08 秒
create sequence s100 cache 100; -- .04
create sequence s1000 cache 1000; -- .03
create sequence snor nocache order ; -- 1分.03
create sequence s20r cache 20 order; -- 4.06
create sequence s100r cache 100 order; -- 2.02
create sequence s1000r cache 1000 order; -- 2.00
------------
挨个执行
declare
n number;
begin
for i in 0..10000 loop
select s1000r.nextval into n from dual;
end loop;
end;
/
------------
清理
drop sequence sno;
drop sequence s20;
drop sequence s100;
drop sequence s1000;
drop sequence snor;
drop sequence s20r;
drop sequence s100r;
drop sequence s1000r;
结论:创建sequence时用cache 100 order ,速度与原先的cache 20相当,而且解决避免rac环境中的不顺序生成问题。
阅读(4094) | 评论(1) | 转发(0) |