Understanding of MySQL database DELAY_KEY_WRITE, delaykeywrite

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.