# Mysql performance

**URL:** <https://www.ruby-forum.com/t/mysql-performance/163662>\
**Category:** Rails\
**Created:** [March 23, 2009, 6:45pm UTC](https://www.ruby-forum.com/t/mysql-performance/163662 "2009-03-23T18:45:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![marmolin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/71e660/32.png) [@marmolin](https://www.ruby-forum.com/u/marmolin)\
**Post date:** [March 23, 2009, 6:45pm UTC](https://www.ruby-forum.com/t/mysql-performance/163662/1 "2009-03-23T18:45:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![marmolin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/71e660/32.png) [@marmolin](https://www.ruby-forum.com/u/marmolin)\
**Post date:** [March 23, 2009, 7:06pm UTC](https://www.ruby-forum.com/t/mysql-performance/163662/2 "2009-03-23T19:06:51Z")

</div>

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.

Fred
