• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 796
  • Last Modified:

Query question

I have a query like below..
Insert /*+ append */ into sales select * from  temp_sales.

What is /*+ Append */ ? when do you use it?   is it some kind of index hint?
  • 2
3 Solutions
Guy Hengel [angelIII / a3]Billing EngineerCommented:
/*+ APPEND */ is an oracle hint, that tells oracle to add the data above the high water mark, and does not try to find empty space in the already used blocks of the table.
Guy Hengel [angelIII / a3]Billing EngineerCommented:
when to use it: usually, when you load lots of rows to the table, ie from another table.
using it will avoid the overhead of trying to fit in few rows each time into places in blocks where rows have been deleted previously in the table.
will not give any performance boost on tables that are empty, or where all blocks are full.
Append hint can be used to bypass UNDO operations while doing insert
Naveen KumarProduction Manager / Application Support ManagerCommented:
just to put it with some sample data:

row1             - existing
row2             - deleted
row3             - deleted ( though row2 and row3 are deleted from table, this space can be reused for inserts but this is an used space )
row4             - existing. This is the last row in the table till now.  So any space beyond this is unused space from here till the allocated space of the object.

if you use this hint /*+ append */, the insert command will start from the unused space after row4 and it will continue...meaning if not sufficient it will consume space from the tablespace.

If this hint is not used, then oracle might try to use the free space ( already used space of row 2 and row 3 ) for the new inserts which we are doing and if the record length of the data which we are inserting is matching with the free space ( already used space of row2 and row3 ).

let us say, deleted records had many fields had null and new inserts have data for all fields and so oracle will just try and free space ( used space ) will not be sufficient and so it proceeds after row4 which is like using /*+ append */ hint.

As angelIII said, for tables which are complete empty ( meaning tables which are already truncated or just got created ) or tables which are completely full ( with no holes in the data blocks ) will not have any impact whether u use this hint or not.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now