Mysql – Changing tables from MyISAM to InnoDB make the system slow

innodbmyisamMySQL

Hi I am using Mysql 5.0.x

I have just changed a lot of the tables from MyISAM to InnoDB

With the MyISAM tables it took about 1 minute to install our database
With the InnoDB it takes about 15 minute to install the same database

Why does the InnoDB take so long?

What can I do to speed things up?

The Database install does the following steps

1) Drops the schema

2) Create the schema

3) Create tables

4) Create stored procedures

5) Insert default data

6) Insert data via stored procedure

EDIT:

The Inserting of default data takes most of the time

Best Answer

Modify the Insert Data step to start a transaction at the start and to commit it at the end. You will get an improvement, I guarantee it. (If you have a lot of data, you might want to break the transaction up to per table.)

If you application does not use transactions at all, then you should set the paramater innodb_flush_log_at_trx_commit to 2. This will give you a lot of performance back because you will almost certainly have auto_commit enabled and this generates a lot more transactions than InnoDB's default parameters are configured for. This setting stops it unnecessarily flushing the disk buffers on every commit.