MYSQLinsert速度过慢最近在用MySQL做存储,测试中发现插入数据太慢了,插入速度只有20
MY SQL insert 速度过慢
最近在用MySQL做存储,测试中发现插入数据太慢了,插入速度只有20-30 条/秒,后来查资料后,将MySQL的1个参数:innodb_flush_log_at_trx_commit,1改为了0(修改方法,可以直接修改my.ini(windows)/my.cnf(linux)中的对应参数,似乎用命令直接设置没有效果),插入速度就提升到了3000+每S,MySQL的文档中,对这个参数的描述如下:
If the value of innodb_flush_log_at_trx_commit is 0, the log buffer is written out to the log file once per second and the flush to disk operation is performed on the log file, but nothing is done at a transaction commit. When the value is 1 (the default), the log buffer is written out to the log file at each transaction commit and the flush to disk operation is performed on the log file. When the value is 2, the log buffer is written out to the file at each commit, but the flush to disk operation is not performed on it. However, the flushing on the log file tak