Thursday, March 27, 2008

Variable's Day Out #1: delay_key_write

After seeing some very good "of-the-day" series, I thought why should MySQL variables be left behind. So, my contribution in the race - "variable's day out". I won't brand it "of-the-day" series as it calls for too much of dedication and given my track record I shouldn't promise that. Henceforth, instead of calling a variable lucky enough for a day, lets call a day lucky enough for a variable. Though I will try my best to keep the lucky days rolling.

Today's variable is delay_key_write. Properties:

Engines MyISAM
Server Startup Option --delay-key-writes[=<OFF|ON|ALL>]
Scope Global
Dynamic Yes
Possible Values enum('ON', 'OFF', 'ALL')
Default Value ON
Category Performance

Description:

For MyISAM tables, delayed key writes doesn't allow key buffers to be flushed between writes.

Values:

OFF Disables delayed key writing.
ON Enables for the tables created with DELAYED_KEY_WRITE option.
ALL Enables delayed key writing for all MyISAM tables.

Pros:

Enabling delayed key writing is good for heavy load tables (read or write heavy) as it decreases disk access.

Cons:

If the server goes down, the indexes have to be rebuilt.

Read more:

MySQL manual entry on delay_key_write

Hope this post was helpful to you. Keep posting your comments.

No comments: