简体   繁体   English

Mysql:插入性能INNODB vs MYISAM

[英]Mysql: Insert performance INNODB vs MYISAM

I am inserting into a simple small table with 5 attributes and 1000 rows. 我插入一个简单的小表,有5个属性和1000行。

I observed when the engine is INNODB, each insert is taking 0.03 - 0.05 seconds. 我观察发动机是INNODB时,每次插入需要0.03 - 0.05秒。 I changed the engine to MYISAM, then the inserts are faster. 我将引擎更改为MYISAM,然后插入更快。 it is taking 0.001 - 0.003. 它需要0.001 - 0.003。

What is the problem. 问题是什么。 innodb_flush_log_trx_commit = 1 by default. innodb_flush_log_trx_commit = 1默认情况下。 I was this setting as it is. 我就是这样的设置。 Here are my innodb setting. 这是我的innodb设置。

innodb_log_buffer_size : 1MB
innodb_log_file_size   : 5MB
innodb_buffer_pool_size: 8MB
innodb_flush_log_trx_commit = 1

I could not able to figure out what went wrong with this. 我无法弄清楚这有什么问题。 Thanks in advance. 提前致谢。 Regards, UDAY 问候,UDAY

innodb_flush_log_at_trx_commit = 1 means that each transaction is written to log buffer. innodb_flush_log_at_trx_commit = 1表示每个事务都写入日志缓冲区。

Set it to 0 to get better performance, or even better try doing all inserts within one transaction (don't forget commiting in the end). 将其设置为0以获得更好的性能,甚至更好地尝试在一个事务中执行所有插入(不要忘记最后提交)。

You can look at http://dev.mysql.com/doc/refman/4.1/en/innodb-parameters.html for more details on innodb_flush_log_at_trx_commit and other variables 有关innodb_flush_log_at_trx_commit和其他变量的更多详细信息,请查看http://dev.mysql.com/doc/refman/4.1/en/innodb-parameters.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM