[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Structured system variables are supported beginning with MySQL 4.1.1. A structured variable differs from a regular system variable in two respects:
Currently, MySQL supports one structured variable type. It specifies parameters that govern the operation of key caches. A key cache structured variable has these components:
key_buffer_size
key_cache_block_size
key_cache_division_limit
key_cache_age_threshold
The purpose of this section is to describe the syntax for referring to structured variables. Key cache variables are used for syntax examples, but specific details about how key caches operate are found elsewhere, in 7.4.6 The MyISAM Key Cache.
To refer to a component of a structured variable instance, you can use a
compound name in instance_name.component_name
format. Examples:
hot_cache.key_buffer_size hot_cache.key_cache_block_size. cold_cache.key_cache_block_size. |
An instance with the name of default
is always predefined for each
structured system variable. If you refer to a component of a structured
variable without any instance name, the default
instance is used.
Thus, default.key_buffer_size
and key_buffer_size
both refer
to the same system variable.
The naming rules for structured variable instances and components are as follows:
default
,
so default
is not unique across variable types.
At the moment, these rules have no possibility of being violated, because the only structured variable type is the one for key caches. If some other type of structured variable is created in the future, these rules will assume greater significance.
With one exception, it is allowable to refer to structured variable components using compound names in any context where simple variable names can occur.
For example, you can assign a value to a structured variable using a command line option:
shell> mysqld --hot_cache.key_buffer_size=64K |
In an option file, do this:
[mysqld] hot_cache.key_buffer_size=64K |
If you start the server with such an option, it creates a key cache
named hot_cache
with a size of 64 KB in addition to the default
key cache that has a default size of 8 MB.
Suppose you start the server as follows:
shell> mysqld --key_buffer_size=256K \ --extra_cache.key_buffer_size=128K \ --extra_cache.key_cache_block_size=2096 |
In this case, the server sets the size of the default key cache to 256 KB.
(You could also have written --default.key_buffer_size=256
.)
In addition, the server creates a second key cache named extra_cache
that has a size of 128 KB, with the size of block buffers for caching
table index blocks set to 2096 bytes.
The following example starts the server with three different key caches having sizes in a 3:1:1 ratio:
shell> mysqld --key_buffer_size=6M \ --hot_cache.key_buffer_size=2M \ --cold_cache.key_buffer_size=2M |
Structured variable values may be set and retrieved at runtime as well.
For example, to set a key cache named hot_cache
to a size of 10 MB,
use either of these statements:
mysql> SET GLOBAL hot_cache.key_buffer_size = 10*1024*1024; mysql> SET @global.hot_cache.key_buffer_size = 10*1024*1024; |
To retrieve the cache size, do this:
mysql> SELECT @global.hot_cache.key_buffer_size; |
However, the following statement does not work, because the variable is not
interpreted as a compound name, but as a simple string for a LIKE
pattern-matching operation:
mysql> SHOW GLOBAL VARIABLES LIKE 'hot_cache.key_buffer_size'; |
This is the exception to being able to use structured variable names anywhere a simple variable name may occur.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |