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 8044589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:16:39+00:00 2026-06-05T05:16:39+00:00

I need to do some inserts in a cursor over about 300000 rows, this

  • 0

I need to do some inserts in a cursor over about 300000 rows, this is however running slowly, any ideas on how i can make it run faster? Can i speed it up by batching the commits? So for example i would perform a commit after the 1000th row

DECLARE

  CURSOR test_cursor IS 
    SELECT a from database.mytable
BEGIN

  FOR curRow IN test_cursor LOOP

    insert into tableb (testval)
    values ('something');

  commit;

  END LOOP;
END; 
  • 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-06-05T05:16:41+00:00Added an answer on June 5, 2026 at 5:16 am

    300000 rows is not that many rows. Unless the rows are each extremely large, you should not commit in the middle of the batch.

    Intermediate commits will only achieve:

    • additional overhead because each commit creates additional work,
    • loss of restartability in case of error (and loss of transactional integrity),
    • greater chance of running into ORA-1555

    If your process is really a cursor with a single insert inside the loop, you should run a single statement:

    BEGIN
       INSERT INTO tableb (col1..coln) (SELECT col1..coln FROM database.mytable);
    END;
    

    If you still need extra performance, you could look into direct insert and parallel operation but It might be over-optimization with “only” 300k rows.

    By far the single greatest optimization available to you is to think in term of sets instead of the traditional procedural approach that consists of batches of single row statements.

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

Sidebar

Related Questions

I need a script that inserts a number at some point into a file
I need to write some code to insert around 3 million rows of data.
Need some help to solve this. I have a gridview and inside the gridview
Need some help with this problem in implementing with XSLT, I had already implemented
Need some help gathering thoughts on this issue. Our team is moving ahead with
I have a website that does inserts into this table below. I need to
I need to tweak UiTextField behavior so that I can programmatically insert some asterisks
I need some help understanding how Python and postgres handle transactions and bulk inserts
I need to write a sproc which performs some INSERTs on a table, and
I need some help to insert comma separates strings into multiple columns into db.

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.