开发者

Mysql CREATE statment are really slow (Mac OS X / Macport install)

开发者 https://www.devze.com 2023-02-03 19:23 出处:网络
I recently noticed that recreating the database for the web application I am working on is taking a lot of time. I had just reinstalled Mysql from Macport...

I recently noticed that recreating the database for the web application I am working on is taking a lot of time. I had just reinstalled Mysql from Macport...

I am getting really lousy performances, for example :

0.293437004089 seconds for

CREATE TABLE blockip ( 
id INT(11) NOT NULL AUTO_INCREMENT, 
ip VARCHAR(15) NOT NULL DEFAULT '', 
username VARCHAR(80) NOT NULL DEFAULT '', 
time INT(10) NOT NULL DEFAULT '0', PRIMARY KEY (id) ) 
DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci TYPE=MyISAM;

On another machine, nearby I get 0.0016529560089111 seconds for the same query.

The trouble see开发者_Python百科ms to be somewhat related to the disk : disk usage goes really high when I start creating the 70 tables in my database.

Any ideas where to start for a clue ?


I saw this myself and found the issue is to do with a file function that is available on OS X but not other operating systems that MySQL chooses to use as it is safer. Check out the last 3 comments on this bug report: http://bugs.mysql.com/bug.php?id=56550.

It details adding a directive to your my.cnf file that will disable using the different function and dramatically speeds up all file based actions in MySQL on OS X. So, you can fix this quickly by adding the following to your my.cnf file in the [mysqld] block. It’s probably best not to do this in production, but who actually uses OS X as a production web server anyway?

skip-sync-frm=OFF

I saw my unit test schema creation come down from 16 seconds to 5 making it a clear winner for me.

0

精彩评论

暂无评论...
验证码 换一张
取 消