在探究磁盘占用的使用,一般使用查询段的大小来查询数据库对象的磁盘占用,即select sum(a.BYTES) from DBA_SEGMENTS a where a.SEGMENT_NAME in (''),但是这里为了简单方便,我们直接新建一个表空间来专门用来测试,从而直接查询表空间的占用即可,即select sum(a.BYTES-b.BYTES)/1024/1024 from DBA_DATA_FILES a,DBA_FREE_SPACE b where a.TABLESPACE_NAME=b.TABLESPACE_NAME and b.TABLESPACE_NAME='LIAOTAO_DATA';。这一点对ORACLE和达梦8都是类似的。
以下是整个的实验脚本
spool /home/dmdba/dmdbms/data/DAMENG/SPOOL.sql set linesize 800; set autocommit on; set lineshow off; declare i number:=0; begin select count(1) into i from DBA_TABLESPACES a where a.TABLESPACE_NAME='LIAOTAO_DATA'; if i>0 then for temp_user in (select a.USERNAME from dba_users a where a.DEFAULT_TABLESPACE='LIAOTAO_DATA') LOOP execute IMMEDIATE 'drop user '||temp_user.username||' CASCADE'; end loop; execute IMMEDIATE 'drop tablespace liaotao_data'; end if; execute IMMEDIATE Q'*create tablespace liaotao_data datafile 'liaotao_data.dbf' size 2048 autoextend on next 100 maxsize 10240*'; execute IMMEDIATE Q'*create user "liaotao" IDENTIFIED by "Liaotao941103" default tablespace "LIAOTAO_DATA"*'; execute IMMEDIATE Q'*grant dba,public,resource,VTI TO liaotao*'; end; / --1.根据表定义创建表,利用SQL方式往表tab_test插入10万条随机生成的数据(大字段类型不要求随机),记录插入用时和磁盘空间占用情况; create table liaotao.tab_test ( bh varchar(32) , sfzhm varchar(20) , xm varchar(200) , xb char(1) check (xb in('M', 'F')) , shengri date check (shengri between to_date('1800-01-01') and to_date('2022-01-01')), dhhm bigint , xz number(10, 2) , email varchar(100) , zhaopian blob , jianli clob , c1 dec(20, 5) , c2 float , c3 time , c4 datetime ); comment on column liaotao.tab_test.bh is '编号'; comment on column liaotao.tab_test.sfzhm is '身份证号码'; comment on column liaotao.tab_test.xm is '姓名'; comment on column liaotao.tab_test.xb is '性别'; comment on column liaotao.tab_test.shengri is '生日'; comment on column liaotao.tab_test.dhhm is '电话号码'; comment on column liaotao.tab_test.xz is '薪资'; comment on column liaotao.tab_test.email is '电子邮箱'; comment on column liaotao.tab_test.zhaopian is '照片'; comment on column liaotao.tab_test.jianli is '简历'; select sum(a.BYTES)/1024/1024,sum(a.BYTES-b.BYTES)/1024/1024 from DBA_DATA_FILES a,DBA_FREE_SPACE b where a.TABLESPACE_NAME=b.TABLESPACE_NAME and b.TABLESPACE_NAME='LIAOTAO_DATA'; insert into liaotao.tab_test select sys_guid() bh , substr(sys_guid(), 1, 20) sfzhm , sys_guid() xm , case when mod(to_number(trunc(dbms_random.value(0, 2))), 2)=0 then 'M' else 'F' end xb, SYSDATE shengri , dbms_random.value(10000, 9999999) dhhm , dbms_random.value(1, 999) xz , trunc(dbms_random.value(10000, 10000222)) ||'@qq.com' email , null zhaopian , 'what' jianli , dbms_random.value(1, 999) c1, dbms_random.value(1, 999) c2, sysdate c3 , sysdate c4 from dual connect by rownum<=100000; select sum(a.BYTES)/1024/1024,sum(a.BYTES-b.BYTES)/1024/1024 from DBA_DATA_FILES a,DBA_FREE_SPACE b where a.TABLESPACE_NAME=b.TABLESPACE_NAME and b.TABLESPACE_NAME='LIAOTAO_DATA'; --3.无索引情况下,执行查询、删除和更新部分SQL语句,并分别记录执行用时 --查询 select count(*) from liaotao.tab_test; select count(*) from liaotao.tab_test where xb='F'; select * from liaotao.tab_test where bh in (select top 10 bh from liaotao.tab_test order by dbms_random.value); select * from liaotao.tab_test where sfzhm in (select top 10 sfzhm from liaotao.tab_test order by dbms_random.value); select * from liaotao.tab_test where (shengri, xm) in (select top 10 shengri, xm from liaotao.tab_test order by dbms_random.value); --删除 delete from liaotao.tab_test where bh in (select top 10 bh from liaotao.tab_test order by dbms_random.value); delete from liaotao.tab_test where sfzhm in (select top 10 sfzhm from liaotao.tab_test order by dbms_random.value); delete from liaotao.tab_test where (shengri, xm) in (select top 10 shengri, xm from liaotao.tab_test order by dbms_random.value); --更新 update liaotao.tab_test set (SFZHM,XM,XB,SHENGRI,DHHM,XZ,EMAIL,C1,C2,C3,C4)= ( select top 1 SFZHM,XM,XB,SHENGRI,DHHM,XZ,EMAIL,C1,C2,C3,C4 from liaotao.tab_test order by dbms_random.value); --4.清空表后,在表tab_test上创建基于bh字段的唯一索引idx_bh,利用SQL或程序插入10万条记录,记录插入用时和磁盘空间占用情况; truncate table liaotao.tab_test; create unique INDEX liaotao.idx_bh on liaotao.tab_test(bh); select sum(a.BYTES)/1024/1024,sum(a.BYTES-b.BYTES)/1024/1024 from DBA_DATA_FILES a,DBA_FREE_SPACE b where a.TABLESPACE_NAME=b.TABLESPACE_NAME and b.TABLESPACE_NAME='LIAOTAO_DATA'; insert into liaotao.tab_test select sys_guid() bh , substr(sys_guid(), 1, 20) sfzhm , sys_guid() xm , case when mod(to_number(trunc(dbms_random.value(0, 2))), 2)=0 then 'M' else 'F' end xb, SYSDATE shengri , dbms_random.value(10000, 9999999) dhhm , dbms_random.value(1, 999) xz , trunc(dbms_random.value(10000, 10000222)) ||'@qq.com' email , null zhaopian , 'what' jianli , dbms_random.value(1, 999) c1, dbms_random.value(1, 999) c2, sysdate c3 , sysdate c4 from dual connect by rownum<=100000; select sum(a.BYTES)/1024/1024,sum(a.BYTES-b.BYTES)/1024/1024 from DBA_DATA_FILES a,DBA_FREE_SPACE b where a.TABLESPACE_NAME=b.TABLESPACE_NAME and b.TABLESPACE_NAME='LIAOTAO_DATA'; --5.在有一条索引的情况下,执行查询、删除和更新部分SQL语句,并分别记录执行用时; --查询 select count(*) from liaotao.tab_test; select count(*) from liaotao.tab_test where xb='F'; select * from liaotao.tab_test where bh in (select top 10 bh from liaotao.tab_test order by dbms_random.value); select * from liaotao.tab_test where sfzhm in (select top 10 sfzhm from liaotao.tab_test order by dbms_random.value); select * from liaotao.tab_test where (shengri, xm) in (select top 10 shengri, xm from liaotao.tab_test order by dbms_random.value); --删除 delete from liaotao.tab_test where bh in (select top 10 bh from liaotao.tab_test order by dbms_random.value); delete from liaotao.tab_test where sfzhm in (select top 10 sfzhm from liaotao.tab_test order by dbms_random.value); delete from liaotao.tab_test where (shengri, xm) in (select top 10 shengri, xm from liaotao.tab_test order by dbms_random.value); --更新 update liaotao.tab_test set (SFZHM,XM,XB,SHENGRI,DHHM,XZ,EMAIL,C1,C2,C3,C4)= (select top 1 SFZHM,XM,XB,SHENGRI,DHHM,XZ,EMAIL,C1,C2,C3,C4 from liaotao.tab_test order by dbms_random.value); --6.清空表后,在表tab_test上再创建基于sfzhm字段的索引idx_sfzhm,利用SQL或程序插入10万条记录,记录插入用时和磁盘空间占用情况; truncate table liaotao.tab_test; create INDEX liaotao.inx_sfzhm on liaotao.tab_test(sfzhm); select sum(a.BYTES)/1024/1024,sum(a.BYTES-b.BYTES)/1024/1024 from DBA_DATA_FILES a,DBA_FREE_SPACE b where a.TABLESPACE_NAME=b.TABLESPACE_NAME and b.TABLESPACE_NAME='LIAOTAO_DATA'; insert into liaotao.tab_test select sys_guid() bh , substr(sys_guid(), 1, 20) sfzhm , sys_guid() xm , case when mod(to_number(trunc(dbms_random.value(0, 2))), 2)=0 then 'M' else 'F' end xb, SYSDATE shengri , dbms_random.value(10000, 9999999) dhhm , dbms_random.value(1, 999) xz , trunc(dbms_random.value(10000, 10000222)) ||'@qq.com' email , null zhaopian , 'what' jianli , dbms_random.value(1, 999) c1, dbms_random.value(1, 999) c2, sysdate c3 , sysdate c4 from dual connect by rownum<=100000; select sum(a.BYTES)/1024/1024,sum(a.BYTES-b.BYTES)/1024/1024 from DBA_DATA_FILES a,DBA_FREE_SPACE b where a.TABLESPACE_NAME=b.TABLESPACE_NAME and b.TABLESPACE_NAME='LIAOTAO_DATA'; --7.在有两条索引的情况下,执行查询、删除和更新部分SQL语句,并分别记录执行用时 --查询 select count(*) from liaotao.tab_test; select count(*) from liaotao.tab_test where xb='F'; select * from liaotao.tab_test where bh in (select top 10 bh from liaotao.tab_test order by dbms_random.value); select * from liaotao.tab_test where sfzhm in (select top 10 sfzhm from liaotao.tab_test order by dbms_random.value); select * from liaotao.tab_test where (shengri, xm) in (select top 10 shengri, xm from liaotao.tab_test order by dbms_random.value); --删除 delete from liaotao.tab_test where bh in (select top 10 bh from liaotao.tab_test order by dbms_random.value); delete from liaotao.tab_test where sfzhm in (select top 10 sfzhm from liaotao.tab_test order by dbms_random.value); delete from liaotao.tab_test where (shengri, xm) in (select top 10 shengri, xm from liaotao.tab_test order by dbms_random.value); --更新 update liaotao.tab_test set (SFZHM,XM,XB,SHENGRI,DHHM,XZ,EMAIL,C1,C2,C3,C4)= (select top 1 SFZHM,XM,XB,SHENGRI,DHHM,XZ,EMAIL,C1,C2,C3,C4 from liaotao.tab_test order by dbms_random.value); --8.清空表后,在表tab_test上第三次创建基于shengri、xm两个字段的联合索引idx_sr_xm,利用SQL或程序插入10万条记录,记录插入用时和磁盘空间占用情况 truncate table liaotao.tab_test; create INDEX liaotao.idx_sr_xm on liaotao.tab_test(shengri,xm); select sum(a.BYTES)/1024/1024,sum(a.BYTES-b.BYTES)/1024/1024 from DBA_DATA_FILES a,DBA_FREE_SPACE b where a.TABLESPACE_NAME=b.TABLESPACE_NAME and b.TABLESPACE_NAME='LIAOTAO_DATA'; insert into liaotao.tab_test select sys_guid() bh , substr(sys_guid(), 1, 20) sfzhm , sys_guid() xm , case when mod(to_number(trunc(dbms_random.value(0, 2))), 2)=0 then 'M' else 'F' end xb, SYSDATE shengri , dbms_random.value(10000, 9999999) dhhm , dbms_random.value(1, 999) xz , trunc(dbms_random.value(10000, 10000222)) ||'@qq.com' email , null zhaopian , 'what' jianli , dbms_random.value(1, 999) c1, dbms_random.value(1, 999) c2, sysdate c3 , sysdate c4 from dual connect by rownum<=100000; select sum(a.BYTES)/1024/1024,sum(a.BYTES-b.BYTES)/1024/1024 from DBA_DATA_FILES a,DBA_FREE_SPACE b where a.TABLESPACE_NAME=b.TABLESPACE_NAME and b.TABLESPACE_NAME='LIAOTAO_DATA'; --9.在有三条索引的情况下,执行查询、删除和更新部分SQL语句,并分别记录执行用时; --查询 select count(*) from liaotao.tab_test; select count(*) from liaotao.tab_test where xb='F'; select * from liaotao.tab_test where bh in (select top 10 bh from liaotao.tab_test order by dbms_random.value); select * from liaotao.tab_test where sfzhm in (select top 10 sfzhm from liaotao.tab_test order by dbms_random.value); select * from liaotao.tab_test where (shengri, xm) in (select top 10 shengri, xm from liaotao.tab_test order by dbms_random.value); --删除 delete from liaotao.tab_test where bh in (select top 10 bh from liaotao.tab_test order by dbms_random.value); delete from liaotao.tab_test where sfzhm in (select top 10 sfzhm from liaotao.tab_test order by dbms_random.value); delete from liaotao.tab_test where (shengri, xm) in (select top 10 shengri, xm from liaotao.tab_test order by dbms_random.value); --更新 update liaotao.tab_test set (SFZHM,XM,XB,SHENGRI,DHHM,XZ,EMAIL,C1,C2,C3,C4)= (select top 1 SFZHM,XM,XB,SHENGRI,DHHM,XZ,EMAIL,C1,C2,C3,C4 from liaotao.tab_test order by dbms_random.value); spool off;下面是脚本执行后用时的结果汇总
分析结果: 1.随着索引数量的增多,磁盘占用会增加。 2.对于insert操作,随着索引数量的增多,插入数据的耗时会越来越多。 3.对于查询语句,索引数量增加,在建立了合适的索引的情况下,查询会越快。 4.对于delete和update操作,索引数量增加,删除和更新耗时不一定减少,甚至可能增加。
重点:索引是一定是需要占用磁盘文件的,它的核心在于有序,从而减少全表扫描,加快sql的执行。并非索引数量越多,就一定会所以加快查询和dml(对于dml甚至可能增加用时,因为维护索引的有序是一个非常消耗资源的操作),关键在于你的索引是否建立得合适,你的sql在优化器(对达梦8来说是CBO模式)看来是否会选择使用你建立的索引,如果你的索引用不上或者不常用,那么建立索引就是得不偿失的。这段话其实不针对于达梦,mysql和Oracle等关系型数据库都是类似的。
下面是spool导出的文件,自己慢慢看~
SQL> set linesize 800; SQL> set autocommit on; SQL> set lineshow off; SQL> declare i number:=0; begin select count(1) into i from DBA_TABLESPACES a where a.TABLESPACE_NAME='LIAOTAO_DATA'; if i>0 then for temp_user in (select a.USERNAME from dba_users a where a.DEFAULT_TABLESPACE='LIAOTAO_DATA') LOOP execute IMMEDIATE 'drop user '||temp_user.username||' CASCADE'; end loop; execute IMMEDIATE 'drop tablespace liaotao_data'; end if; execute IMMEDIATE Q'*create tablespace liaotao_data datafile 'liaotao_data.dbf' size 2048 autoextend on next 100 maxsize 10240*'; execute IMMEDIATE Q'*create user "liaotao" IDENTIFIED by "Liaotao941103" default tablespace "LIAOTAO_DATA"*'; execute IMMEDIATE Q'*grant dba,public,resource,VTI TO liaotao*'; end; DMSQL 过程已成功完成 已用时间: 328.035(毫秒). 执行号:573. SQL> --1.根据表定义创建表,利用SQL方式往表tab_test插入10万条随机生成的数据(大字段类型不要求随机),记录插入用时和磁盘空间占用情况; create table liaotao.tab_test ( bh varchar(32) , sfzhm varchar(20) , xm varchar(200) , xb char(1) check (xb in('M', 'F')) , shengri date check (shengri between to_date('1800-01-01') and to_date('2022-01-01')), dhhm bigint , xz number(10, 2) , email varchar(100) , zhaopian blob , jianli clob , c1 dec(20, 5) , c2 float , c3 time , c4 datetime ); 操作已执行 已用时间: 8.377(毫秒). 执行号:574. SQL> comment on column liaotao.tab_test.bh is '编号'; 操作已执行 已用时间: 3.256(毫秒). 执行号:575. SQL> comment on column liaotao.tab_test.sfzhm is '身份证号码'; 操作已执行 已用时间: 2.891(毫秒). 执行号:576. SQL> comment on column liaotao.tab_test.xm is '姓名'; 操作已执行 已用时间: 3.181(毫秒). 执行号:577. SQL> comment on column liaotao.tab_test.xb is '性别'; 操作已执行 已用时间: 4.543(毫秒). 执行号:578. SQL> comment on column liaotao.tab_test.shengri is '生日'; 操作已执行 已用时间: 3.087(毫秒). 执行号:579. SQL> comment on column liaotao.tab_test.dhhm is '电话号码'; 操作已执行 已用时间: 3.085(毫秒). 执行号:580. SQL> comment on column liaotao.tab_test.xz is '薪资'; 操作已执行 已用时间: 2.980(毫秒). 执行号:581. SQL> comment on column liaotao.tab_test.email is '电子邮箱'; 操作已执行 已用时间: 4.472(毫秒). 执行号:582. SQL> comment on column liaotao.tab_test.zhaopian is '照片'; 操作已执行 已用时间: 10.548(毫秒). 执行号:583. SQL> comment on column liaotao.tab_test.jianli is '简历'; 操作已执行 已用时间: 3.283(毫秒). 执行号:584. SQL> select sum(a.BYTES)/1024/1024,sum(a.BYTES-b.BYTES)/1024/1024 from DBA_DATA_FILES a,DBA_FREE_SPACE b where a.TABLESPACE_NAME=b.TABLESPACE_NAME and b.TABLESPACE_NAME='LIAOTAO_DATA'; SUM(A.BYTES)/1024/1024 SUM(A.BYTES-B.BYTES)/1024/1024 ---------------------- ------------------------------ 2048 0.1328125 已用时间: 19.394(毫秒). 执行号:585. SQL> insert into liaotao.tab_test select sys_guid() bh , substr(sys_guid(), 1, 20) sfzhm , sys_guid() xm , case when mod(to_number(trunc(dbms_random.value(0, 2))), 2)=0 then 'M' else 'F' end xb, SYSDATE shengri , dbms_random.value(10000, 9999999) dhhm , dbms_random.value(1, 999) xz , trunc(dbms_random.value(10000, 10000222)) ||'@qq.com' email , null zhaopian , 'what' jianli , dbms_random.value(1, 999) c1, dbms_random.value(1, 999) c2, sysdate c3 , sysdate c4 from dual connect by rownum<=100000; 影响行数 100000 已用时间: 00:00:04.528. 执行号:586. SQL> select sum(a.BYTES)/1024/1024,sum(a.BYTES-b.BYTES)/1024/1024 from DBA_DATA_FILES a,DBA_FREE_SPACE b where a.TABLESPACE_NAME=b.TABLESPACE_NAME and b.TABLESPACE_NAME='LIAOTAO_DATA'; SUM(A.BYTES)/1024/1024 SUM(A.BYTES-B.BYTES)/1024/1024 ---------------------- ------------------------------ 2048 18.7890625 已用时间: 11.821(毫秒). 执行号:587. SQL> --3.无索引情况下,执行查询、删除和更新部分SQL语句,并分别记录执行用时 --查询 select count(*) from liaotao.tab_test; COUNT(*) -------------------- 100000 已用时间: 0.968(毫秒). 执行号:588. SQL> select count(*) from liaotao.tab_test where xb='F'; COUNT(*) -------------------- 49957 已用时间: 8.444(毫秒). 执行号:589. SQL> select * from liaotao.tab_test where bh in (select top 10 bh from liaotao.tab_test order by dbms_random.value); BH SFZHM XM XB SHENGRI DHHM XZ EMAIL ZHAOPIAN JIANLI C1 C2 C3 C4 -------------------------------- -------------------- -------------------------------- -- ---------------------------------------------------------------------------------------------------- -------------------- ------ -------------- ---------- ------ --------- ------------------------- ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- 3996AC809C973EC41796A85AA19C3267 10A683DCBE63A905354F F698BE71969D9CE694CBCF41CE627BC1 F 2020-07-03 2407256 533.60 2250215@qq.com NULL what 32.78815 3.624493887915506E+02 22:34:25 2020-07-03 22:34:25.000000 DF34D668A1701934AFEA84F95AADBA5A 5F26E6233D68FC00A816 AD58ACCB587B489B27D04FA9C94068DD M 2020-07-03 7722688 699.04 4763709@qq.com NULL what 550.99193 4.039373054918541E+02 22:34:25 2020-07-03 22:34:25.000000 8EE4CB370B7ACD8CEC678BF102C34631 36319C20F93B75836F01 43FC3F424A0C63B648B2D8F0542DA67C F 2020-07-03 3614965 906.39 8444634@qq.com NULL what 800.22795 1.907884632506354E+02 22:34:25 2020-07-03 22:34:25.000000 7DA110EF388E5F62BCBF320957609B6F 26A2F7A9EE47D552B4E4 AF0BC0B8F711358F7DA6F7F208E1F5C7 M 2020-07-03 1837353 741.47 7220716@qq.com NULL what 209.47682 8.039864280745324E+00 22:34:25 2020-07-03 22:34:25.000000 CD378F20EF08472E7CC115DC09E7B7FB 8900545BC46210ED15C6 CE162EAF1CA8E9D3910602264FF45573 F 2020-07-03 2768597 166.10 8055610@qq.com NULL what 278.47305 4.663139897022926E+02 22:34:25 2020-07-03 22:34:25.000000 2B4CE3A4E5BA7D5F849AF453BEBDD847 C41CA6605A710EEA1E57 5E1DEBFF65D4F4DCF43FCD4D77D5A056 M 2020-07-03 8056996 390.26 8760330@qq.com NULL what 194.07271 9.811161471652407E+02 22:34:25 2020-07-03 22:34:25.000000 5D865923E42D6B4BFC6BBB0D84EE358A 83879CAFD42BF86379B8 7E02F2492BDFBF12D4B4BF5371193FFF M 2020-07-03 8456206 665.55 484100@qq.com NULL what 928.97295 1.076073609481600E+02 22:34:25 2020-07-03 22:34:25.000000 31EA9DA5AE2DDD0FAA2AF4B3FE4DD33C 50E0E2A21E28815FD3C2 6655E9AF4F754A9A5D6B922F0C3D488E M 2020-07-03 3005952 105.83 6758550@qq.com NULL what 248.26489 4.964009138901723E+02 22:34:25 2020-07-03 22:34:25.000000 62D51C2EE6C4FBC7417AEF8C7A5DE167 265C34D637C890957724 39E0B96C9DD79FF7D9D3BA05CD1EC098 F 2020-07-03 8208789 962.36 6647394@qq.com NULL what 277.83683 8.394240095961950E+02 22:34:25 2020-07-03 22:34:25.000000 A65CC031E15E286A390D4BA1B0AC3146 909EF5087548AAB16DEC E708390BA67CBE4D66AD0BC2AE57C98B M 2020-07-03 7937753 204.52 592576@qq.com NULL what 997.19973 5.050974847283668E+02 22:34:25 2020-07-03 22:34:25.000000 10 rows got 已用时间: 296.687(毫秒). 执行号:590. SQL> select * from liaotao.tab_test where sfzhm in (select top 10 sfzhm from liaotao.tab_test order by dbms_random.value); BH SFZHM XM XB SHENGRI DHHM XZ EMAIL ZHAOPIAN JIANLI C1 C2 C3 C4 -------------------------------- -------------------- -------------------------------- -- ---------------------------------------------------------------------------------------------------- -------------------- ------ -------------- ---------- ------ --------- ------------------------- ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- 72A76530EF46FB053BDEBC43882AC31B D2723342CAAAC0923A38 0F369C2D817C8629241CB5F6901496C3 F 2020-07-03 315486 785.72 4514037@qq.com NULL what 660.77339 7.240026991036733E+02 22:34:25 2020-07-03 22:34:25.000000 4850F8CCA510B42943268BBF8B06D120 2AB11A383ADB12A8D4B5 29E00B4F14E622AC4C52C7BC8F78537B F 2020-07-03 3779593 960.39 4347814@qq.com NULL what 410.99184 6.316366584378467E+02 22:34:25 2020-07-03 22:34:25.000000 2AF419738F4D82C4893485E7F38A70A1 66261A28F131D7A91C85 00DB6B60BE2BF21207E7E91F5AE69AD3 M 2020-07-03 409728 651.40 6648398@qq.com NULL what 960.09422 5.896339022641229E+02 22:34:25 2020-07-03 22:34:25.000000 59EB700205A6C465E38CC9FD8B06D4C5 F4BAD38F1F7D4B23AFDC 835DDC64112F606BE29D813282ABA702 F 2020-07-03 7780827 96.37 9632716@qq.com NULL what 255.97511 9.721325330758154E+02 22:34:25 2020-07-03 22:34:25.000000 A1DFA70071472F4189288533FF42692E 18861641D5AEE86915E3 851EDFFB44E930AB325E695E105EABB2 F 2020-07-03 4112599 478.54 9567588@qq.com NULL what 166.46785 2.321355193691028E+02 22:34:25 2020-07-03 22:34:25.000000 A1B32DF14711C875C4BD58A9C476B0CB 05E7FA3E33B652ED407D E05369650817BE833A13360802883BB8 F 2020-07-03 7160916 430.22 2634618@qq.com NULL what 952.65571 9.594264533414629E+01 22:34:25 2020-07-03 22:34:25.000000 A0F1B926E58D558F66BF1F89591AE371 3DDB27EE8907F7CD18C1 6B67D2FA8EC785BA26ACFA4FE05ADFDC F 2020-07-03 8752773 186.49 9569002@qq.com NULL what 550.58758 3.994375566767704E+02 22:34:25 2020-07-03 22:34:25.000000 AE2D900FF3FCB95B916D91CD8160CCD3 C074F299AD450E9E8702 B47F0FA90F00A01C302B80D576887049 M 2020-07-03 6093263 758.65 4962839@qq.com NULL what 612.66361 8.286491212759395E+02 22:34:25 2020-07-03 22:34:25.000000 07A9C985B703E46D8D3568B9F6F3371E 6A5AA6EC0FBC8A2BB522 E43DB3567CDBA48F8324EBE6D053B164 M 2020-07-03 1364388 829.19 6241582@qq.com NULL what 146.73617 4.411787042702449E+02 22:34:25 2020-07-03 22:34:25.000000 CEA7B13D8D7E5C7E80CD77AA7D21570F 1F9FA5B4C18892D6A957 D18DED9C9B71D76A7DAC0A81F5569800 F 2020-07-03 3244961 326.62 2687560@qq.com NULL what 819.01953 7.856083842192816E+02 22:34:25 2020-07-03 22:34:25.000000 10 rows got 已用时间: 294.428(毫秒). 执行号:591. SQL> select * from liaotao.tab_test where (shengri, xm) in (select top 10 shengri, xm from liaotao.tab_test order by dbms_random.value); BH SFZHM XM XB SHENGRI DHHM XZ EMAIL ZHAOPIAN JIANLI C1 C2 C3 C4 -------------------------------- -------------------- -------------------------------- -- ---------------------------------------------------------------------------------------------------- -------------------- ------ -------------- ---------- ------ --------- ------------------------- ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- 41176E822F89F33D02243A8C62FE631E 1B6CC967C4C36D97E1BE 208D5A0D2A8A8B1EB221BED4E4D3FA14 M 2020-07-03 1387688 502.35 339829@qq.com NULL what 226.84001 2.640343415709372E+01 22:34:25 2020-07-03 22:34:25.000000 C98A491566FF5D66A7B4D98679644322 8AE70925C3BE1F966642 B4EA0CEF08003D5C06E6FE005B66C53E F 2020-07-03 7588319 278.00 7528361@qq.com NULL what 457.15219 7.486777903319697E+01 22:34:25 2020-07-03 22:34:25.000000 E38ACA85D2D8439B3299FD989B4AF547 766B6BCB7F24C873693A 1CB05FEEF87247771A9285BA846C2058 M 2020-07-03 8728693 869.40 6687777@qq.com NULL what 903.14835 8.404143826120601E+02 22:34:25 2020-07-03 22:34:25.000000 483DFD2AD17D215C8D62D7E9898F79C5 C45E21FBDC9B9A4AEDAB EEF966984C5EAD81674C4989C8DA3F35 M 2020-07-03 2723264 547.00 3495899@qq.com NULL what 135.79175 3.665532759751906E+02 22:34:25 2020-07-03 22:34:25.000000 0703EEC941752CD92C3D741E3051DA7B 5CA7FBD30D3F452D273C C87991DB5FA10EE1970115E542BE7D25 F 2020-07-03 9467072 220.53 4218923@qq.com NULL what 450.32928 6.050717023723162E+02 22:34:25 2020-07-03 22:34:25.000000 AC048101036F2A5D65E373FBD0511804 BBC5AEB50EA73D6FCE02 30CB06493BC73A3EACE6BCC9C0385BAF M 2020-07-03 3210779 82.72 8886985@qq.com NULL what 846.65298 6.076408137346808E+02 22:34:25 2020-07-03 22:34:25.000000 82820DB13182282EFF40B9E10D8E2410 E54CCA245A957B726913 891A44464D2CA2C74FC369599A134BF5 M 2020-07-03 4552029 449.33 6681056@qq.com NULL what 656.16028 8.818063344302617E+01 22:34:25 2020-07-03 22:34:25.000000 A523AC302E4E4DDEA4654ACC83366CBF 7513E3C8ACBB8E17A9D8 AA34944BDAC084AAEA1BAAA74FCA6ED7 M 2020-07-03 7960602 352.97 5290128@qq.com NULL what 197.91264 9.382705265196369E+02 22:34:25 2020-07-03 22:34:25.000000 23B00923D9744835DA573DD9C4D38381 5FB9726366DC354463BB FA50633B5F0C4943F0EDAB258499B529 F 2020-07-03 3368015 932.09 2249231@qq.com NULL what 799.30648 3.774651573912544E+01 22:34:25 2020-07-03 22:34:25.000000 3F793A885A7AD26EDB8FD28EE7370E8D F4E0B6815F11F37258B1 8ECAC57640D38C04BFA08059D5D5920E M 2020-07-03 18035 150.35 5750570@qq.com NULL what 442.59467 5.368132688541958E+02 22:34:25 2020-07-03 22:34:25.000000 10 rows got 已用时间: 298.128(毫秒). 执行号:592. SQL> --删除 delete from liaotao.tab_test where bh in (select top 10 bh from liaotao.tab_test order by dbms_random.value); 影响行数 10 已用时间: 291.376(毫秒). 执行号:593. SQL> delete from liaotao.tab_test where sfzhm in (select top 10 sfzhm from liaotao.tab_test order by dbms_random.value); 影响行数 10 已用时间: 283.751(毫秒). 执行号:594. SQL> delete from liaotao.tab_test where (shengri, xm) in (select top 10 shengri, xm from liaotao.tab_test order by dbms_random.value); 影响行数 10 已用时间: 272.143(毫秒). 执行号:595. SQL> --更新 update liaotao.tab_test set (SFZHM,XM,XB,SHENGRI,DHHM,XZ,EMAIL,C1,C2,C3,C4)= ( select top 1 SFZHM,XM,XB,SHENGRI,DHHM,XZ,EMAIL,C1,C2,C3,C4 from liaotao.tab_test order by dbms_random.value); 影响行数 99970 已用时间: 00:00:02.159. 执行号:596. SQL> --4.清空表后,在表tab_test上创建基于bh字段的唯一索引idx_bh,利用SQL或程序插入10万条记录,记录插入用时和磁盘空间占用情况; truncate table liaotao.tab_test; 操作已执行 已用时间: 12.357(毫秒). 执行号:597. SQL> create unique INDEX liaotao.idx_bh on liaotao.tab_test(bh); 操作已执行 已用时间: 11.001(毫秒). 执行号:598. SQL> select sum(a.BYTES)/1024/1024,sum(a.BYTES-b.BYTES)/1024/1024 from DBA_DATA_FILES a,DBA_FREE_SPACE b where a.TABLESPACE_NAME=b.TABLESPACE_NAME and b.TABLESPACE_NAME='LIAOTAO_DATA'; SUM(A.BYTES)/1024/1024 SUM(A.BYTES-B.BYTES)/1024/1024 ---------------------- ------------------------------ 2048 0.1640625 已用时间: 15.742(毫秒). 执行号:599. SQL> insert into liaotao.tab_test select sys_guid() bh , substr(sys_guid(), 1, 20) sfzhm , sys_guid() xm , case when mod(to_number(trunc(dbms_random.value(0, 2))), 2)=0 then 'M' else 'F' end xb, SYSDATE shengri , dbms_random.value(10000, 9999999) dhhm , dbms_random.value(1, 999) xz , trunc(dbms_random.value(10000, 10000222)) ||'@qq.com' email , null zhaopian , 'what' jianli , dbms_random.value(1, 999) c1, dbms_random.value(1, 999) c2, sysdate c3 , sysdate c4 from dual connect by rownum<=100000; 影响行数 100000 已用时间: 00:00:05.517. 执行号:600. SQL> select sum(a.BYTES)/1024/1024,sum(a.BYTES-b.BYTES)/1024/1024 from DBA_DATA_FILES a,DBA_FREE_SPACE b where a.TABLESPACE_NAME=b.TABLESPACE_NAME and b.TABLESPACE_NAME='LIAOTAO_DATA'; SUM(A.BYTES)/1024/1024 SUM(A.BYTES-B.BYTES)/1024/1024 ---------------------- ------------------------------ 2048 25.9375 已用时间: 12.070(毫秒). 执行号:601. SQL> --5.在有一条索引的情况下,执行查询、删除和更新部分SQL语句,并分别记录执行用时; --查询 select count(*) from liaotao.tab_test; COUNT(*) -------------------- 100000 已用时间: 0.918(毫秒). 执行号:602. SQL> select count(*) from liaotao.tab_test where xb='F'; COUNT(*) -------------------- 50254 已用时间: 8.258(毫秒). 执行号:603. SQL> select * from liaotao.tab_test where bh in (select top 10 bh from liaotao.tab_test order by dbms_random.value); BH SFZHM XM XB SHENGRI DHHM XZ EMAIL ZHAOPIAN JIANLI C1 C2 C3 C4 -------------------------------- -------------------- -------------------------------- -- ---------------------------------------------------------------------------------------------------- -------------------- ------ -------------- ---------- ------ --------- ------------------------- ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- 8DA2CCB9C3F872FBB9E462A6C0D9ACEE D36FECA4B713F8AAF743 AD0173531C714658D31539666C6D7108 M 2020-07-03 143889 799.61 5442504@qq.com NULL what 634.98099 7.123738150961574E+01 22:34:34 2020-07-03 22:34:34.000000 C4E4FFE5310BBDD395EC62D670F7ABAD E79E9FA124E5E6DA70F1 CB21928140AF7B707F8340953D579371 M 2020-07-03 6713852 526.82 6226740@qq.com NULL what 399.42778 6.236860609858696E+02 22:34:34 2020-07-03 22:34:34.000000 EA8A038D3354CA13DF4C1E148349EA06 C16A53D491F290DD1D3A 3515AE8CA9DEFE0819A14B2BE024DB95 F 2020-07-03 5683572 241.99 5381476@qq.com NULL what 103.24184 9.746336944110848E+02 22:34:34 2020-07-03 22:34:34.000000 42B05377DB24885E48FC191E00660AD9 E0144E80785F726EDD39 0179E9361348E2EA8B0090A23CAB4E42 M 2020-07-03 3478380 590.72 1148443@qq.com NULL what 381.05037 8.047952023156895E+02 22:34:34 2020-07-03 22:34:34.000000 0561C874693F6A734B65C92BE53268D0 BE438E4067C6F0E13445 27AF220D0E5D4B6356F0A73B404107F0 F 2020-07-03 9897273 135.15 5215334@qq.com NULL what 703.55387 2.690184728517282E+01 22:34:34 2020-07-03 22:34:34.000000 FF79DCFBE4EA8DCF61746B02FFD0D0FD C35B078B9A7B1C537D61 47EC43A1F118C5F7C5704F72AA5ADD42 M 2020-07-03 4773258 691.57 8254077@qq.com NULL what 720.76992 1.845336473162908E+02 22:34:34 2020-07-03 22:34:34.000000 79FC28195A1E0B03109228A6A8EF963A CD60D75FF53B7114077E 7FCE4AA7F09F18AE4D225CB2AAE3EDFE M 2020-07-03 1372160 927.10 5530834@qq.com NULL what 340.36450 4.449612283594726E+02 22:34:34 2020-07-03 22:34:34.000000 304EDFF00BBC6BEE9680718E1FC5E38B 7D2EBD9CF4E9F43B70E3 6883B7318AB5954C916C9B08DE1FC86A M 2020-07-03 540980 837.80 1937134@qq.com NULL what 673.98920 4.357823774939320E+02 22:34:34 2020-07-03 22:34:34.000000 DF28C41E9423E4B4F988DB0DC00EC70D 90E6B8F507B8BF0F3017 6679A402CDB08032A114384A35381CFE M 2020-07-03 1915927 400.53 7728767@qq.com NULL what 58.72673 8.168954902719221E+02 22:34:34 2020-07-03 22:34:34.000000 18B340095D13866610CAF7C43F4C6B08 659FF315DB9054B3226B B2B922C9257490A155D6657DDC3C5E5E F 2020-07-03 4253170 959.22 6905864@qq.com NULL what 307.00775 4.054042734934037E+02 22:34:34 2020-07-03 22:34:34.000000 10 rows got 已用时间: 248.420(毫秒). 执行号:604. SQL> select * from liaotao.tab_test where sfzhm in (select top 10 sfzhm from liaotao.tab_test order by dbms_random.value); BH SFZHM XM XB SHENGRI DHHM XZ EMAIL ZHAOPIAN JIANLI C1 C2 C3 C4 -------------------------------- -------------------- -------------------------------- -- ---------------------------------------------------------------------------------------------------- -------------------- ------ -------------- ---------- ------ --------- ------------------------- ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- F6A91644E8347BFD741C16F5EF8FE465 A73A8BD101DF585DB1F7 67728050296CE92FFF73C930084A7B70 F 2020-07-03 3143135 926.54 6317381@qq.com NULL what 170.18218 2.845768685301657E+02 22:34:34 2020-07-03 22:34:34.000000 864D8155B05D8418157F4A49068FC144 797EEA22BB05651B819E 85F2254CE8BAA2C09487C46D45C2F317 M 2020-07-03 7373986 171.62 8421687@qq.com NULL what 522.12819 2.668071385034393E+02 22:34:34 2020-07-03 22:34:34.000000 7AEB51277AA100ED4830F27182E15727 B92EE1D06A6D1619D018 25DCA944DF2080E58661876BD788A187 M 2020-07-03 994117 22.92 7268694@qq.com NULL what 140.23740 3.270715762265360E+02 22:34:34 2020-07-03 22:34:34.000000 1CB27671AC99FC586BC498D8BFDE69D4 1536A91ADC0FE724CBE6 C8C8448F32ECA7038D574F9EB2A6B5EB F 2020-07-03 696075 688.32 2232196@qq.com NULL what 127.12448 5.009753912836198E+02 22:34:34 2020-07-03 22:34:34.000000 B628E4DF9E6D067F64BC2188193249F3 51DD8BE34949FAF2ADF5 B51EC935DE855EC4EE77730E374D5333 F 2020-07-03 5748403 973.47 2742914@qq.com NULL what 891.06109 6.510667082974998E+02 22:34:34 2020-07-03 22:34:34.000000 3C4C5731E1F31ECB8B31A25E54B0E4F9 ABBFCA6CA3953828DB00 99A4B96B59DA40F9E8ABA71D89EFFD29 F 2020-07-03 6159374 62.43 2384768@qq.com NULL what 56.17390 7.555036882895526E+01 22:34:34 2020-07-03 22:34:34.000000 5EA64AD2B51D83607B8889A79DFC691C CDC766A566CED4EB41AE 333656F874A34588D349905A2B148867 F 2020-07-03 6174505 736.58 4395562@qq.com NULL what 508.99933 5.875376615382440E+01 22:34:34 2020-07-03 22:34:34.000000 B9E7673D1F6F482ADF837F2841166385 91F18B95E6462ECE52F7 B7C6A5DC1B993AA14E6CFC37C3D20854 M 2020-07-03 3353563 713.20 8195818@qq.com NULL what 943.64658 4.589907488897400E+02 22:34:34 2020-07-03 22:34:34.000000 0F3CB54FA33EEF58995F111296B851E8 0CBB6F27FA8205273089 6891EBDB94C423DDB0949B6265E3BAF8 M 2020-07-03 7190565 118.91 9953553@qq.com NULL what 184.91671 8.912294966267561E+01 22:34:34 2020-07-03 22:34:34.000000 0485CCF5E3421202A182C713E6C2F3BA 30224E886F5449FFA3CB 4A4926E3B789FADD847EF61E9680157A M 2020-07-03 9536835 798.52 6099852@qq.com NULL what 949.16512 7.675993168664163E+02 22:34:34 2020-07-03 22:34:34.000000 10 rows got 已用时间: 296.837(毫秒). 执行号:605. SQL> select * from liaotao.tab_test where (shengri, xm) in (select top 10 shengri, xm from liaotao.tab_test order by dbms_random.value); BH SFZHM XM XB SHENGRI DHHM XZ EMAIL ZHAOPIAN JIANLI C1 C2 C3 C4 -------------------------------- -------------------- -------------------------------- -- ---------------------------------------------------------------------------------------------------- -------------------- ------ -------------- ---------- ------ --------- ------------------------- ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- 336CB2D9CA70ADCDE0FC616D0E7B76A7 0EBEB518EE0B29B7581B 71943E2D989B97690EE417A7BCB14B13 F 2020-07-03 2892452 788.14 4653294@qq.com NULL what 816.34390 7.951821156713096E+02 22:34:34 2020-07-03 22:34:34.000000 17F224EECED73A256759C129E180C56E 50A90D290286F8BBBE78 6A67B21887B2E612820F2D75BC344568 M 2020-07-03 4415693 574.23 5923807@qq.com NULL what 59.01687 9.788905632635068E+02 22:34:34 2020-07-03 22:34:34.000000 DD545902336B807D68E9C1F81FE17795 82750331B6447115ACBA 5A442B5AA0D8F3F4BA507E2CFEA9B915 M 2020-07-03 3742872 478.23 6043427@qq.com NULL what 953.63585 1.290014586271725E+02 22:34:34 2020-07-03 22:34:34.000000 C86FD0AA2D6F3E01422091097EDCF442 7583D04BD9E9148F66F5 BFAB149A293BA91C616810309078D8A0 M 2020-07-03 2688295 510.21 4985001@qq.com NULL what 454.65504 7.534208620006316E+02 22:34:34 2020-07-03 22:34:34.000000 C81175DBFF38817DDB62433A1DEFAC0F 67402DF79D20BD9168B7 D0D3F376DA6C884111E3E87B9360B08D F 2020-07-03 1948962 95.06 5613181@qq.com NULL what 338.54251 2.262597822729777E+02 22:34:34 2020-07-03 22:34:34.000000 2FF10B0A41D5F034C41346E86A5AE734 8C1C5ABDD7A71C431FE6 12FF97A8C5390F415598070E19AB4DF7 M 2020-07-03 8642779 573.60 3812797@qq.com NULL what 434.32236 5.792193878657276E+02 22:34:34 2020-07-03 22:34:34.000000 228655930011B8400E820206B2CCF5AE 95691BB666B3AE93EE35 81A6AF718171BEC856251322FD10D2E3 M 2020-07-03 3475756 88.19 89167@qq.com NULL what 698.45382 4.490390446568090E+02 22:34:34 2020-07-03 22:34:34.000000 16AA0E7FF9FA0B05AD2FAD43CDC095B6 EAFFC3A3F203E3705021 87EBD68A6E26966BAF7390658997F5EA M 2020-07-03 9885601 251.60 5927745@qq.com NULL what 694.81615 3.111971302499050E+02 22:34:34 2020-07-03 22:34:34.000000 4EBE30C186DEA60B389414FB5D55B251 1C4AA75BE0AFD5F1D156 09485DA97E433A099E4F41AA7A3FD5E3 M 2020-07-03 9767898 997.54 5170136@qq.com NULL what 143.72987 6.398955693668198E+02 22:34:34 2020-07-03 22:34:34.000000 F2AF62F1FCED3ABF017FD61472CA0700 22031C8615F95407D903 C4F63B4676F727E762A7752338BBFF6A F 2020-07-03 8674294 593.14 7758606@qq.com NULL what 575.22857 5.446221561979606E+02 22:34:34 2020-07-03 22:34:34.000000 10 rows got 已用时间: 327.325(毫秒). 执行号:606. SQL> --删除 delete from liaotao.tab_test where bh in (select top 10 bh from liaotao.tab_test order by dbms_random.value); 影响行数 10 已用时间: 246.523(毫秒). 执行号:607. SQL> delete from liaotao.tab_test where sfzhm in (select top 10 sfzhm from liaotao.tab_test order by dbms_random.value); 影响行数 10 已用时间: 313.951(毫秒). 执行号:608. SQL> delete from liaotao.tab_test where (shengri, xm) in (select top 10 shengri, xm from liaotao.tab_test order by dbms_random.value); 影响行数 10 已用时间: 305.767(毫秒). 执行号:609. SQL> --更新 update liaotao.tab_test set (SFZHM,XM,XB,SHENGRI,DHHM,XZ,EMAIL,C1,C2,C3,C4)= (select top 1 SFZHM,XM,XB,SHENGRI,DHHM,XZ,EMAIL,C1,C2,C3,C4 from liaotao.tab_test order by dbms_random.value); 影响行数 99970 已用时间: 00:00:02.012. 执行号:610. SQL> --6.清空表后,在表tab_test上再创建基于sfzhm字段的索引idx_sfzhm,利用SQL或程序插入10万条记录,记录插入用时和磁盘空间占用情况; truncate table liaotao.tab_test; 操作已执行 已用时间: 6.938(毫秒). 执行号:611. SQL> create INDEX liaotao.inx_sfzhm on liaotao.tab_test(sfzhm); 操作已执行 已用时间: 8.180(毫秒). 执行号:612. SQL> select sum(a.BYTES)/1024/1024,sum(a.BYTES-b.BYTES)/1024/1024 from DBA_DATA_FILES a,DBA_FREE_SPACE b where a.TABLESPACE_NAME=b.TABLESPACE_NAME and b.TABLESPACE_NAME='LIAOTAO_DATA'; SUM(A.BYTES)/1024/1024 SUM(A.BYTES-B.BYTES)/1024/1024 ---------------------- ------------------------------ 2048 0.1796875 已用时间: 13.122(毫秒). 执行号:613. SQL> insert into liaotao.tab_test select sys_guid() bh , substr(sys_guid(), 1, 20) sfzhm , sys_guid() xm , case when mod(to_number(trunc(dbms_random.value(0, 2))), 2)=0 then 'M' else 'F' end xb, SYSDATE shengri , dbms_random.value(10000, 9999999) dhhm , dbms_random.value(1, 999) xz , trunc(dbms_random.value(10000, 10000222)) ||'@qq.com' email , null zhaopian , 'what' jianli , dbms_random.value(1, 999) c1, dbms_random.value(1, 999) c2, sysdate c3 , sysdate c4 from dual connect by rownum<=100000; 影响行数 100000 已用时间: 00:00:06.761. 执行号:614. SQL> select sum(a.BYTES)/1024/1024,sum(a.BYTES-b.BYTES)/1024/1024 from DBA_DATA_FILES a,DBA_FREE_SPACE b where a.TABLESPACE_NAME=b.TABLESPACE_NAME and b.TABLESPACE_NAME='LIAOTAO_DATA'; SUM(A.BYTES)/1024/1024 SUM(A.BYTES-B.BYTES)/1024/1024 ---------------------- ------------------------------ 2048 31.3828125 已用时间: 15.632(毫秒). 执行号:615. SQL> --7.在有两条索引的情况下,执行查询、删除和更新部分SQL语句,并分别记录执行用时 --查询 select count(*) from liaotao.tab_test; COUNT(*) -------------------- 100000 已用时间: 1.388(毫秒). 执行号:616. SQL> select count(*) from liaotao.tab_test where xb='F'; COUNT(*) -------------------- 50019 已用时间: 12.434(毫秒). 执行号:617. SQL> select * from liaotao.tab_test where bh in (select top 10 bh from liaotao.tab_test order by dbms_random.value); BH SFZHM XM XB SHENGRI DHHM XZ EMAIL ZHAOPIAN JIANLI C1 C2 C3 C4 -------------------------------- -------------------- -------------------------------- -- ---------------------------------------------------------------------------------------------------- -------------------- ------ -------------- ---------- ------ --------- ------------------------- ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- 5124B27008B2AB4D6C0B1DC1817813C5 53954CA10731D5F1FB3A 18E6A0FEB33A2D25DE7080722F9CD196 F 2020-07-03 9800569 13.74 3171727@qq.com NULL what 99.49432 3.661376447310382E+02 22:34:43 2020-07-03 22:34:43.000000 CDDB7E8481D1BA915829E86619C8DA7D 8B210E972CDC3803CD85 7C28D94E6FF407753D3992B6F7CA91EC M 2020-07-03 8166043 264.43 7227184@qq.com NULL what 124.05452 6.904573423506030E+02 22:34:43 2020-07-03 22:34:43.000000 3297973C71A765222D4831BC78D55E4D 04CBB7E104C9CC7F7BC3 63CFF9261402931CAB3E29D93A091060 M 2020-07-03 1376814 350.38 8435748@qq.com NULL what 288.49822 3.395784424872037E+02 22:34:43 2020-07-03 22:34:43.000000 3E5F43EA5FBD32F644286A8275DFDFE3 4626023B9F05BC68CEB0 208903937307647302D4A5FE5C906D56 F 2020-07-03 1848335 4.11 2614465@qq.com NULL what 843.05934 3.670375524824659E+02 22:34:43 2020-07-03 22:34:43.000000 F9C0840DBAAFFD5CFAEE2309188058AD 327DF4497AA697446BBA 6D2FC92C351130632ED1B4709A9F2C2D M 2020-07-03 8497034 167.99 5344018@qq.com NULL what 613.52674 7.987495836456073E+02 22:34:43 2020-07-03 22:34:43.000000 3DD90F62A3411A733078AC774D8A42FB DFDF64EF10D873959D74 9C066EA60521193016DABC3A1B4BFA13 M 2020-07-03 5673768 902.57 8746945@qq.com NULL what 902.12652 5.463827670809731E+02 22:34:43 2020-07-03 22:34:43.000000 724F084A5371FC8A2C295A3E095EF35D 131B21B5E6FAEAE48A65 AB5AE9EAADC0EFCBF5E0621AA7E44951 M 2020-07-03 5599082 460.80 1541336@qq.com NULL what 65.10114 7.473363677395212E+02 22:34:43 2020-07-03 22:34:43.000000 63434D99F1554FD7E46F903358650638 3CCE996E8B6855EA82BD CC654343CF4708F6814D07D1948B7E69 F 2020-07-03 1439976 876.14 633054@qq.com NULL what 929.41698 6.649272915850985E+02 22:34:43 2020-07-03 22:34:43.000000 EF4290710F8FF41CC464566C21E4CF5C 855336FA5E13786AE663 FBD80BCEFB10CCEEB916BD98CD28EF2C M 2020-07-03 5887131 380.98 8288695@qq.com NULL what 252.46357 7.269158128806929E+02 22:34:43 2020-07-03 22:34:43.000000 CBA71DD8B2A05666D46DD4C12855035F AAA27540E1EA8A01D5AB F99E0B5B14C3F54CC0F3177673936DDC F 2020-07-03 9483745 276.00 8381604@qq.com NULL what 447.79302 4.797270724236627E+02 22:34:43 2020-07-03 22:34:43.000000 10 rows got 已用时间: 274.125(毫秒). 执行号:618. SQL> select * from liaotao.tab_test where sfzhm in (select top 10 sfzhm from liaotao.tab_test order by dbms_random.value); BH SFZHM XM XB SHENGRI DHHM XZ EMAIL ZHAOPIAN JIANLI C1 C2 C3 C4 -------------------------------- -------------------- -------------------------------- -- ---------------------------------------------------------------------------------------------------- -------------------- ------ -------------- ---------- ------ --------- ------------------------- ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- BF3311D08F862B2FD9AC69ECE35D4D06 4FC4E8669CC479F344E9 A621A76F913CDF4F9E82B7F176FAC6F1 M 2020-07-03 9733645 931.83 2739018@qq.com NULL what 823.75878 1.415141493484909E+02 22:34:43 2020-07-03 22:34:43.000000 E71121050C075FE5FBD6FE04EF53526D F510A8AADE6AE0E36C32 E8B85DEC99DB77A89ABF7BCB1AC51706 M 2020-07-03 9817999 312.67 6461639@qq.com NULL what 529.14715 4.851730337544219E+02 22:34:43 2020-07-03 22:34:43.000000 CA66BFA11A260FF64EE537F00C0C89E0 2CFE492A5A4353F41155 7909110E83F48EC84395034F49653101 M 2020-07-03 7036869 294.46 9021763@qq.com NULL what 259.12633 2.266998039398807E+02 22:34:43 2020-07-03 22:34:43.000000 9A9108D85B98BBBA1F815D126BD86F7D C607A77F47663D10BCDF EB4D4F6CB067B9F8238EA308001AB834 M 2020-07-03 2169068 357.51 3469347@qq.com NULL what 796.35958 5.333258376039221E+02 22:34:43 2020-07-03 22:34:43.000000 BE31246D82E393D9C9A1034C60BC01FA 6C95E53237E0B87960EA 3948F3D12AA10A4F6FCB4F0E095B95F7 F 2020-07-03 409410 332.25 3676779@qq.com NULL what 208.07739 2.841216873718062E+02 22:34:43 2020-07-03 22:34:43.000000 8C87C0760087905CCFB4562AD2435D7B 8690C7F4CA86D836851B FF8650A51A9E973220DADB15B136E8FA F 2020-07-03 2408147 573.43 8713076@qq.com NULL what 681.47471 6.044309220078545E+02 22:34:43 2020-07-03 22:34:43.000000 366E7C1BAA49A81A0F48EA52A82D780D 9E4A3320B2328BBA392B 4DCDBE60A78DA942B3EDDDFB8616E455 F 2020-07-03 5536025 358.61 1886220@qq.com NULL what 933.12528 5.762343236660745E+02 22:34:43 2020-07-03 22:34:43.000000 3948C3A64752F56A0FAB173EAFF89191 452FA666334A1C982FBD B5CAFB73FADA79706EDBC1AA86194EA7 M 2020-07-03 4963703 131.86 2387399@qq.com NULL what 636.81787 4.402292911593007E+02 22:34:43 2020-07-03 22:34:43.000000 EAB5E4405DB62ABD3CDC755D2B6149B7 F9A516F5DFC225F5E60F 46C5C23819582B06A32FADDA87DA0B90 M 2020-07-03 9142247 496.00 9106613@qq.com NULL what 585.96972 7.265983962731427E+02 22:34:43 2020-07-03 22:34:43.000000 7D0438B95A1C55AB788A607F41F37CB7 41CADEAB6D4C47835A9F 505DEC9D45DC299DC2E06256CA49BC72 M 2020-07-03 2410890 156.00 4220577@qq.com NULL what 360.82548 6.294935520219123E+02 22:34:43 2020-07-03 22:34:43.000000 10 rows got 已用时间: 252.445(毫秒). 执行号:619. SQL> select * from liaotao.tab_test where (shengri, xm) in (select top 10 shengri, xm from liaotao.tab_test order by dbms_random.value); BH SFZHM XM XB SHENGRI DHHM XZ EMAIL ZHAOPIAN JIANLI C1 C2 C3 C4 -------------------------------- -------------------- -------------------------------- -- ---------------------------------------------------------------------------------------------------- -------------------- ------ -------------- ---------- ------ --------- ------------------------- ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- 46304A5449DF173B3CAA7F2741E3026B 6F23594C73ED27DFF0DD 2F8F9E9047B29B70824861779983A7A7 M 2020-07-03 7715851 746.21 791292@qq.com NULL what 748.12398 1.024310610384825E+02 22:34:43 2020-07-03 22:34:43.000000 D44448C2BFEE6743FD68CD174A8F49EE 3E4850AB4A5CC634D458 9F094B2F7C07C6FE4E5D5E13C556D026 M 2020-07-03 1703134 674.51 696452@qq.com NULL what 193.26920 9.559960537524876E+01 22:34:43 2020-07-03 22:34:43.000000 595FC9A2938D43736C61177D21D513F5 2FB8DB9EDF3082FA5C2E EEBE8BF0C5507B6169693CE796468EF2 F 2020-07-03 9540612 613.72 998631@qq.com NULL what 411.59275 2.954926546106545E+02 22:34:43 2020-07-03 22:34:43.000000 D3231D1949B36F295C7A2CC732B546B7 3A7FC95681EEC8D61DE5 6C6B76109163F7EF466686F61989A40F M 2020-07-03 6085722 687.48 1118305@qq.com NULL what 262.47037 2.704153879263510E+02 22:34:43 2020-07-03 22:34:43.000000 F573EA167B64616D873C43D91429B1E3 9E088C6891B401ABE3CC 3B21D1D7DD7481F79926FBDD833CE509 M 2020-07-03 4200058 41.83 6821023@qq.com NULL what 454.74799 4.761173121636349E+02 22:34:43 2020-07-03 22:34:43.000000 D819E8942015E33298E0EDDCC401CD35 4404E60E51AED05281D4 FD746447135D1E46907667364FCB2803 F 2020-07-03 9191653 143.65 823807@qq.com NULL what 544.12195 2.772557826704606E+02 22:34:43 2020-07-03 22:34:43.000000 72BADD5E7CC60312A034951C2F67CDCC CABB7FB842D39FC50D36 FF3559FA3AD63929EF1E67967E886EDE F 2020-07-03 1644375 720.05 3759587@qq.com NULL what 924.97137 9.844654750765609E+02 22:34:43 2020-07-03 22:34:43.000000 31A6E348672A1DF78D232274189801D5 EF7FD65256AA5E5519D2 691C09FDFAB1DBC46A5C61F59708AE52 F 2020-07-03 5432337 735.11 5853128@qq.com NULL what 426.97101 5.610184795186010E+02 22:34:43 2020-07-03 22:34:43.000000 E5A93D301CFACA1869B5A9C2EFF853E9 E7801F61D5A6B7719F2D A724D65C02302F7815214CE07546E4D4 M 2020-07-03 4897992 88.43 1620279@qq.com NULL what 791.39816 2.713034413458330E+02 22:34:43 2020-07-03 22:34:43.000000 01CFBDE508DA38F81703C9814F1CD3C4 3CC507F40E360004CC67 0358DEC7B48B4B0772706A6E321E09D4 F 2020-07-03 9518383 522.00 6103153@qq.com NULL what 869.01294 2.677786137400095E+02 22:34:43 2020-07-03 22:34:43.000000 10 rows got 已用时间: 316.914(毫秒). 执行号:620. SQL> --删除 delete from liaotao.tab_test where bh in (select top 10 bh from liaotao.tab_test order by dbms_random.value); 影响行数 10 已用时间: 291.697(毫秒). 执行号:621. SQL> delete from liaotao.tab_test where sfzhm in (select top 10 sfzhm from liaotao.tab_test order by dbms_random.value); 影响行数 10 已用时间: 268.341(毫秒). 执行号:622. SQL> delete from liaotao.tab_test where (shengri, xm) in (select top 10 shengri, xm from liaotao.tab_test order by dbms_random.value); 影响行数 10 已用时间: 321.284(毫秒). 执行号:623. SQL> --更新 update liaotao.tab_test set (SFZHM,XM,XB,SHENGRI,DHHM,XZ,EMAIL,C1,C2,C3,C4)= (select top 1 SFZHM,XM,XB,SHENGRI,DHHM,XZ,EMAIL,C1,C2,C3,C4 from liaotao.tab_test order by dbms_random.value); 影响行数 99970 已用时间: 00:00:03.687. 执行号:624. SQL> --8.清空表后,在表tab_test上第三次创建基于shengri、xm两个字段的联合索引idx_sr_xm,利用SQL或程序插入10万条记录,记录插入用时和磁盘空间占用情况 truncate table liaotao.tab_test; 操作已执行 已用时间: 9.159(毫秒). 执行号:625. SQL> create INDEX liaotao.idx_sr_xm on liaotao.tab_test(shengri,xm); 操作已执行 已用时间: 7.738(毫秒). 执行号:626. SQL> select sum(a.BYTES)/1024/1024,sum(a.BYTES-b.BYTES)/1024/1024 from DBA_DATA_FILES a,DBA_FREE_SPACE b where a.TABLESPACE_NAME=b.TABLESPACE_NAME and b.TABLESPACE_NAME='LIAOTAO_DATA'; SUM(A.BYTES)/1024/1024 SUM(A.BYTES-B.BYTES)/1024/1024 ---------------------- ------------------------------ 2048 0.203125 已用时间: 12.954(毫秒). 执行号:627. SQL> insert into liaotao.tab_test select sys_guid() bh , substr(sys_guid(), 1, 20) sfzhm , sys_guid() xm , case when mod(to_number(trunc(dbms_random.value(0, 2))), 2)=0 then 'M' else 'F' end xb, SYSDATE shengri , dbms_random.value(10000, 9999999) dhhm , dbms_random.value(1, 999) xz , trunc(dbms_random.value(10000, 10000222)) ||'@qq.com' email , null zhaopian , 'what' jianli , dbms_random.value(1, 999) c1, dbms_random.value(1, 999) c2, sysdate c3 , sysdate c4 from dual connect by rownum<=100000; 影响行数 100000 已用时间: 00:00:07.475. 执行号:628. SQL> select sum(a.BYTES)/1024/1024,sum(a.BYTES-b.BYTES)/1024/1024 from DBA_DATA_FILES a,DBA_FREE_SPACE b where a.TABLESPACE_NAME=b.TABLESPACE_NAME and b.TABLESPACE_NAME='LIAOTAO_DATA'; SUM(A.BYTES)/1024/1024 SUM(A.BYTES-B.BYTES)/1024/1024 ---------------------- ------------------------------ 2048 38.953125 已用时间: 12.335(毫秒). 执行号:629. SQL> --9.在有三条索引的情况下,执行查询、删除和更新部分SQL语句,并分别记录执行用时; --查询 select count(*) from liaotao.tab_test; COUNT(*) -------------------- 100000 已用时间: 0.956(毫秒). 执行号:630. SQL> select count(*) from liaotao.tab_test where xb='F'; COUNT(*) -------------------- 49988 已用时间: 8.392(毫秒). 执行号:631. SQL> select * from liaotao.tab_test where bh in (select top 10 bh from liaotao.tab_test order by dbms_random.value); BH SFZHM XM XB SHENGRI DHHM XZ EMAIL ZHAOPIAN JIANLI C1 C2 C3 C4 -------------------------------- -------------------- -------------------------------- -- ---------------------------------------------------------------------------------------------------- -------------------- ------ -------------- ---------- ------ --------- ------------------------- ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- 8A20DD388996533B67B1821EBD2B99AA 4E9150A72236F6331997 7A52D7F60F68BEF6CD04ECA076361879 F 2020-07-03 160485 941.80 6812897@qq.com NULL what 761.32758 2.153211296192935E+02 22:34:56 2020-07-03 22:34:56.000000 CFF4ECC096EAD10C8FC9DCEF658A3E10 682F1F6F31AF90BE2F85 E70A1437CE3FCF16C5309E336F3F9CCC F 2020-07-03 6715224 905.32 542901@qq.com NULL what 329.97788 8.032113324209168E+02 22:34:56 2020-07-03 22:34:56.000000 86DF90536E67FEFB1281E0047B531B20 C63A40BEEC6E5B6ADC2B 822EC6749F91E3CF7BEAE713DA6B4D20 F 2020-07-03 9094881 891.53 7483980@qq.com NULL what 201.28427 8.590368772531100E+02 22:34:56 2020-07-03 22:34:56.000000 18020DF84BCEDA5EEAA74C0E4DAC8811 F36EFD4B6DC2BCAD92F4 DBE45284E9DCFA005EBC35AB1F906BE4 M 2020-07-03 5116193 797.76 2154725@qq.com NULL what 553.38162 3.145397112115937E+02 22:34:56 2020-07-03 22:34:56.000000 37ABEF6C46A4A638411D020909ADD9A9 471CF501FB3C58791294 D8472CBD9124C0CDF80047B3FB6EFD3D F 2020-07-03 5317250 801.20 891760@qq.com NULL what 493.65776 2.141543613742824E+02 22:34:56 2020-07-03 22:34:56.000000 1CFB9E9A0341FEBC12D27448E2817CC9 303B6F5FB8471D85CBDA ABB8EB31F27A0A93A92D2ABAA7E9682D M 2020-07-03 3361624 375.49 8651605@qq.com NULL what 488.75151 5.548361860894767E+02 22:34:56 2020-07-03 22:34:56.000000 A5A739CE066D53E880A0391F41FA672F 9F66E003724D614EBD9E 7BEEDD00DEA0E19DC486D63170365B21 F 2020-07-03 1381309 822.14 3614053@qq.com NULL what 640.64917 8.570752632245770E+02 22:34:56 2020-07-03 22:34:56.000000 AD8196CEF28D4237F7352322A5C36F2E 58E4D2800EC4CDAFCAF0 887ABB7F4C16158BE7D71C839558B351 M 2020-07-03 5040352 878.90 7557328@qq.com NULL what 172.16348 7.589709237729998E+02 22:34:56 2020-07-03 22:34:56.000000 F1E69B2C2805C5042EFB355529E09B32 B784D8168F87033A4A8A DFA0A36F72D55F6BBD7A6164EFE7534A M 2020-07-03 1502488 372.17 2047783@qq.com NULL what 767.18506 3.033152663597442E+02 22:34:56 2020-07-03 22:34:56.000000 3108BA2EE6EEB61D6E6DB32D70674BC1 2BFF441EF81E4CBAAEA4 3F03615020F4F52106CBD421F5394739 M 2020-07-03 2254066 443.04 1316948@qq.com NULL what 592.34373 5.212913619169459E+02 22:34:56 2020-07-03 22:34:56.000000 10 rows got 已用时间: 247.270(毫秒). 执行号:632. SQL> select * from liaotao.tab_test where sfzhm in (select top 10 sfzhm from liaotao.tab_test order by dbms_random.value); BH SFZHM XM XB SHENGRI DHHM XZ EMAIL ZHAOPIAN JIANLI C1 C2 C3 C4 -------------------------------- -------------------- -------------------------------- -- ---------------------------------------------------------------------------------------------------- -------------------- ------ -------------- ---------- ------ --------- ------------------------- ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- FE836B0645FBB1F686C85191DD199BAF FEEE54808151AD540137 2BCF8F85A913A599004876E9BCCD756C M 2020-07-03 1426476 102.51 7756309@qq.com NULL what 179.00015 4.037064462344658E+02 22:34:56 2020-07-03 22:34:56.000000 8E1427FE274CFDE43389F1602A303EC8 352134839AC51AB6162F 6FAD2D2DFFBF98126F08CE8FFD1CF68D F 2020-07-03 1968170 689.81 3209915@qq.com NULL what 715.33252 8.830028291307403E+02 22:34:56 2020-07-03 22:34:56.000000 39F6AC5A37888EA530CE820FF6C3AA99 6D70769AEDCE99B6ABCA 941A92B03130C239FC3040748698DA17 M 2020-07-03 2434657 514.51 8575240@qq.com NULL what 197.84854 3.902795670746264E+02 22:34:56 2020-07-03 22:34:56.000000 C66B39872E2E3FB7983D6E552DEA6396 ADF41E83AB34889B346E 5FA267FCE401812E0A71236E0D3DC04F F 2020-07-03 4344574 127.31 9145601@qq.com NULL what 292.80414 5.601046730881112E+02 22:34:56 2020-07-03 22:34:56.000000 5A18E24F38EEA71580AF0E7617E93F84 AD3A9421FC8C17A7402A 9837353E5BCDFDC657DE7B71FEF3800C F 2020-07-03 1616474 603.57 1780844@qq.com NULL what 957.81869 1.147799860321823E+02 22:34:56 2020-07-03 22:34:56.000000 B7B077141DCD9C3FA1FB24E681FE1864 063433D1AF800B685D30 DE17ABB06F44A666E6588FDC35A50425 M 2020-07-03 9466673 968.93 1872621@qq.com NULL what 805.84938 5.979672322613035E+02 22:34:56 2020-07-03 22:34:56.000000 057159EDF23DB6D334D0D01B01E6F5DC 07BC90179E20729B1433 4A524F1D7A5C6940D6EEE3C865D3C566 F 2020-07-03 3464730 628.97 3405469@qq.com NULL what 540.52970 3.744551460256126E+02 22:34:56 2020-07-03 22:34:56.000000 1C1E6BC31A5A1D1BDB3C5B7F89D9B31F B68962D331FEC9B66EC7 2F84399EA9574F3554B73FE3E5F83D06 M 2020-07-03 2393965 779.34 60049@qq.com NULL what 350.03607 7.964722139511593E+01 22:34:56 2020-07-03 22:34:56.000000 D9AB5D2168B125BD7BB5271D79E1DC82 9E246BF8CE39E577D4A8 E5D840F4787B0BC2F3CC52264D4A1AE9 M 2020-07-03 4499701 179.32 6455564@qq.com NULL what 115.55312 5.152702884214327E+01 22:34:56 2020-07-03 22:34:56.000000 5345967FFAF6EEC767494D6E61A3D06F 1824C2049DC547AF8F41 10935BC5DEA3E56831F667E7BB2DFD6F M 2020-07-03 9105500 864.99 8607368@qq.com NULL what 297.99313 7.123607310919840E+02 22:34:56 2020-07-03 22:34:56.000000 10 rows got 已用时间: 245.090(毫秒). 执行号:633. SQL> select * from liaotao.tab_test where (shengri, xm) in (select top 10 shengri, xm from liaotao.tab_test order by dbms_random.value); BH SFZHM XM XB SHENGRI DHHM XZ EMAIL ZHAOPIAN JIANLI C1 C2 C3 C4 -------------------------------- -------------------- -------------------------------- -- ---------------------------------------------------------------------------------------------------- -------------------- ------ -------------- ---------- ------ --------- ------------------------- ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- 137A174DD3CFF4FB0C4B5FC21EC2E9B7 64C3B14AB435711DA4F3 984A655589EC406557B2F65E4CAD59A4 M 2020-07-03 4951857 516.34 4657494@qq.com NULL what 158.72640 7.479414187348175E+02 22:34:56 2020-07-03 22:34:56.000000 B1BACDC97FFD53C9681929B51B42FD0E 2842D728B2E9937B4106 46F725BA68D4A8A8A838EDF659F3BBBF F 2020-07-03 4498323 181.76 4055356@qq.com NULL what 75.53397 6.744629346986594E+02 22:34:56 2020-07-03 22:34:56.000000 40D9F13C405260873C85BF2397E214B1 84CD7E39A42F66A25FC1 7740937BD454BB8C458134DBF3FF1043 F 2020-07-03 9555845 773.61 4994010@qq.com NULL what 89.80316 6.125484355918823E+02 22:34:56 2020-07-03 22:34:56.000000 18107935CF350BECAC04D6BABC5FD629 9AF46B83827E92CE7520 D5A3F5C7C39AF1323CCFD9FBC50E48BB F 2020-07-03 6947672 493.65 5145484@qq.com NULL what 630.38016 1.705286375738348E+02 22:34:56 2020-07-03 22:34:56.000000 816513389347FD8A918D9029967F27FB E7B3A533054AD46314C1 8FA3C8F158F505C216386C2D69B8E6D2 F 2020-07-03 9180953 721.60 6888741@qq.com NULL what 239.91639 5.066132637828651E+02 22:34:56 2020-07-03 22:34:56.000000 3A3B0A9FAC3E812EFE1353053EA701C1 1A94DF150AEBD52E4142 B343118B49FCAD524EEFAEBBCD6407F8 F 2020-07-03 4492980 714.61 1412803@qq.com NULL what 517.16312 8.471820801124823E+02 22:34:56 2020-07-03 22:34:56.000000 348A7C83A239C6C892B8D808AE868A56 C3A7111941BE540B9882 386F63772E51FFFBAAD4D51B3D8A719C M 2020-07-03 9510885 589.03 7642328@qq.com NULL what 817.05888 3.274565571353103E+02 22:34:56 2020-07-03 22:34:56.000000 BACC7C6B4BD420577AEBAC19A2E2169A 6EE17396B7B2A1DF591C 21B0B6B7D05D74598B29F0C53C99C54D M 2020-07-03 6247643 72.30 3610488@qq.com NULL what 526.07264 7.410192305874169E+02 22:34:56 2020-07-03 22:34:56.000000 45C610D9B46AA5257B6187BFDAD5D305 A8A5E782B853E78650B3 68B41CE7167DBA3481F8458BB0518AEE M 2020-07-03 2499822 729.59 961397@qq.com NULL what 889.82731 9.227526599414426E+01 22:34:56 2020-07-03 22:34:56.000000 957A8C7B8283D7255A6DBAD282CA96A5 3CD8480643D4E010FC7F C0E5B74AFC7864DC0860FA566105F922 M 2020-07-03 5138023 613.06 5358545@qq.com NULL what 876.16617 4.915828143603088E+02 22:34:56 2020-07-03 22:34:56.000000 10 rows got 已用时间: 246.395(毫秒). 执行号:634. SQL> --删除 delete from liaotao.tab_test where bh in (select top 10 bh from liaotao.tab_test order by dbms_random.value); 影响行数 10 已用时间: 246.628(毫秒). 执行号:635. SQL> delete from liaotao.tab_test where sfzhm in (select top 10 sfzhm from liaotao.tab_test order by dbms_random.value); 影响行数 10 已用时间: 327.875(毫秒). 执行号:636. SQL> delete from liaotao.tab_test where (shengri, xm) in (select top 10 shengri, xm from liaotao.tab_test order by dbms_random.value); 影响行数 10 已用时间: 306.306(毫秒). 执行号:637. SQL> --更新 update liaotao.tab_test set (SFZHM,XM,XB,SHENGRI,DHHM,XZ,EMAIL,C1,C2,C3,C4)= (select top 1 SFZHM,XM,XB,SHENGRI,DHHM,XZ,EMAIL,C1,C2,C3,C4 from liaotao.tab_test order by dbms_random.value); 影响行数 99970 已用时间: 00:00:05.239. 执行号:638. SQL> spool off;