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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:15:37+00:00 2026-06-09T13:15:37+00:00

I have a problem (due to time) when inserting around 13,000 records into the

  • 0

I have a problem (due to time) when inserting around 13,000 records into the devices database.

Is there any way to optimize this? Is it possible to put these all into one transaction (as I believe that it is currently creating one transaction per insert (which apparently has a diabolical effect on speed)).

Currently this takes around 10 minutes, this includes converting CSV to a hash (this doesn’t seem to be the bottleneck).

Stupidly I am not using RhoSync…

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-06-09T13:15:38+00:00Added an answer on June 9, 2026 at 1:15 pm

    Set up a transaction around the inserts and then only commit at the end.

    From their FAQ.

    http://docs.rhomobile.com/faq#how-can-i-seed-a-large-amount-of-data-into-my-application-with-rhom

    db = ::Rho::RHO.get_src_db('Model')
    db.start_transaction
    begin
      items.each do |item|
        # create hash of attribute/value pairs
        data = {
          :field1 => item['value1'], 
          :field2 => item['value2'] 
        } 
        # Creates a new Model object and saves it
        new_item = Model.create(data)
      end
     db.commit
    rescue
     db.rollback
    end
    

    I’ve found this technique to be a tremendous speed up.

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

Sidebar

Related Questions

I have a ridiculous question due to a ridiculous problem. Normally if I want
I have been having the following problem, i think it's probably due to the
I currently have the DatePicker in my project but there are problems due to
I have problem while loading data into html select when users press or click
I have a huge database that is meant to be indexed, into which I
I have a problem where Device.Dispose() is taking a long time to execute when
I have this problem all the time in my rails apps and I still
I have a problem where, due to previous people's poor design decisions, I'm forced
I have a slightly outdated experimental branch, that was pushed aside due to time
I have problem with http://abfoodpolicy.com/ . In IE 8 and 9 the right sidebar

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.