Skip to content

Instantly share code, notes, and snippets.

@t11a
Created January 26, 2013 04:43
Show Gist options
  • Save t11a/4640254 to your computer and use it in GitHub Desktop.
Save t11a/4640254 to your computer and use it in GitHub Desktop.
timestamp = ActiveRecord::Base.connection.quote(Time.now.utc)
inserts = []
10**4.times do |i|
inserts << "('title#{i}', #{i}, #{i}, #{timestamp}, #{timestamp})"
end
sql = "INSERT INTO books (title, serial, price, created_at, updated_at) VALUES #{ inserts.join(',') }"
Book.connection.execute(sql)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment