[PHP]
create table c_t1 as select * from c_zysfcg where rownum<1;
insert into c_t1 select * from c_zysfcg where sfsj>=to_date('20060101','yyyymmdd') and sfsj<=to_date('20060331','yyyymmdd');
已创建1301555行。
已用时间: 00: 00: 47.85
Execution Plan
----------------------------------------------------------
0 INSERT STATEMENT Optimizer=CHOOSE (Cost=880 Card=1186914 Bytes=90205464)
1 0 PARTITION RANGE (ITERATOR)
2 1 TABLE ACCESS (FULL) OF 'C_ZYSFCG' (Cost=880 Card=1186914 Bytes=90205464)
Statistics
----------------------------------------------------------
5861 recursive calls
97458 db block gets
36944 consistent gets
16240 physical reads
137946336 redo size
850 bytes sent via SQL*Net to client
649 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
4 sorts (memory)
0 sorts (disk)
1301555 rows processed
rollback;
truncate table c_t1;
insert into c_t1 /*+ append */ select /*+ parallel(c_zysfcg,2) */ * from c_zysfcg where sfsj>=to_date('20060101','yyyymmdd') and sfsj<=to_date('20060331','yyyymmdd');
已创建1301555行。
已用时间: 00: 01: 60.71
Execution Plan
----------------------------------------------------------
0 INSERT STATEMENT Optimizer=CHOOSE (Cost=880 Card=1186914 Bytes=90205464)
1 0 PARTITION RANGE* (ITERATOR) :Q12000
2 1 TABLE ACCESS* (FULL) OF 'C_ZYSFCG' (Cost=880 Card=118691 :Q120004 Bytes=90205464)
1 PARALLEL_COMBINED_WITH_PARENT
2 PARALLEL_TO_SERIAL SELECT /*+ Q12000 NO_EXPAND ROWID(A1) */ A1."IDB",A1."XM",A1."BQDM",A1."ZKDM",A1
Statistics
----------------------------------------------------------
5499 recursive calls
97499 db block gets
36883 consistent gets
16239 physical reads
137944544 redo size
857 bytes sent via SQL*Net to client
691 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
7 sorts (memory)
0 sorts (disk)
1301555 rows processed
2CPU
....
[/PHP]
结果很奇怪,按说使用了append应该会快些,不过c_t1是新建的空表,而且默认是logging模式,如果使用nologging也许会快些吧