From: zdennis Date: 2006-11-24T13:05:41+09:00 Subject: Re: Inserting multiple rows from array -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Joey wrote: > contact_ids.map { |num| > AssignedJob.create({:job_id => job.id, :contact_id => num}) > } ActiveRecord::Extensions (for MySQL) handles bulk inserts using multi-value insert statements. It goes up to 40x faster then current ActiveRecord behavior. API looks like: MyModel.import( columns, array_of_value_sets, options_hash ) Documentation on it can be found here: http://www.continuousthinking.com/are/import Here are some MySQL benchmarks for current ActiveRecord#create vs. ActiveRecord::Extensions#import comparing MyISAM to InnoDb to Memory tables: http://www.continuousthinking.com/are/import-benchmarks-for-mysql You can download the latest version from: http://rubyforge.org/projects/arext/ What db adapter do you use? I am currently adding PostgreSQL support over this holiday weekend. Zach -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFZnBtMyx0fW1d8G0RAkmxAJ403MJLT6jPjjuawRNBNDVH+y9JNgCfVb+j cj0Kxm8B6zkLGZgIOOreMIw= =kdbQ -----END PGP SIGNATURE-----