Understanding of MySQL database DELAY_KEY_WRITE, delaykeywrite
MySQL database parameter DELAY_KEY_WRITE:
DELAY_KEY_WRITE refers to the update operation of the table to the disk without updating the index to the disk before the table is closed, and the changes to the index are recorded in the memory. (The function of this option is to temporarily stop MySQL from refreshing the index immediately after each new record is inserted and each new record is modified, refresh the index until all records are inserted/modified)
In this way, the MyISAM table can make index updates faster. When the table is closed, the index is updated to the disk.
Usage:1: Specify DELAY_KEY_WRITE when creating table.
2: When the TABLE already exists: alter table table_name DELAY_KEY_WRITE = 1.
Scenario:The table has an update operation, and the advantages of this parameter will be well reflected. Because this parameter can delay updating the index to the table. You can use this parameter when updating a large table.
TIPS:When DELAY_KEY_WRITE is used, if a restart or power loss occurs, the index update in the cache cannot be updated. Therefore, you must add -- myisam-recover to the startup parameter, in this way, when you start mysql, you will check your table and synchronize the table and index. or run myisamchk before restarting the server. With this feature, the app -- myisam-recover option is used to start the server and add automatic checks for all MyISAM tables.