468,257 Members | 1,475 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,257 developers. It's quick & easy.

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?
Aug 21 '07 #1
1 2198
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
Aug 24 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Kevin King | last post: by
2 posts views Thread by Private Pyle | last post: by
3 posts views Thread by Bob Stearns | last post: by
3 posts views Thread by Michel Esber | last post: by
24 posts views Thread by Henry J. | last post: by
reply views Thread by kermitthefrogpy | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.