Close
Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

PIVOTAL LABS
Standup 1/11/2011: 10,000

Ask for Help

“Does Active Record have batched insert? I need to dump 10,000 rows into the database in process and I don’t want it to take 45 seconds.”

The upshot: use a raw SQL INSERT statement.

Interesting Things

For a day as interesting as today (1/11/11 anyone?) there were surprisingly few interesting things of note.

Comments
  1. pete says:

    Creating many records is exactly what the activerecord-import gem was made for.

  2. When we do big inserts, we often use this handy utility module: https://gist.github.com/7681

    It provides a decent interface to MySQL’s INSERT ON DUPLICATE KEY UPDATE functionality which is really nice for avoiding the race conditions / rescue / retry you sometimes run into with plain old validates_uniqueness_of

Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *