Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2880744
  • 博文数量: 599
  • 博客积分: 16398
  • 博客等级: 上将
  • 技术积分: 6875
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-30 12:04
个人简介

WINDOWS下的程序员出身,偶尔也写一些linux平台下小程序, 后转行数据库行业,专注于ORACLE和DB2的运维和优化。 同时也是ios移动开发者。欢迎志同道合的朋友一起研究技术。 数据库技术交流群:58308065,23618606

文章分类

全部博文(599)

文章存档

2014年(12)

2013年(56)

2012年(199)

2011年(105)

2010年(128)

2009年(99)

分类: Oracle

2012-02-02 13:59:48

append does a direct path load (if it can, it is not a promise, you are requesting and we may or may not do it for you - silently)
 
if you direct path load, the transaction that did the direct path load CANNOT query that segment - but other transactions can, they just cannot see the newly loaded data.
if you direct path load, you never use any existing free space, it always writes above the high water mark.
 
if you direct path load, we bypass UNDO on the table - only the table - modifications
 
if you direct path load, you'll maintain indexes - we build mini indexes on the newly loaded data and merge them into the 'real' indexes in bulk. A direct path load of large amounts of data will maintain indexes very efficiently.
 
if you direct path load you can bypass redo on the TABLE in archivelog mode, if the database is set up to allow nologging and you have the segment set to nologging
 
direct path loading bypasses the buffer cache, you write directly to the datafiles.
 
direct path loading is only appropriate for the first load of a segment or an increment load of lots of data - or an increment load into a table that never has any deletes (so there is no free space to consider)
 
transactional systems - you probably won't use it.
warehouses - a tool you'll use a lot
 
insert /*+ append */ will ignore the append hint and use conventional path loading when the table has referential integrity or a trigger...

consider:

ops$tkyte%ORA9IR2> create table p( x int primary key);
 
Table created.
 
ops$tkyte%ORA9IR2> create table c ( x int );
 
Table created.
 
ops$tkyte%ORA9IR2>

ops$tkyte%ORA9IR2> insert into p (x) values (1);
 
1 row created.
 
ops$tkyte%ORA9IR2>

ops$tkyte%ORA9IR2> insert /*+ append */ into c select 1 from dual;
 
1 row created.
 
ops$tkyte%ORA9IR2> select * from c;

select * from c
              *
ERROR at line 1:
ORA-12838: cannot read/modify an object after modifying it in parallel
 
that shows we did a direct path operation, definitely.  You cannot read from a table in the same transaction that direct path loads it... Now
 
ops$tkyte%ORA9IR2>
ops$tkyte%ORA9IR2> commit;
 
Commit complete.
 
ops$tkyte%ORA9IR2> alter table c add constraint c_fk_p foreign key(x) references p(x);
 
Table altered.
 
ops$tkyte%ORA9IR2> insert /*+ append */ into c select 1 from dual;
 
1 row created.
 
ops$tkyte%ORA9IR2> select * from c;
         X
----------
         1
         1
 
that shows the append was ignored, referential integrity makes append "go away"
 
ops$tkyte%ORA9IR2> alter table c drop constraint c_fk_p;
 
Table altered.
 
ops$tkyte%ORA9IR2> insert /*+ append */ into c select 1 from dual;
 
1 row created.
 
ops$tkyte%ORA9IR2> select * from c;

select * from c
              *
ERROR at line 1:
ORA-12838: cannot read/modify an object after modifying it in parallel
 
so we are back to being able to direct path... with append
 
ops$tkyte%ORA9IR2> create or replace trigger c before insert on c for each row
  2  begin
  3          null;
  4  end;
  5  /
 
Trigger created.
 
ops$tkyte%ORA9IR2> insert /*+ append */ into c select 1 from dual;
 
1 row created.
 
ops$tkyte%ORA9IR2> select * from c;
         X
----------
         1
         1
         1
         1
and apparently we did not direct path - we can read the table..
 
ops$tkyte%ORA9IR2> drop trigger c;
 
Trigger dropped.
 
ops$tkyte%ORA9IR2> insert /*+ append */ into c select 1 from dual;
 
1 row created.
 
ops$tkyte%ORA9IR2> select * from c;

select * from c
              *
ERROR at line 1:
ORA-12838: cannot read/modify an object after modifying it in parallel
 
and now back to being able to again.
 
 

sqlldr can and does ignore triggers/referential integrity and even uniqueness during a direct path load, insert /*+ append */ does not - you are not using direct path when they (constraints) exist.

parallel is always a direct path, if you go parallel, you will be appending.

 
阅读(1505) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~