Mysql database insertion speed and read speed adjustment, mysql database
Reading and inserting updates of millions of data in mysql is normal, but the speed will be slow after tens of millions. How to adjust the configuration to improve efficiency. As follows:
1. Try to write data to DataFile at a time and reduce the checkpoint operation of the database. Adjust the following parameters:
(1) set innodb_flush_log_at_trx_commit to 0, and set it to 0 based on past experience, which greatly improves the insertion speed.
(2) Adjust the innodb_autoextend_increment configuration from 8 MB to 128 MB by default.
(3) Adjust the Innodb_log_buffer_size configuration from 1 MB to 16 MB by default. Increase the log cache to reduce the number of write data files.
(4) Adjust the innodb_log_file_size configuration from 8 MB to 128 MB by default. Set the undo log size to reduce the database checkpoint operation.
After the above adjustments, the system insertion speed will be greatly improved. Note: The above parameter adjustments are also adjusted based on different machine configurations.
2. Improve the reading speed of the database and improve the reading speed at the database level mainly from the following aspects: simplifying SQL statements, adding indexes, and adding extra points.