重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
innodb_flush_log_at_trx_commit参数性能测试是怎样的,相信很多没有经验的人对此束手无策,为此本文总结了问题出现的原因和解决方法,通过这篇文章希望你能解决这个问题。
10年积累的成都网站制作、成都网站设计经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先网站设计后付款的网站建设流程,更有通榆免费网站建设让你可以放心的选择与我们合作。
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参数性能测试是怎样的的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注创新互联行业资讯频道,感谢各位的阅读!