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.
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?
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.