engine comparison
1.MyISAM: keep indexes in memory only
2.InnoDB: keep indexes and data in memory
ALTER TABLE table_name ENGINE=InnoDB;
Optimization suggestions
InnoDB uses as much memory as possible
After ensuring that the operating system has enough memory to function properly without using the swap partition, allocate as much physical memory as possible to MySQL.
For linux, set:
vm.swappiness = 0
To inform the system that the swap partition should not be used when there is sufficient memory.
my.cnf
innodb_buffer_pool_size -- 服务器物理内存的 80%
innodb_buffer_pool_instances -- 缓冲池个数,每个至少1G