Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 255883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:58:04+00:00 2026-05-11T21:58:04+00:00

I have four DB tables in an Oracle database that need to be rewritten/refreshed

  • 0

I have four DB tables in an Oracle database that need to be rewritten/refreshed every week or every month. I am writing this script in PHP using the standard OCI functions, that will read new data in from XML and refresh these four tables. The four tables have the following properties

TABLE A – up to 2mil rows, one primary key (One row might take max 2K data)

TABLE B – up to 10mil rows, one foreign key pointing to TABLE A (One row might take max 1100 bytes of data)

TABLE C – up to 10mil rows, one foreign key pointing to TABLE A (One row might take max 1100 bytes of data)

TABLE D – up to 10mil rows, one foreign key pointing to TABLE A (One row might take max 120 bytes of data)

So I need to repopulate these tables without damaging the user experience. I obviously can’t delete the tables and just repopulate them as it is a somewhat lengthy process.

I’ve considered just a big transaction where I DELETE FROM all of the tables and just regenerate them. I get a little concerned about the length of the transaction (don’t know yet but it could take an hour or so).

I wanted to create temp table replicas of all of the tables and populate those instead. Then I could DROP the main tables and rename the temp tables. However you can’t do the DROP and ALTER table statements within a transaction as they always do an auto commit. This should be able to be done quickly (four DROP and and four ALTER TABLE statements), but it can’t guarantee that a user won’t get an error within that short period of time.

Now, a combination of the two ideas, I’m considering doing the temp tables, then doing a DELETE FROM on all four original tables and then and INSERT INTO from the temp tables to repopulate the main tables. Since there are no DDL statements here, this would all work within a transaction. Then, however, I wondering if the memory it takes to process some 60 million records within a transaction is going to get me in trouble (this would be a concern for the first idea as well).

I would think this would be a common scenario. Is there a standard or recommended way of doing this? Any tips would be appreciated. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T21:58:04+00:00Added an answer on May 11, 2026 at 9:58 pm

    Am I the only one (except Vincent) who would first test the simplest possible solution, i.e. DELETE/INSERT, before trying to build something more advanced?

    Then, however, I wondering if the memory it takes to process some 60 million records within a transaction is going to get me in trouble (this would be a concern for the first idea as well).

    Oracle manages memory quite well, it hasn’t been written by a bunch of Java novices (oops it just came out of my mouth!). So the real question is, do you have to worry about the performance penalties of thrashing REDO and UNDO log files… In other words, build a performance test case and run it on your server and see how long it takes. During the DELETE / INSERT the system will be not as responsive as usual but other sessions can still perform SELECTs without any fears of deadlocks, memory leaks or system crashes. Hint: DB servers are usually disk-bound, so getting a proper RAID array is usually a very good investment.

    On the other hand, if the performance is critical, you can select one of the alternative approaches described in this thread:

    • partitioning if you have the license
    • table renaming if you don’t, but be mindful that DDLs on the fly can cause some side effects such as object invalidation, ORA-06508…
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have four tables in my database and i want to join that's and
This is my database structure I have four tables. Table LocalArea and Lanungaue have
I have four tables in database. person(Perid ,firstname , lastname , gender) Research (Resid
I have four tables in my database( notes , expense , category and items
I have four different tables, one main SPECIAL table containing only id's that reference
I have four tables in my database: student : contain the student's ID and
I have four tables in a MySQL database and I am trying to create
I have four Database Tables like these: Book ID_Book |ID_Company|Description BookExtension ID_BookExtension | ID_Book|
My situation is i have four tables Patient, Receipt, Clinic and Laboratory. CREATE DATABASE
I have these four tables (which are hierarchical, meanwhile) in my database: Table 1:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.