table refresh process - discuss optoins [message #682722] |
Thu, 12 November 2020 00:42  |
 |
talhaparvaiz@yahoo.com
Messages: 14 Registered: October 2020
|
Junior Member |
|
|
Hi,
I have a table (let's call it table_A) that is sourced from multiple other tables, having around 300k records
now, I want to refresh this table on a daily basis with the updated information. Here are a few options that I was thinking off (probably there more and better) and wanted to get your opinion
option 1)
Step 1. create a table (one time)
Step 2. Delete all records that have been changed, since the last table refresh
Step 3. Delete all records that have been deleted from the other tables, since the last table refresh
Step 4. Add records (with new data) that has been changed, since the last table refresh
Step 5. Add new records that have been added, since the last table refresh
Option 2)
Step 1. create a table (one time)
Step 2. Delete all records that have been deleted from the other tables, since the last table refresh
Step 3. Add new records that have been added, since the last table refresh
Step 4. update records (with new data) that has been changed, since the last table refresh
The difference between options 1 and 2 is that in option 1 I am Deleting a record that has been changed since the last refresh and Inserting that record. Vs, with option 2, I am using the oracle update function.
The assumption is that with option 2, an update function will work efficiently as it will not require indexing for the records that are updated. vs. option one will require indexing as It is deleting and adding new records for all the updates.
Please advise
Thanks
[Edit MC: removed 40 blank lines]
[Updated on: Thu, 12 November 2020 01:00] by Moderator Report message to a moderator
|
|
|
|
Re: table refresh process - discuss optoins [message #682726 is a reply to message #682722] |
Thu, 12 November 2020 02:11   |
John Watson
Messages: 8804 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
I do not understand the difference in then need for indexing. Whether you intend to delete or update changed rows, you have to find them. That would usually be done with an index.
By the way, I wish you would not say "record" when you mean "row".
|
|
|
|
|
|
|
|
Re: table refresh process - discuss optoins [message #682736 is a reply to message #682730] |
Fri, 13 November 2020 01:22  |
John Watson
Messages: 8804 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
Any re-indexing would be insane. Where did you find that advice?
And why do you think update is "more expensive" than delete and insert? It should be quicker. A lot quicker.
As for a materialized view, you need to check out the complexity. You may need to refresh it with COMPLETE, which is the same as truncate and recreate, rather than FAST. Note that FAST refresh does indeed do updates.
And one other thing, please stop saying "record" when you mean "row". It is very unprofessional to misuse those words. I hope you are not going to compound the error by describing "columns" as "fields".
[Updated on: Fri, 13 November 2020 01:25] Report message to a moderator
|
|
|