Forum: Ruby on Rails mysql performance

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Hans M. (Guest)
on 2009-03-23 19:45
(Received via mailing list)
Rails mysql performance

I have an application that reads an xml file, parse it and from there
updates the database. My models has many associations and there are a
lot of creation of new records  in the database. The performance is
slow and my analyses shows that  mysql is to blame.

In a separate test it took about 11 seconds to create 100 records, i.e
0.1 sec for each record.
Is that normal for the development mode?

I develop on a new mac leopard with rails 2.2.2, ruby 1.8.6 and mysql
Ver 14.12 Distrib 5.0.51a, for apple-darwin9.0.0b5 (i686) using
readline 5.0.

Any suggestions woul be appreciated
Frederick C. (Guest)
on 2009-03-23 20:06
(Received via mailing list)
On 23 Mar 2009, at 17:44, Hans wrote:

> Is that normal for the development mode?
If it's inside a single action development mode isn't going to be
slower once it's reloaded your models' code and so on.
Have you tried wrapping the insert inside a transaction ? If you don't
then mysql has to flush to disk after each insert which can slow you
down considerably.

This topic is locked and can not be replied to.