Direct-Path INSERT Oracle

余生颓废 提交于 2019-12-04 17:54:50

The first question should really be (Do I want/need to use direct path insert?", and the second should be "Did my query use direct path insert?"

If you need referential integrity checks, then you do not use direct path insert.

If you do not want the table to be exclusively locked for modifications, then do not use direct path insert.

If you remove data by deletion and only insert with this code, then do not use direct path insert.

One quick and easy check on whether direct path insert was used is to immediately, before committing the insert, issue a select of one row from the table. If it succeeds then direct path insert was not used -- you will receive an error message if it was because your change has to be commited before your session can read the table.

Referential Integrity is is not ignored in that statement.

See this AskTom thread for an explanation and an example:

what it seems to neglect to say in that old documentation is that.... insert /*+ append */ will ignore the append hint and use conventional path loading when the table has referential integrity or a trigger

Free space is an in it doesn't reuse space freed up in the table by deletes, whereas a standard insert would.

I can't see anywhere where it says it will do a referential integrity check after the operation. I suspect you have to do that yourself.

erm what index?

Edited to insert.

Index as in the 3rd row to insert, I believe not necessarily anything to do with the table unless the index in the inserts happens to be the key of the table.

Check to see if it is maintaining referential integrity? Put a "bad" record in e.g. an order with a customerid that doesn't exist.

Free space. Lets say you have a table of nchar(2) with an int primary key e.g.

1 AA
2 AB
3 AC

So in your index on the key

1 points to 0
2 points to 4 (unicode one char = two bytes)
3 points to 8

Now you delete record with key 2, now you have

1 points to 0
3 points to 8

If you do a normal insert which reuses free space you get

1 points to 0
3 points to 8
4 points to 4

This direct insert stuff however saves time by not reusing the space so you get

1 points to 0
3 points to 8
4 points to 12

Very simplified scenario for illustrative purposes by the way...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!