View previous topic :: View next topic
|
Author |
Message |
kanisha_prabha
New User
Joined: 10 Mar 2006 Posts: 26
|
|
|
|
Hi,
A particular DB2 table has around 20 million records. This table needs to be updated with around 10 million records which exist in a flat file. Some of the data in the file will be updates to the table (against inserts). Note that in case of updates, the file records must be updated to the existing table data. There are 2 ways to accomplish this -
1. Unload the table data to another flat file. Perform a file matching logic to check updates against inserts. Create one file containing, original un-affected table records, update records and new inserts. Then load replace or resume no the table.
2. Use fileaid with SQL INSERT option to directly update/insert into the table.
I also have to keep tab of how many records got updated and how many were inserted after the load is done.
Given the above scenario, which method should I use? Which method will be faster? If I am using method 2, can I capture the record count for updates and inserts and report the same? Are there any other method that is more suitable and I am ignoring?
Thanks. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
use method one...
as a rule of the thumb when more than 30% of the <things> are processed
a sequential match approach will be faster
apart the issues related to locking, commits, backouts and so on |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Individual inserts are high-overhead activity. Every row of data and all of the indexes have to be handled for each insert.
If unload/reload is used (in addition to the potentially substantial processing improvement), the completely reloaded data will usually provide better performance when subequently used. |
|
Back to top |
|
|
|