当前位置:网站首页>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;边栏推荐
- Reflect the technical depth (unable to speed up)
- ES6:Map
- Tips for using nexys A7 development board resources
- 8、【STM32】定时器(TIM)——中断、PWM、输入捕获实验(一文精通定时器)
- Zoomeeper sets ACL permission control (only specific IP access is allowed to enhance security)
- Electron official docs series: Development
- Applicable and inapplicable scenarios of mongodb series
- Electron official docs series: Processes in Electron
- Ring queue PHP
- Common faults of MySQL database - forgetting database password
猜你喜欢

Stack, LIFO

Beifu PLC model selection -- how to see whether the motor is a multi turn absolute value encoder or a single turn absolute value encoder

Input text to automatically generate images. It's fun!

Log in to the server using SSH key pair

Composite mode

古瑞瓦特冲刺港交所上市:创下“多个第一”,获IDG资本9亿元投资

There are many contents in the widget, so it is a good scheme to support scrolling

Here Document免交互及Expect自动化交互

MediaPipe手势(Hands)

Update and download of Beifu EtherCAT XML description file
随机推荐
MySQL数据库讲解(四)
Generate JDE dot train
I met the problem of concurrent programming in an interview: how to safely interrupt a running thread
Beifu PLC realizes zero point power-off hold of absolute value encoder -- use of bias
I have a good word to say, and I admire myself
There are many contents in the widget, so it is a good scheme to support scrolling
防火墙介绍
VTK 圆柱体的生成与渲染
[MySQL from introduction to mastery] [advanced part] (II) representation of MySQL directory structure and tables in the file system
Composite mode
2. Introduction to parallel interface, protocol and related chips (8080, 8060)
Detailed sorting of HW blue team traceability process
Network remote access using raspberry pie
计算两点之间的距离(二维、三维)
古瑞瓦特冲刺港交所上市:创下“多个第一”,获IDG资本9亿元投资
POJ 3070 Fibonacci
Adapter mode
5+api, clear application cache
Design of simple digital circuit traffic light
Beifu PLC obtains system time, local time, current time zone and system time zone conversion through program