innodb_flush_log_at_trx_commit参数性能测试是怎样的

发布时间:2021-11-16 14:10:26 作者:柒染
来源:亿速云 阅读:137

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参数性能测试是怎样的的方法了吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注亿速云行业资讯频道,感谢各位的阅读!

推荐阅读:
  1. innodb_flush_log_at_trx_commit配置
  2. Jmeter性能测试-----参数化方法CSVRead函数

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

innodb

上一篇:如何理解基于keepalived的MySQL主主复制

下一篇:如何进行postgre安装

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》