DB2 Merge performance

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ashish5185
    New Member
    • Aug 2007
    • 1

    DB2 Merge performance

    I have a base table with almost 8 million records.
    There are 2 tables one containing the new inserts and other containing updates to the base table.
    Now I have two options:-
    1. Use Update statement and then Insert into the base table.

    2. Use Merge statement on base table and staging table that will contain both the inserts as well as updated records.

    This query needs to be run everyday.
    Which approach should I follow considering the performance criteria?

    I would appreciate any help to the above problem?
  • FritzLeblanc
    New Member
    • Jul 2007
    • 12

    #2
    Originally posted by ashish5185
    I have a base table with almost 8 million records.
    There are 2 tables one containing the new inserts and other containing updates to the base table.
    Now I have two options:-
    1. Use Update statement and then Insert into the base table.

    2. Use Merge statement on base table and staging table that will contain both the inserts as well as updated records.

    This query needs to be run everyday.
    Which approach should I follow considering the performance criteria?

    I would appreciate any help to the above problem?
    I'm not sure you've provided enough information. The answer may depend on how many rows are in the insert and updates tables. If they're small relative to the base table, then I'd go with option 1. Probably the best thing you can do is to test both options and choose the option that performs best in your environment.

    Fritz

    Comment

    Working...