Tuesday 9 July 2013

Difference between "insert or update" & "update or insert" for DB output components in Talend‏



I have got lot of queries for asking difference between options "Insert or Update" & "Update or Insert" for "Action on Data" drop down present in Output Database components in Talend‏.

Here is the difference between these two option:

For option "insert or update", it follows below steps for each input line:

  1. Perform a "select count(*) from table where id = <line_id>"
  2. If count > 0, perform an update, else perform an insert

For "update or insert", it follows below steps for each input line:

  1. Perform an update
  2. If no line updated, perform an insert


From result point of view there is no difference between these two options. Basically these options are for optimization based on the requirements :

  •  If you have more insert than update , you should use insert or update
  •  If you have more update than insert , you should use update or insert

Let me know, if you would like to add anything to this.

This article is written by "Vikram Takkar" and published on www.vikramtakkar.com, please let me know, if you see this article on any other website/blog.



You may also like to read..

No comments:

Post a Comment