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

The Archive Base Latest Questions

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

Scenario: I load some data into a local MySQL database each day, about 2

  • 0

Scenario:

  • I load some data into a local MySQL database each day, about 2 million rows;
  • I have to (have to – it’s an audit/regulatory thing) move to a ‘properly’ administered server, which currently looks to be Oracle 10g;
  • The server is in a different country: a network round-trip current takes 60-70 ms;
  • Input is a CSV file in a denormalised form: I normalise the data before loading, each line typically results in 3-8 INSERTs across up to 4 tables;
  • The load script is currently implemented in Ruby, using ActiveRecord and fastercsv. I’ve tried the ar-extensions gem, but it assumes that the MySQL style multiple values clause idea will work. It doesn’t.

EDIT: Extremely useful answers already – thank-you! More about that pesky input file. The number of fields is variable and positions have changed a few times – my current script determines content by analysing the header row (well, fastercsv and a cunning converter do it). So a straight upload and post-process SQL wouldn’t work without several versions of the load file, which is horrible. Also it’s a German CSV file: semi-colon delimited (no big deal) and decimals indicated by commas (rather bigger deal unless we load as VARCHAR and text-process afterwards – ugh).

The problem:

Loading 2 million rows at about 7/sec is going to take rather more than 24 hours! That’s likely to be a drawback with a daily process, not to mention that the users would rather like to be able to access the data about 5 hours after it becomes available in CSV form!

I looked at applying multiple inserts per network trip: the rather ungainly INSERT ALL... syntax would be fine, except that at present I’m applying a unique id to each row using a sequence. It transpires that

INSERT ALL     INTO tablea (id,b,c) VALUES (tablea_seq.nextval,1,2)     INTO tablea (id,b,c) VALUES (tablea_seq.nextval,3,4)     INTO tablea (id,b,c) VALUES (tablea_seq.nextval,5,6) SELECT 1 FROM dual; 

(did I say it was ungainly?) tries to use the same id for all three rows. Oracle docus appear to confirm this.

Latest attempt is to send multiple INSERTs in one execution, e.g.:

    INSERT INTO tablea (id,b,c) VALUES (tablea_seq.nextval,1,2);     INSERT INTO tablea (id,b,c) VALUES (tablea_seq.nextval,3,4);     INSERT INTO tablea (id,b,c) VALUES (tablea_seq.nextval,5,6); 

I haven’t found a way to persuade Oracle to accept that.

The Question(s)

  • Have I missed something obvious? (I’d be so pleased if that turned out to be the case!)
  • If I can’t send multiple inserts, what else could I try?

Why Accept That One?

For whatever reason, I prefer to keep my code as free from platform-specific constructs as possible: one reason this problem arose is that I’m migrating from MySQL to Oracle; it’s possible another move could occur one day for geographical reasons, and I can’t be certain about the platform. So getting my database library to the point where it can use a text SQL command to achieve reasonable scaling was attractive, and the PL/SQL block accomplishes that. Now if another platform does appear, the change will be limited to changing the adapter in code: a one-liner, in all probability.

  • 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. 2026-05-11T05:19:59+00:00Added an answer on May 11, 2026 at 5:19 am

    You could use:

    insert into tablea (id,b,c)  ( select tablea_seq.nextval,1,2 from dual union all    select tablea_seq.nextval,3,4 from dual union all    select tablea_seq.nextval,3,4 from dual union all    select tablea_seq.nextval,3,4 from dual union all    ...  ) 

    This works until about up to 1024 lines when I remember correctly.

    You could also send it as a PL/SQL batch instruction:

    BEGIN  INSERT INTO tablea (id,b,c) VALUES (tablea_seq.nextval,1,2);  INSERT INTO tablea (id,b,c) VALUES (tablea_seq.nextval,3,4);  INSERT INTO tablea (id,b,c) VALUES (tablea_seq.nextval,5,6);  ...  COMMIT; END 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can use the constructor on a PrincipalContext that takes… May 11, 2026 at 8:05 pm
  • Editorial Team
    Editorial Team added an answer You can deffinetly manage the logged users inside the server.… May 11, 2026 at 8:05 pm
  • Editorial Team
    Editorial Team added an answer There is no technical reason. My company does this now… May 11, 2026 at 8:05 pm

Related Questions

I am working on a simple notification service that will be used to deliver
I'm struggling to create a generic (or untyped) array in C (I'm aware that
I have a scenario. (Windows Forms, C#, .NET) There is a main form which
Is it possible to programmatically start an application from Java and then send commands

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.