MERGE, UPSERT or DROP/DELETE + INSERT SELECT

Database
Junior Supporter

MERGE, UPSERT or DROP/DELETE + INSERT SELECT

Hi all.

I'm quite new to Teradata and I'm wondering which of the three methods is the best one for updating rows in a (big) table:

1.- MERGE (UPDATE old rows, INSERT new ones).
2.- UPSERT (UPDATE old rows, INSERT new ones).
3.- DROP/DELETE old table and INSERT SELECT INTO brand new/empty table.

Thanks in advance.

Cheers.

Carlos.
1 REPLY
SN
Enthusiast

Re: MERGE, UPSERT or DROP/DELETE + INSERT SELECT

hi,

if all that you need is to just UPDATE a table, then just use the normal UPDATE stmt. If you want to UPDATE existing rows in a table and INSERT the new values (if the row does not exist in the table) then consider MERGE/UPSERT.

and for DROP/DELETE: consider this option if yours is a refresh load everytime.