Skip to Content
0
Jul 26, 2016 at 03:17 PM

INSERT Vs UPSERT in SAP HANA?

2954 Views

We have 100 millions to handle.

We have a final table . Let say the name of final table is TFinal.

We have different sub table (T1,T2,T3 , etc ) which insert the calculated data in TFinal.

The problem is we have duplicate records in T1, T2, T3.

For Example :- T1 data,

ID 1 2 3 4

T2 data ,

ID 5 6 3 7

First the data from T1 will be inserted into 'TFinal' table . Subsequently, we will be inserting T2 data in TFinal table. But, Insert statement for Table T2 will fail because ID (3) will be duplicate entry in table 'TFinal' as it was already inserted in TFinal from Table T1.

Solution for the above problem is, we can use UPSERT instead of INSERT.

But, I want to understand the time complexity of both the statement.
Any link where I can read about it or any quick explanation will be appreciated.