MySQL Variables delay_key_write 数据库 参数变量解释及正确配置使用

本站中文解释

delay_key_write 参数表示用于指定在更新索引的时候是否延迟写入索引,默认选项是OFF,当有更新索引的数据变动时就立即将索引写入磁盘,此参数被设置为ON时会延迟索引的写入,即:在关闭服务器的时候才会将更新后的索引写入磁盘。

设置该参数的方法:
1. 使用MySQL客户端连接到MySQL服务器,选择要设置参数的数据库;
2. 执行如下SQL语句以设置 delay_key_write参数为ON:
SET GLOBAL delay_key_write = ON;
3. 设置成功即可。

官方英文解释

delay_key_write

Command-Line Format --delay-key-write[={OFF|ON|ALL}]
System Variable delay_key_write
Scope Global
Dynamic Yes
Type Enumeration
Default Value ON
Valid Values

OFF

ON

ALL

This variable specifies how to use delayed key writes. It
applies only to MyISAM tables. Delayed key
writing causes key buffers not to be flushed between writes.
See also Section 15.2.1, “MyISAM Startup Options”.

This variable can have one of the following values to affect
handling of the DELAY_KEY_WRITE table
option that can be used in CREATE
TABLE
statements.

Option Description
OFF DELAY_KEY_WRITE is ignored.
ON MySQL honors any DELAY_KEY_WRITE option specified in
CREATE TABLE statements.
This is the default value.
ALL All new opened tables are treated as if they were created with the
DELAY_KEY_WRITE option enabled.

Note

If you set this variable to ALL, you
should not use MyISAM tables from within
another program (such as another MySQL server or
myisamchk) when the tables are in use.
Doing so leads to index corruption.

If DELAY_KEY_WRITE is enabled for a table,
the key buffer is not flushed for the table on every index
update, but only when the table is closed. This speeds up
writes on keys a lot, but if you use this feature, you should
add automatic checking of all MyISAM tables
by starting the server with the
myisam_recover_options system
variable set (for example,
myisam_recover_options='BACKUP,FORCE').
See Section 5.1.7, “Server System Variables”, and
Section 15.2.1, “MyISAM Startup Options”.

If you start mysqld with
--skip-new,
delay_key_write is set to
OFF.

Warning

If you enable external locking with
--external-locking, there is
no protection against index corruption for tables that use
delayed key writes.

版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:《MySQL Variables delay_key_write 数据库 参数变量解释及正确配置使用》
文章链接:https://zhuji.vsping.com/253473.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。