当前位置:网站首页>mysql配置提高数据插入效率
mysql配置提高数据插入效率
2022-06-26 12:53:00 【怪只怪满眼尽是人间烟火】
innodb_buffer_pool_size
innodb_buffer_pool_size 默认值为32M,可以设置成128M。
该参数表示mysql 的Innodb存储引擎为优化查询性能而开辟出的一块内存缓冲区
show global VARIABLES like 'innodb_buffer_pool_size'
set global innodb_buffer_pool_size=1024*1024*128;innodb_flush_log_at_trx_commit
innodb_flush_log_at_trx_commit 默认值为1;设置为0,可以提高写入速度。
值为0:提升写入速度,但是安全方面较差,mysql服务器宕机可能会造成数据丢失。
值为1:每一次事务提交或者事务外的指令都需要把日志写入硬盘,此过程消耗时间较长;
show global variables like '%innodb_flush_log_at_trx_commit%'
set global innodb_flush_log_at_trx_commit=0;innodb_autoextend_increment
innodb_autoextend_increment 默认值是8M,可以设置成128M
此配置项作用主要是当tablespace 空间已经满了后,需要MySQL系统需要自动扩展多少空间,每次tablespace 扩展都会让各个SQL 处于等待状态。增加自动扩展Size可以减少tablespace自动扩展次数。
show global variables like '%innodb_autoextend_increment%'
set global innodb_autoextend_increment = 128;innodb_log_buffer_size
innodb_log_buffer_size默认值是1M,可以设置成64M
此配置项作用设定innodb 数据库引擎写日志缓存区;将此缓存段增大可以减少数据库写数据文件次数。
show global variables like '%innodb_log_buffer_size%'
set global innodb_log_buffer_size = 1024*1024*64;innodb_log_file_size
innodb_log_file_size 默认值是48M,可以设置成128M
show global variables like '%innodb_log_file_size%'
set global innodb_log_file_size = 1024*1024*128;innodb_write_io_threads & innodb_read_io_threads
innodb_write_io_threads & innodb_read_io_threads 默认值4,允许值的范围是1~64,建议根据服务器核心数进行修改,8核就设置成8。
show global variables like '%innodb_write_io_threads%'
set global innodb_write_io_threads = 8;
show global variables like '%innodb_read_io_threads%'
set global innodb_read_io_threads = 8;innodb_io_capacity & innodb_io_capacity_max
innodb_io_capacity & innodb_io_capacity_max 默认是200,2000,可以调整成2000,10000。
show global variables like 'innodb_io_capacity%'
set global innodb_io_capacity = 2000;
set global innodb_io_capacity_max = 10000;边栏推荐
- [shell] generate strings between specified dates
- Basic methods for network diagnosis and hardware troubleshooting of Beifu EtherCAT module
- Bifu divides EtherCAT module into multiple synchronization units for operation -- use of sync units
- Electron official docs series: Development
- Create your own cross domain proxy server
- Bigint: handles large numbers (integers of any length)
- 7-3 minimum toll
- Uva11582 [fast power]colossal Fibonacci numbers!
- Mysql database explanation (III)
- Uva5009 error curves three points
猜你喜欢

MySQL explanation (I)
![[how to connect the network] Chapter 2 (Part 1): establish a connection, transmit data, and disconnect](/img/e3/a666ba2f48e8edcc7db80503a6156d.png)
[how to connect the network] Chapter 2 (Part 1): establish a connection, transmit data, and disconnect

ES6 module

Composite mode

基于PyTorch的生成对抗网络实战(7)——利用Pytorch搭建SGAN(Semi-Supervised GAN)生成手写数字并分类

Es6: iterator

Basic configuration and test of Beifu twincat3 NCI in NC axis interface

HW蓝队溯源流程详细整理

ES6:Map

Es sauvegarde et restauration des données par instantané
随机推荐
code force Party Lemonade
Common faults of MySQL database - forgetting database password
SQL assigns the field value of data table B to a column in data table a
33. Use rgbd camera for target detection and depth information output
Arcpy——InsertLayer()函数的使用:掺入图层到地图文档里
MySQL数据库讲解(三)
Create your own cross domain proxy server
Bigint: handles large numbers (integers of any length)
Decorator
古瑞瓦特冲刺港交所上市:创下“多个第一”,获IDG资本9亿元投资
[how to connect the network] Chapter 2 (Part 1): establish a connection, transmit data, and disconnect
Custom encapsulation drop-down component
Bifu divides EtherCAT module into multiple synchronization units for operation -- use of sync units
偶言佳句,孤芳自赏
Es sauvegarde et restauration des données par instantané
基于PyTorch的生成对抗网络实战(7)——利用Pytorch搭建SGAN(Semi-Supervised GAN)生成手写数字并分类
Adapter mode
输入文本自动生成图像,太好玩了!
There are many contents in the widget, so it is a good scheme to support scrolling
微信小程序注册指引