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

  • Home
  • SEARCH
  • 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 665767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:44:40+00:00 2026-05-13T23:44:40+00:00

Using an Oracle temporary table does not generate much redo log as a normal

  • 0

Using an Oracle temporary table does not generate much redo log as a normal table. However, the undo log is still generated. Thus, how can I write insert, update, or delete statement on a temporary table but Oracle will not generate undo log or generate as little as possible?

Moreover, using /+append/ in the insert statement will generate little undo log. Am I correct? If not, could anyone explain me about using the hint /+append/?

INSERT /*+APPEND*/ INTO table1(...) VALUES(...);
  • 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-13T23:44:41+00:00Added an answer on May 13, 2026 at 11:44 pm

    Oracle needs UNDO information to rollback the DML in the transaction. As Gary puts it in his comment:

    “The UNDO is needed to rollback the
    effects of a single statement if it
    fails partway through. It is also
    needed to provide for a ROLLBACK TO
    SAVEPOINT or a ROLLBACK (though for
    GLOBAL TEMPORARY TABLES the latter
    would only be relevant for session
    duration GTTs).”

    This UNDO information itself generates REDO. There is nothing you can do about this situation: temporary tables need UNDO and that’s the end of it.

    To minimize the amount of UNDO is quite simple: just insert records and select records. INSERT generates the smallest amount of UNDO, because rolling back an INSERT requires simply the rowid. Conversely DELETE statements generate the most UNDO, because the database has to store the entire record. Basically, to rollback an INSERT issue a DELETE, to rollback a DELETE issue an INSERT. An UPDATE generates a variable amount of UNDO, because we need the old versions of the changed columns; the more columns changed and the bigger they are, the larger the amount of UNDO generated.

    Demonstration

    In session one a user will insert a lot of records into a temporary table and then delete them. In session two a DBA will monitor the transaction’s UNDO usage.

    SSN1> insert into gtt23
      2      select * from big_table
      3  /
    
    553928 rows created.
    
    SSN1>
    

    Undo usage:

    SSN2> select space, noundo, used_ublk, used_urec from v$transaction
       2  /
    
    SPA NOU  USED_UBLK  USED_UREC
    --- --- ---------- ----------
    NO  NO         257      10816
    
    SSN2>
    

    Now the deletion:

    SSN1> delete from gtt23
       2  /
    
    553928 rows deleted.
    
    SSN1>
    

    Undo usage (several samples during a long running statement)::

    SSN2> r
       1* select space, noundo, used_ublk, used_urec from v$transaction
    
    SPA NOU  USED_UBLK  USED_UREC
    --- --- ---------- ----------
    NO  NO       11123     435605
    
    SSN2> r
       1* select space, noundo, used_ublk, used_urec from v$transaction
    
    SPA NOU  USED_UBLK  USED_UREC
    --- --- ---------- ----------
    NO  NO       13413     525452
    
    SSN2> r
       1* select space, noundo, used_ublk, used_urec from v$transaction
    
    SPA NOU  USED_UBLK  USED_UREC
    --- --- ---------- ----------
    NO  NO       14552     570567
    
    SSN2>
    

    Commit (the temporary table has transaction scope i.e. DELETE ROWS)

    SSN1> commit
       2  /
    
    Commit complete.
    
    SSN1>
    

    Undo usage:

    SSN2> r
       1* select space, noundo, used_ublk, used_urec from v$transaction
    
    no rows selected
    
    SSN2>
    

    The undo usage is accumulative:

    SSN1> insert into gtt23
       2      select * from big_table
       3  /
    
    553928 rows created.
    
    SSN1> delete from gtt23
       2  /
    
    553928 rows deleted.
    
    SSN1> insert into gtt23
       2      select * from big_table
       3  /
    
    553928 rows created.
    
    SSN1>
    

    Undo usage

    SSN2> r
       1* select space, noundo, used_ublk, used_urec from v$transaction
    
    SPA NOU  USED_UBLK  USED_UREC
    --- --- ---------- ----------
    NO  NO         258      10816
    
    SSN2> r
       1* select space, noundo, used_ublk, used_urec from v$transaction
    
    SPA NOU  USED_UBLK  USED_UREC
    --- --- ---------- ----------
    NO  NO       14766     579495
    
    SSN2> r
       1* select space, noundo, used_ublk, used_urec from v$transaction
    
    SPA NOU  USED_UBLK  USED_UREC
    --- --- ---------- ----------
    NO  NO       14819     581685
    
    SSN2>
    

    Summary

    So, to minimise the impact of UNDO which a temporary table generates make sure you insert the right data, once. Avoid applying updates to it and especially avoid deleting large numbers of records from them. If you are using a temporary table with a transaction scope there really should be no need to delete records from it. If your temporary table has a session duration and you need to clear it out, it would be better to use TRUNCATE, if possible, rather than DELETE.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 367k
  • Answers 367k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Supposing you're in XCode, open the source file and select… May 14, 2026 at 4:52 pm
  • Editorial Team
    Editorial Team added an answer try this: CONVERT(DATETIME, CONVERT(NVARCHAR, YYYYMMDD)) For example: SELECT CONVERT(DATETIME, CONVERT(NVARCHAR,… May 14, 2026 at 4:52 pm
  • Editorial Team
    Editorial Team added an answer I tried to load the file into a property and… May 14, 2026 at 4:52 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.