您好,登錄后才能下訂單哦!
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參數性能測試是怎樣的的方法了嗎?如果還想學到更多技能或想了解更多相關內容,歡迎關注億速云行業資訊頻道,感謝各位的閱讀!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。