PHP高级工程师|全栈工程师|WX: Aben_Ring

myql 配置项

提高数据插入速度方法

bulk_insert_buffer_size  

默认:8M (8*1024*1024)

参考网址:https://stackoverflow.com/questions/20301010/how-to-set-bulk-insert-buffer-size-in-mysql

mysql> show variables like '%bulk%';
+-------------------------+-----------+
| Variable_name           | Value     |
+-------------------------+-----------+
| bulk_insert_buffer_size | 268435456 | <= initial value
+-------------------------+-----------+
1 row in set (0.00 sec)

mysql> set global bulk_insert_buffer_size = 1024 * 1024 * 1;
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like '%bulk%';
+-------------------------+-----------+
| Variable_name           | Value     |
+-------------------------+-----------+
| bulk_insert_buffer_size | 268435456 | <= not changed with GLOBAL
+-------------------------+-----------+
1 row in set (0.00 sec)

mysql> set session bulk_insert_buffer_size = 1024 * 1024 * 1;
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like '%bulk%';
+-------------------------+---------+
| Variable_name           | Value   |
+-------------------------+---------+
| bulk_insert_buffer_size | 1048576 |  <= changed with SESSION
+-------------------------+---------+
1 row in set (0.00 sec)

  

posted @ 2017-12-08 15:22  懒牛拉车  阅读(210)  评论(0编辑  收藏  举报