Oracle Enterprise Stage - Insert statement using Upsert

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
synsog
Premium Member
Premium Member
Posts: 232
Joined: Sun Aug 01, 2010 11:01 pm
Location: Pune

Oracle Enterprise Stage - Insert statement using Upsert

Post by synsog »

Hi,

We have an insert statement and we are using the Write Method as Upsert in Oracle Enterprise Stage.

My Question is - What is the difference between using the upsert mode - "User Defined Update Only" mode and writing the Insert statement here against using the "User Defined Update & Insert" mode where we basically do not update anything by giving something like 1=2 in the where clause and only use the Insert part.

Is there a performance impact by using the Update mode to actually insert against using the insert mode for insert, as both work but which is the correct & efficient way?

Thanks
felixyong
Participant
Posts: 35
Joined: Tue Jul 22, 2003 7:24 pm
Location: Australia

Re: Oracle Enterprise Stage - Insert statement using Upsert

Post by felixyong »

In term of performance pure Insert or pure Update is always faster then Upsert.

If due to certain biz rules, we've to use Upsert then we need to choose wisely on whether Update then Insert OR Insert then Update as there's performance differences as well depend on whether you've more Insert/Update data.
Regards
Felix
BI-RMA
Premium Member
Premium Member
Posts: 463
Joined: Sun Nov 01, 2009 3:55 pm
Location: Hamburg

Post by BI-RMA »

The reason a pure insert is faster, is that for upsert the database will evaluate for every row wether a key-value is already present in the database to be able to decide which statement to execute for the specific row. This makes it necessary to set the array-size - the number of records passed to the database at a time - in DataStage to 1.

When running only one kind of query DataStage can send lots of rows to the database at once reducing overhead.

Pure inserts will still maintain index-structures on the target-database. Therefore - when using inserts only - "Load" with disabled constraints and Index-Rebuild at the end is often faster than using "User defined Update only" for inserts.
"It is not the lucky ones are grateful.
There are the grateful those are happy." Francis Bacon
Post Reply