MySQL parameter DELAY_KEY_WRITEThe related knowledge is what we will introduce in this article. 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, record the index changes in the memory. In this way, the MyISAM table can make index updates faster. When the table is closed, the index is updated to the disk.
Usage:When creating table, specify DELAY_KEY_WRITE.
When the TABLE already exists: alter table table_name DELAY_KEY_WRITE = 1.
Applicability: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. When we need to update a large table frequently, we can consider using this parameter.
Note:When will table shutdown occur? You can understand that when the flash table is used, the table will be closed. In either case, flush table will occur:
When the cache is full and a new thread tries to open a table, the table is not in the cache;
When the number of tables in the cache is more than that in table_cache, thread does not use the table;
In both cases, the table is flushed.
Of course, you can also set the start parameter flush_time to set the flush table time.
Note that: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. (However, even in this case, use DELAY_KEY_WRITE to ensure that data is not lost, because the keyword information can always be generated from the data row ). If you use this feature, you apply the -- myisam-recover option to start the server and add automatic checks for all MyISAM tables.
Here is an introduction to MySQL parameter DELAY_KEY_WRITE. I hope this introduction will be helpful to you!