小程序原生组件—提升你的小程序体验
298
2023-12-26
innodb_flush_log_at_trx_commit参数性能测试是怎样的,相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。
mysql> create table test_load(a int,b char(80)) engine=innodb;
Query OK, 0 rows affected (0.19 sec)
mysql> delimiter //
mysql> create procedure p_load(count int unsigned)
-> begin
-> declare s int unsigned default 1;
-> declare c char(80) default repeat(a,80);
-> while s <= count do
-> insert into test_load select null,c;
-> commit;
-> set s = s + 1;
-> end while;
-> end;
-> //
mysql> delimiter ;
mysql> call p_load(50000);
Query OK, 0 rows affected (3.02 sec)
mysql> show variables like %flush_log%;
+--------------------------------+-------+
| Variable_name | Value |
+--------------------------------+-------+
| innodb_flush_log_at_timeout | 1 |
| innodb_flush_log_at_trx_commit | 0 |
+--------------------------------+-------+
mysql> call p_load(500000);
Query OK, 0 rows affected, 3 warnings (28.43 sec)
mysql> select * from test_load limit 5;
+------+----------------------------------------------------------------------------------+
| a | b |
+------+----------------------------------------------------------------------------------+
| NULL | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
| NULL | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
| NULL | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
| NULL | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
| NULL | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
+------+----------------------------------------------------------------------------------+
5 rows in set (0.12 sec)
mysql> set global innodb_flush_log_at_trx_commit=1;
Query OK, 0 rows affected (0.00 sec)
mysql> call p_load(500000);
Query OK, 0 rows affected (27.54 sec)
mysql> show variables like %flush_log%;
+--------------------------------+-------+
| Variable_name | Value |
+--------------------------------+-------+
| innodb_flush_log_at_timeout | 1 |
| innodb_flush_log_at_trx_commit | 1 |
+--------------------------------+-------+
2 rows in set (0.09 sec)
mysql> truncate table test_load;
Query OK, 0 rows affected (0.23 sec)
mysql> call p_load(500000);
Query OK, 0 rows affected (24.63 sec)
mysql> set global innodb_flush_log_at_trx_commit=2;
Query OK, 0 rows affected (0.30 sec)
mysql> truncate table test_load;
Query OK, 0 rows affected (1.06 sec)
mysql> call p_load(500000);
Query OK, 0 rows affected (27.69 sec)
看完上述内容,你们掌握innodb_flush_log_at_trx_commit参数性能测试是怎样的的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注行业资讯频道,感谢各位的阅读!
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~