2. DML操作的基本测试
在达梦中创建数据表以及进行基本的过程编写符合标准,完全可以和Oracle通用。在ISQL中,缺省的会显示每个操作步骤的时间,以毫秒显示。
以下创建一个基本的测试表,做出一点简单的测试:
SQL>CREATE TABLE EYGLE (
2 ID NUMBER,
3 NAME VARCHAR2(30),
4 MAIL VARCHAR2(60),
5 PHONE VARCHAR2(60),
6 LDATE DATE);
CREATE TABLE EYGLE (
ID NUMBER,
NAME VARCHAR2(30),
MAIL VARCHAR2(60),
PHONE VARCHAR2(60),
LDATE DATE);
time used: 1.860(ms) clock tick:3364215.
SQL>SELECT * FROM EYGLE;
SELECT * FROM EYGLE;
ID NAME MAIL PHONE LDATE
0 rows got
time used: 0.850(ms) clock tick:1727965.
2 ID NUMBER,
3 NAME VARCHAR2(30),
4 MAIL VARCHAR2(60),
5 PHONE VARCHAR2(60),
6 LDATE DATE);
CREATE TABLE EYGLE (
ID NUMBER,
NAME VARCHAR2(30),
MAIL VARCHAR2(60),
PHONE VARCHAR2(60),
LDATE DATE);
time used: 1.860(ms) clock tick:3364215.
SQL>SELECT * FROM EYGLE;
SELECT * FROM EYGLE;
ID NAME MAIL PHONE LDATE
0 rows got
time used: 0.850(ms) clock tick:1727965.
通过一个Loop循环,插入10万条测试记录,耗时大约1841 ms:
SQL>begin
2 for i in 1 .. 100000 loop
3 insert into eygle values(i,'eygle','eygle@eygle.com','13911812803',sysdate);
4 end loop;
5 end;
6 /
begin
for i in 1 .. 100000 loop
insert into eygle values(i,'eygle','eygle@eygle.com','13911812803',sysdate);
end loop;
end;
1 rows affected
time used: 1841.828(ms) clock tick:3771986460.
SQL>select * from eygle where rownum <2;
select * from eygle where rownum <2;
ID NAME MAIL PHONE LDATE
1 1 eygle eygle@eygle.com 13911812803 2010-04-19
1 rows got
time used: 1.577(ms) clock tick:3217072.
2 for i in 1 .. 100000 loop
3 insert into eygle values(i,'eygle','eygle@eygle.com','13911812803',sysdate);
4 end loop;
5 end;
6 /
begin
for i in 1 .. 100000 loop
insert into eygle values(i,'eygle','eygle@eygle.com','13911812803',sysdate);
end loop;
end;
1 rows affected
time used: 1841.828(ms) clock tick:3771986460.
SQL>select * from eygle where rownum <2;
select * from eygle where rownum <2;
ID NAME MAIL PHONE LDATE
1 1 eygle eygle@eygle.com 13911812803 2010-04-19
1 rows got
time used: 1.577(ms) clock tick:3217072.
回退这个批量的INSERT操作,需要大约325ms:
SQL>rollback;
rollback;
time used: 325.134(ms) clock tick:665851724.
rollback;
time used: 325.134(ms) clock tick:665851724.