达梦V8大规模并行处理 MPP 主库和从库正常的情况下,不同场景的SQL执行情况

结论

在这里插入图片描述

测试脚本


cat > b.sql <<EOF
drop table if exists t01;

drop table  if exists t01_hash;

create table t10 (id int);

create table t10_hash (id int,name varchar2(50)) DISTRIBUTED BY HASH (id);

insert into t10 values(1);

commit;

insert into t10_hash values (2001,'name2001');

commit;

create table t01 (id int);

create table t01_hash (id int,name varchar2(50)) DISTRIBUTED BY HASH (id);


insert into t01 values(2);

commit;

insert into t01_hash values (2001,'name2001');

commit;


begin
for i in 1..5000 loop
insert into t01 values (i);
end loop;
commit;
end;
/

begin
for i in 1..5000 loop
insert into t01_hash values (i,'C'||i);
end loop;
commit;
end;
/


select count(*) from t10;

select count(*) from t10_hash;

select count(*) from t01;

select count(*) from t01_hash;

EOF

cat > a.sql <<EOF
drop table if exists t01;

drop table  if exists t01_hash;

create table t01 (id int);

create table t01_hash (id int,name varchar2(50)) DISTRIBUTED BY HASH (id);


insert into t01 values(2);

commit;

insert into t01_hash values (2001,'name2001');

commit;

begin
for i in 1..5000 loop
insert into t01 values (i);
end loop;
commit;
end;
/

begin
for i in 1..5000 loop
insert into t01_hash values (i,'C'||i);
end loop;
commit;
end;
/




select count(*) from t01;

select count(*) from t01_hash;

EOF

primary,global模式

SQL> 
SQL> `a.sql
SQL> drop table if exists t01;
executed successfully
used time: 47.340(ms). Execute id is 193769.
SQL> drop table  if exists t01_hash;
executed successfully
used time: 51.277(ms). Execute id is 193770.
SQL> create table t01 (id int);
executed successfully
used time: 23.462(ms). Execute id is 193771.
SQL> create table t01_hash (id int,name varchar2(50)) DISTRIBUTED BY HASH (id);
executed successfully
used time: 23.316(ms). Execute id is 193772.
SQL> insert into t01 values(2);
affect rows 1

used time: 3.495(ms). Execute id is 497143.
SQL> commit;
executed successfully
used time: 2.385(ms). Execute id is 497144.
SQL> insert into t01_hash values (2001,'name2001');
affect rows 1

used time: 0.443(ms). Execute id is 497146.
SQL> commit;
executed successfully
used time: 2.598(ms). Execute id is 497147.
SQL> begin
for i in 1..5000 loop
insert into t01 values (i);
end loop;
commit;
end;
DMSQL executed successfully
used time: 00:00:01.838. Execute id is 502148.
SQL> begin
for i in 1..5000 loop
insert into t01_hash values (i,'C'||i);
end loop;
commit;
end;
DMSQL executed successfully
used time: 00:00:01.742. Execute id is 507149.
SQL> select count(*) from t01;

LINEID     COUNT(*)            
---------- --------------------
1          5001

used time: 2.585(ms). Execute id is 507151.
SQL> select count(*) from t01_hash;

LINEID     COUNT(*)            
---------- --------------------
1          5001

used time: 2.423(ms). Execute id is 507153.
SQL> 

primary,local模式

SQL> 
SQL> `b.sql
SQL> drop table if exists t01;
drop table if exists t01;
[-5027]:DDL operation is forbidden under mpp local mode.
used time: 0.279(ms). Execute id is 0.
SQL> drop table  if exists t01_hash;
drop table  if exists t01_hash;
[-5027]:DDL operation is forbidden under mpp local mode.
used time: 0.291(ms). Execute id is 0.
SQL> create table t10 (id int);
create table t10 (id int);
[-5027]:DDL operation is forbidden under mpp local mode.
used time: 0.337(ms). Execute id is 0.
SQL> create table t10_hash (id int,name varchar2(50)) DISTRIBUTED BY HASH (id);
create table t10_hash (id int,name varchar2(50)) DISTRIBUTED BY HASH (id);
[-5027]:DDL operation is forbidden under mpp local mode.
used time: 0.201(ms). Execute id is 0.
SQL> insert into t10 values(1);
insert into t10 values(1);
[-2106]:Error in line: 1
Invalid table or view name [T10].
used time: 0.182(ms). Execute id is 0.
SQL> commit;
executed successfully
used time: 0.253(ms). Execute id is 132937.
SQL> insert into t10_hash values (2001,'name2001');
insert into t10_hash values (2001,'name2001');
[-2106]:Error in line: 1
Invalid table or view name [T10_HASH].
used time: 0.153(ms). Execute id is 0.
SQL> commit;
executed successfully
used time: 0.339(ms). Execute id is 132938.
SQL> create table t01 (id int);
create table t01 (id int);
[-2124]:Error in line: 1
Object [T01] already exists.
used time: 0.113(ms). Execute id is 0.
SQL> create table t01_hash (id int,name varchar2(50)) DISTRIBUTED BY HASH (id);
create table t01_hash (id int,name varchar2(50)) DISTRIBUTED BY HASH (id);
[-2124]:Error in line: 1
Object [T01_HASH] already exists.
used time: 0.350(ms). Execute id is 0.
SQL> insert into t01 values(2);
affect rows 1

used time: 0.536(ms). Execute id is 132939.
SQL> commit;
executed successfully
used time: 1.730(ms). Execute id is 132940.
SQL> insert into t01_hash values (2001,'name2001');
affect rows 1

used time: 0.557(ms). Execute id is 132941.
SQL> commit;
executed successfully
used time: 1.716(ms). Execute id is 132942.
SQL> begin
for i in 1..5000 loop
insert into t01 values (i);
end loop;
commit;
end;
DMSQL executed successfully
used time: 48.104(ms). Execute id is 132943.
SQL> begin
for i in 1..5000 loop
insert into t01_hash values (i,'C'||i);
end loop;
commit;
end;
begin
for i in 1..5000 loop
insert into t01_hash values (i,'C'||i);
end loop;
commit;
end;
[-9515]:Data is not belong to this site on mpp local login.
used time: 0.498(ms). Execute id is 0.
SQL> select count(*) from t10;
select count(*) from t10;
[-2106]:Error in line: 1
Invalid table or view name [T10].
used time: 0.242(ms). Execute id is 0.
SQL> select count(*) from t10_hash;
select count(*) from t10_hash;
[-2106]:Error in line: 1
Invalid table or view name [T10_HASH].
used time: 0.154(ms). Execute id is 0.
SQL> select count(*) from t01;

LINEID     COUNT(*)            
---------- --------------------
1          6268

used time: 0.337(ms). Execute id is 132945.
SQL> select count(*) from t01_hash;

LINEID     COUNT(*)            
---------- --------------------
1          1252

used time: 0.248(ms). Execute id is 132946.
SQL>  

standby,global模式

SQL> 
SQL> `b.sql
SQL> drop table if exists t01;
drop table if exists t01;
[-710]:Try to modify user database at standby mode.
used time: 0.866(ms). Execute id is 0.
SQL> drop table  if exists t01_hash;
drop table  if exists t01_hash;
[-710]:Try to modify user database at standby mode.
used time: 0.536(ms). Execute id is 0.
SQL> create table t10 (id int);
create table t10 (id int);
[-710]:Try to modify user database at standby mode.
used time: 0.300(ms). Execute id is 0.
SQL> create table t10_hash (id int,name varchar2(50)) DISTRIBUTED BY HASH (id);
create table t10_hash (id int,name varchar2(50)) DISTRIBUTED BY HASH (id);
[-710]:Try to modify user database at standby mode.
used time: 0.467(ms). Execute id is 0.
SQL> insert into t10 values(1);
insert into t10 values(1);
[-2106]:Error in line: 1
Invalid table or view name [T10].
used time: 0.234(ms). Execute id is 0.
SQL> commit;
executed successfully
used time: 0.444(ms). Execute id is 81904.
SQL> insert into t10_hash values (2001,'name2001');
insert into t10_hash values (2001,'name2001');
[-2106]:Error in line: 1
Invalid table or view name [T10_HASH].
used time: 0.331(ms). Execute id is 0.
SQL> commit;
executed successfully
used time: 1.279(ms). Execute id is 81905.
SQL> create table t01 (id int);
create table t01 (id int);
[-710]:Try to modify user database at standby mode.
used time: 0.639(ms). Execute id is 0.
SQL> create table t01_hash (id int,name varchar2(50)) DISTRIBUTED BY HASH (id);
create table t01_hash (id int,name varchar2(50)) DISTRIBUTED BY HASH (id);
[-710]:Try to modify user database at standby mode.
used time: 0.262(ms). Execute id is 0.
SQL> insert into t01 values(2);
insert into t01 values(2);
[-2018]:Error in line: 1
Try to insert/update/delete table table is not temporary or contains lob on standby mode.
used time: 0.616(ms). Execute id is 0.
SQL> commit;
executed successfully
used time: 0.726(ms). Execute id is 81906.
SQL> insert into t01_hash values (2001,'name2001');
insert into t01_hash values (2001,'name2001');
[-2018]:Error in line: 1
Try to insert/update/delete table table is not temporary or contains lob on standby mode.
used time: 0.441(ms). Execute id is 0.
SQL> commit;
executed successfully
used time: 0.435(ms). Execute id is 81907.
SQL> begin
for i in 1..5000 loop
insert into t01 values (i);
end loop;
commit;
end;
begin
for i in 1..5000 loop
insert into t01 values (i);
end loop;
commit;
end;
[-2018]:Error in line: 3
Try to insert/update/delete table table is not temporary or contains lob on standby mode.
used time: 0.466(ms). Execute id is 0.
SQL> begin
for i in 1..5000 loop
insert into t01_hash values (i,'C'||i);
end loop;
commit;
end;
begin
for i in 1..5000 loop
insert into t01_hash values (i,'C'||i);
end loop;
commit;
end;
[-2018]:Error in line: 3
Try to insert/update/delete table table is not temporary or contains lob on standby mode.
used time: 0.353(ms). Execute id is 0.
SQL> select count(*) from t10;
select count(*) from t10;
[-2106]:Error in line: 1
Invalid table or view name [T10].
used time: 0.405(ms). Execute id is 0.
SQL> select count(*) from t10_hash;
select count(*) from t10_hash;
[-2106]:Error in line: 1
Invalid table or view name [T10_HASH].
used time: 0.317(ms). Execute id is 0.
SQL> select count(*) from t01;

LINEID     COUNT(*)            
---------- --------------------
1          6268

used time: 1.063(ms). Execute id is 81908.
SQL> select count(*) from t01_hash;

LINEID     COUNT(*)            
---------- --------------------
1          1252

used time: 0.873(ms). Execute id is 81909.
SQL> 

standby,local模式

SQL> 
SQL> `b.sql
SQL> drop table if exists t01;
drop table if exists t01;
[-710]:Try to modify user database at standby mode.
used time: 0.500(ms). Execute id is 0.
SQL> drop table  if exists t01_hash;
drop table  if exists t01_hash;
[-710]:Try to modify user database at standby mode.
used time: 0.255(ms). Execute id is 0.
SQL> create table t10 (id int);
create table t10 (id int);
[-710]:Try to modify user database at standby mode.
used time: 0.367(ms). Execute id is 0.
SQL> create table t10_hash (id int,name varchar2(50)) DISTRIBUTED BY HASH (id);
create table t10_hash (id int,name varchar2(50)) DISTRIBUTED BY HASH (id);
[-710]:Try to modify user database at standby mode.
used time: 0.280(ms). Execute id is 0.
SQL> insert into t10 values(1);
insert into t10 values(1);
[-2106]:Error in line: 1
Invalid table or view name [T10].
used time: 0.551(ms). Execute id is 0.
SQL> commit;
executed successfully
used time: 0.434(ms). Execute id is 83404.
SQL> insert into t10_hash values (2001,'name2001');
insert into t10_hash values (2001,'name2001');
[-2106]:Error in line: 1
Invalid table or view name [T10_HASH].
used time: 0.462(ms). Execute id is 0.
SQL> commit;
executed successfully
used time: 0.275(ms). Execute id is 83405.
SQL> create table t01 (id int);
create table t01 (id int);
[-710]:Try to modify user database at standby mode.
used time: 0.301(ms). Execute id is 0.
SQL> create table t01_hash (id int,name varchar2(50)) DISTRIBUTED BY HASH (id);
create table t01_hash (id int,name varchar2(50)) DISTRIBUTED BY HASH (id);
[-710]:Try to modify user database at standby mode.
used time: 0.475(ms). Execute id is 0.
SQL> insert into t01 values(2);
insert into t01 values(2);
[-2018]:Error in line: 1
Try to insert/update/delete table table is not temporary or contains lob on standby mode.
used time: 0.288(ms). Execute id is 0.
SQL> commit;
executed successfully
used time: 0.583(ms). Execute id is 83406.
SQL> insert into t01_hash values (2001,'name2001');
insert into t01_hash values (2001,'name2001');
[-2018]:Error in line: 1
Try to insert/update/delete table table is not temporary or contains lob on standby mode.
used time: 0.316(ms). Execute id is 0.
SQL> commit;
executed successfully
used time: 0.302(ms). Execute id is 83407.
SQL> begin
for i in 1..5000 loop
insert into t01 values (i);
end loop;
commit;
end;
begin
for i in 1..5000 loop
insert into t01 values (i);
end loop;
commit;
end;
[-2018]:Error in line: 3
Try to insert/update/delete table table is not temporary or contains lob on standby mode.
used time: 0.350(ms). Execute id is 0.
SQL> begin
for i in 1..5000 loop
insert into t01_hash values (i,'C'||i);
end loop;
commit;
end;
begin
for i in 1..5000 loop
insert into t01_hash values (i,'C'||i);
end loop;
commit;
end;
[-2018]:Error in line: 3
Try to insert/update/delete table table is not temporary or contains lob on standby mode.
used time: 0.393(ms). Execute id is 0.
SQL> select count(*) from t10;
select count(*) from t10;
[-2106]:Error in line: 1
Invalid table or view name [T10].
used time: 0.273(ms). Execute id is 0.
SQL> select count(*) from t10_hash;
select count(*) from t10_hash;
[-2106]:Error in line: 1
Invalid table or view name [T10_HASH].
used time: 0.224(ms). Execute id is 0.
SQL> select count(*) from t01;

LINEID     COUNT(*)            
---------- --------------------
1          6268

used time: 0.295(ms). Execute id is 83408.
SQL> select count(*) from t01_hash;

LINEID     COUNT(*)            
---------- --------------------
1          1252

used time: 0.256(ms). Execute id is 83409.
SQL> 

达梦在线服务平台:https://eco.dameng.com

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值