Spec-Zone .ru
спецификации, руководства, описания, API
|
This section describes the InnoDB
-related command options and system variables.
System variables that are true or false can be enabled at server startup by naming them, or disabled by using a
--skip-
prefix. For example, to enable or disable InnoDB
checksums, you can use --innodb_checksums
or --skip-innodb_checksums
on the command line, or innodb_checksums
or skip-innodb_checksums
in an
option file. System variables that take a numeric value can be specified as --
on
the command line or as var_name
=value
in option files. For more information on specifying
options and system variables, see Section 4.2.3, "Specifying
Program Options". Many of the system variables can be changed at runtime (see Section
5.1.5.2, "Dynamic System Variables"). var_name
=value
Certain options control the locations and layout of the InnoDB
data files. Section
14.2.1.2, "Configuring InnoDB
" explains how to use these options. Many other
options, that you might not use initially, help to tune InnoDB
performance
characteristics based on machine capacity and your database workload. The
performance-related options are explained in Section
14.2.4, "InnoDB
Performance Tuning and Troubleshooting" and Section
14.2.4.2, "InnoDB
Performance and Scalability Enhancements".
Table 14.5. InnoDB
Option/VariableReference
InnoDB
Command OptionsDeprecated | 5.2.22 | ||
Command-Line Format | --ignore-builtin-innodb |
||
Option-File Format | ignore-builtin-innodb |
||
System Variable Name | ignore_builtin_innodb
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | boolean |
In MySQL 5.1, this option caused the server to behave as if the built-in InnoDB
were not present, which enabled InnoDB Plugin
to be used instead. In
MySQL 5.6, InnoDB
is the default storage engine and InnoDB Plugin
is not used, so this option has no effect. As of MySQL
5.6.5, it is ignored.
Controls loading of the InnoDB
storage engine, if the server was
compiled with InnoDB
support. This option has a tristate format, with
possible values of OFF
, ON
, or FORCE
. See Section
5.1.8.1, "Installing and Uninstalling Plugins".
To disable InnoDB
, use --innodb=OFF
or --skip-innodb
. In this case, because the default storage engine is InnoDB
, the server will
not start unless you also use --default-storage-engine
and --default-tmp-storage-engine
to set the default to some other
engine for both permanent and TEMPORARY
tables.
Command-Line Format | --innodb-status-file |
||
Option-File Format | innodb-status-file |
||
Permitted Values | |||
Type | boolean |
||
Default | OFF |
Controls whether InnoDB
creates a file named innodb_status.
in the MySQL data directory. If enabled, pid
InnoDB
periodically writes the output of SHOW ENGINE INNODB STATUS
to this file.
By default, the file is not created. To create it, start mysqld with the --innodb-status-file=1
option. The file is deleted during normal shutdown.
Disable the InnoDB
storage engine. See the description of --innodb
.
InnoDB
System Variables
daemon_memcached_enable_binlog
Introduced | 5.6.6 | ||
Command-Line Format | --daemon_memcached_enable_binlog=# |
||
Option-File Format | daemon_memcached_enable_binlog |
||
System Variable Name | daemon_memcached_enable_binlog
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | boolean |
||
Default | false |
See Section 14.2.9, "InnoDB Integration with memcached" for usage details for this option.
daemon_memcached_engine_lib_name
Introduced | 5.6.6 | ||
Command-Line Format | --daemon_memcached_engine_lib_name=library |
||
Option-File Format | daemon_memcached_engine_lib_name |
||
System Variable Name | daemon_memcached_engine_lib_name
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | string |
||
Default | innodb_engine.so |
Specifies the shared library that implements the InnoDB
memcached plugin.
See Section 14.2.9, "InnoDB Integration with memcached" for usage details for this option.
daemon_memcached_engine_lib_path
Introduced | 5.6.6 | ||
Command-Line Format | --daemon_memcached_engine_lib_path=directory
|
||
Option-File Format | daemon_memcached_engine_lib_path |
||
System Variable Name | daemon_memcached_engine_lib_path
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | string |
||
Default |
|
The path of the directory containing the shared library that implements the InnoDB
memcached plugin.
See Section 14.2.9, "InnoDB Integration with memcached" for usage details for this option.
Introduced | 5.6.6 | ||
Command-Line Format | --daemon_memcached_option=options |
||
Option-File Format | daemon_memcached_option |
||
System Variable Name | daemon_memcached_option
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | string |
||
Default |
|
Space-separated options that are passed to the underlying memcached daemon on startup.
See Section 14.2.9, "InnoDB Integration with memcached" for usage details for this option.
Introduced | 5.6.6 | ||
Command-Line Format | --daemon_memcached_r_batch_size=# |
||
Option-File Format | daemon_memcached_r_batch_size |
||
System Variable Name | daemon_memcached_r_batch_size
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | numeric |
||
Default | 1 |
Specifies how many memcached read operations (get
) to perform before doing a COMMIT
to start a new transaction. Counterpart of daemon_memcached_w_batch_size
.
This value is set to 1 by default, so that any changes made to the table through SQL statements are immediately visible to the memcached operations. You might increase it to reduce the overhead from frequent commits on a system where the underlying table is only being accessed through the memcached interface. If you set the value too large, the amount of undo or redo data could impose some storage overhead, as with any long-running transaction.
See Section 14.2.9, "InnoDB Integration with memcached" for usage details for this option.
Introduced | 5.6.6 | ||
Command-Line Format | --daemon_memcached_w_batch_size=# |
||
Option-File Format | daemon_memcached_w_batch_size |
||
System Variable Name | daemon_memcached_w_batch_size
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | numeric |
||
Default | 1 |
Specifies how many memcached write operations, such as
add
, set
, or incr
, to perform before doing a COMMIT
to start a new transaction. Counterpart of daemon_memcached_r_batch_size
.
This value is set to 1 by default, on the assumption that any data being stored is important to
preserve in case of an outage and should immediately be committed. When storing non-critical data,
you might increase this value to reduce the overhead from frequent commits; but then the last N
-1 uncommitted write operations could be lost in case
of a crash.
See Section 14.2.9, "InnoDB Integration with memcached" for usage details for this option.
Deprecated | 5.2.22 | ||
Command-Line Format | --ignore-builtin-innodb |
||
Option-File Format | ignore-builtin-innodb |
||
System Variable Name | ignore_builtin_innodb
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | boolean |
See the description of --ignore-builtin-innodb
under "InnoDB
Command Options" earlier in this
section.
Command-Line Format | --innodb_adaptive_flushing=# |
||
Option-File Format | innodb_adaptive_flushing |
||
System Variable Name | innodb_adaptive_flushing
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | boolean |
||
Default | ON |
Specifies whether to dynamically adjust the rate of flushing dirty pages
in the InnoDB
buffer pool based on the
workload. Adjusting the flush rate dynamically is intended to avoid bursts of I/O activity. This
setting is enabled by default. For general I/O tuning advice, see Section
8.5.7, "Optimizing InnoDB
Disk I/O".
Introduced | 5.6.6 | ||
Command-Line Format | --innodb_adaptive_flushing_lwm=# |
||
Option-File Format | innodb_adaptive_flushing_lwm |
||
System Variable Name | innodb_adaptive_flushing_lwm
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 10 |
||
Range | 0 .. 70 |
Low water mark representing percentage of redo log capacity at which adaptive flushing is enabled.
Command-Line Format | --innodb_adaptive_hash_index=# |
||
Option-File Format | innodb_adaptive_hash_index |
||
System Variable Name | innodb_adaptive_hash_index
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | boolean |
||
Default | ON |
Whether the InnoDB
adaptive hash
index is enabled or disabled. The adaptive hash index feature is useful for some workloads, and
not for others; conduct benchmarks with it both enabled and disabled, using realistic workloads. See
Section 14.2.3.12.6, "Adaptive Hash Indexes" for
details. This variable is enabled by default. Use --skip-innodb_adaptive_hash_index
at server startup to disable it.
innodb_adaptive_max_sleep_delay
Introduced | 5.6.3 | ||
Command-Line Format | --innodb_adaptive_max_sleep_delay=# |
||
Option-File Format | innodb_adaptive_max_sleep_delay |
||
System Variable Name | innodb_adaptive_max_sleep_delay
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 150000 |
||
Range | 0 .. 1000000 |
Allows InnoDB
to automatically adjust the value of innodb_thread_sleep_delay
up or down according to the current
workload. Any non-zero value enables automated, dynamic adjustment of the innodb_thread_sleep_delay
value, up to the maximum value specified in the innodb_adaptive_max_sleep_delay
option. The value represents the number of microseconds. This option can be useful in busy systems,
with greater than 16 InnoDB
threads. (In practice, it is most valuable
for MySQL systems with hundreds or thousands of simultaneous connections.)
innodb_additional_mem_pool_size
Deprecated | 5.6.3 | ||
Command-Line Format | --innodb_additional_mem_pool_size=# |
||
Option-File Format | innodb_additional_mem_pool_size |
||
System Variable Name | innodb_additional_mem_pool_size
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | numeric |
||
Default | 8388608 |
||
Range | 2097152 .. 4294967295 |
The size in bytes of a memory pool InnoDB
uses to store data
dictionary information and other internal data structures. The more tables you have in your
application, the more memory you allocate here. If InnoDB
runs out of
memory in this pool, it starts to allocate memory from the operating system and writes warning
messages to the MySQL error log. The default value is 8MB.
This variable relates to the InnoDB
internal memory allocator, which is
unused if innodb_use_sys_malloc
is enabled. As of MySQL 5.6.3, innodb_additional_mem_pool_size
is deprecated and will be removed in
a future MySQL release.
Introduced | 5.6.7 | ||
Command-Line Format | --innodb_api_bk_commit_interval=# |
||
Option-File Format | innodb_api_bk_commit_interval |
||
System Variable Name | innodb_api_bk_commit_interval
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 5 |
||
Range | 1 .. 1073741824 |
How often to auto-commit idle connections that use the InnoDB
memcached interface, in seconds. See Section
14.2.9, "InnoDB Integration with memcached" for usage details for this option.
Introduced | 5.6.6 | ||
Command-Line Format | --innodb_api_disable_rowlock=# |
||
Option-File Format | innodb_api_disable_rowlock |
||
System Variable Name | innodb_api_disable_rowlock
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | boolean |
||
Default | OFF |
See Section 14.2.9, "InnoDB Integration with memcached" for usage details for this option.
Introduced | 5.6.6 | ||
Command-Line Format | --innodb_api_enable_binlog=# |
||
Option-File Format | innodb_api_enable_binlog |
||
System Variable Name | innodb_api_enable_binlog
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | boolean |
||
Default | OFF |
Lets you use the InnoDB
memcached plugin with the MySQL binary
log. See Section 14.2.9, "InnoDB
Integration with memcached" for usage details for this option.
Introduced | 5.6.6 | ||
Command-Line Format | --innodb_api_enable_mdl=# |
||
Option-File Format | innodb_api_enable_mdl |
||
System Variable Name | innodb_api_enable_mdl
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | boolean |
||
Default | OFF |
Locks the table used by the InnoDB
memcached
plugin, so that it cannot be dropped or altered by DDL through the SQL interface.
See Section 14.2.9, "InnoDB Integration with
memcached" for usage details for this option.
Introduced | 5.6.6 | ||
Command-Line Format | --innodb_api_trx_level=# |
||
Option-File Format | innodb_api_trx_level |
||
System Variable Name | innodb_api_trx_level
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 0 |
Lets you control the transaction isolation level on queries processed by the memcached interface. See Section 14.2.9, "InnoDB Integration with memcached" for usage details for this option. The constants corresponding to the familiar names are:
0 = READ UNCOMMITTED
1 = READ COMMITTED
2 = REPEATABLE READ
3 = SERIALIZABLE
Command-Line Format | --innodb_autoextend_increment=# |
||
Option-File Format | innodb_autoextend_increment |
||
System Variable Name | innodb_autoextend_increment
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values (<= 5.6.5) | |||
Type | numeric |
||
Default | 8 |
||
Range | 1 .. 1000 |
||
Permitted Values (>= 5.6.6) | |||
Type | numeric |
||
Default | 64 |
||
Range | 1 .. 1000 |
The increment size (in MB) for extending the size of an auto-extend InnoDB
system tablespace file when it
becomes full. The default value is 64 as of MySQL 5.6.6, 8 before that. This variable does not
affect the per-table tablespace files that are created if you use innodb_file_per_table=1
. Those files are auto-extending
regardless of the value of innodb_autoextend_increment
. The initial extensions are by small
amounts, after which extensions occur in increments of 4MB.
Command-Line Format | --innodb_autoinc_lock_mode=# |
||
Option-File Format | innodb_autoinc_lock_mode |
||
System Variable Name | innodb_autoinc_lock_mode
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | numeric |
||
Default | 1 |
||
Valid Values | 0 |
||
1 |
|||
2 |
The lock mode to use for
generating auto-increment
values. The permissible values are 0, 1, or 2, for "traditional",
"consecutive", or "interleaved" lock mode, respectively. Section
5.4.4, "AUTO_INCREMENT
Handling in InnoDB
", describes the characteristics of these modes.
This variable has a default of 1 ("consecutive" lock mode).
innodb_buffer_pool_dump_at_shutdown
Introduced | 5.6.3 | ||
Command-Line Format | --innodb_buffer_pool_dump_at_shutdown=# |
||
Option-File Format | innodb_buffer_pool_dump_at_shutdown |
||
System Variable Name | innodb_buffer_pool_dump_at_shutdown
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | boolean |
||
Default | OFF |
Specifies whether to record the pages cached in the InnoDB buffer pool
when the MySQL server is shut down, to shorten the warmup process at the next
restart. Typically used in combination with innodb_buffer_pool_load_at_startup
.
Introduced | 5.6.3 | ||
Command-Line Format | --innodb_buffer_pool_dump_now=# |
||
Option-File Format | innodb_buffer_pool_dump_now |
||
System Variable Name | innodb_buffer_pool_dump_now
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | boolean |
||
Default | OFF |
Immediately records the pages cached in the InnoDB buffer pool. Typically
used in combination with innodb_buffer_pool_load_now
.
Introduced | 5.6.3 | ||
Command-Line Format | --innodb_buffer_pool_filename=file |
||
Option-File Format | innodb_buffer_pool_filename |
||
System Variable Name | innodb_buffer_pool_filename
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | string |
||
Default | ib_buffer_pool |
Specifies the file that holds the list of page numbers produced by innodb_buffer_pool_dump_at_shutdown
or innodb_buffer_pool_dump_now
.
Command-Line Format | --innodb_buffer_pool_instances=# |
||
Option-File Format | innodb_buffer_pool_instances |
||
System Variable Name | innodb_buffer_pool_instances
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values (<= 5.6.5) | |||
Type | numeric |
||
Default | 1 |
||
Range | 1 .. 64 |
||
Permitted Values (>= 5.6.6) | |||
Type | numeric |
||
Default | -1 (autosized) |
||
Range | 1 .. 64 |
The number of regions that the InnoDB
buffer
pool is divided into. For systems with buffer pools in the multi-gigabyte range, dividing the
buffer pool into separate instances can improve concurrency, by reducing contention as different
threads read and write to cached pages. Each page that is stored in or read from the buffer pool is
assigned to one of the buffer pool instances randomly, using a hashing function. Each buffer pool
manages its own free lists, flush
lists, LRUs, and all other
data structures connected to a buffer pool, and is protected by its own buffer pool mutex.
This option takes effect only when you set the innodb_buffer_pool_size
to a size of 1 gigabyte or more. The total size you specify is divided among all the buffer pools.
For best efficiency, specify a combination of innodb_buffer_pool_instances
and innodb_buffer_pool_size
so that each buffer pool instance is at
least 1 gigabyte.
Before MySQL 5.6.6, the default is 1. As of MySQL 5.6.6, the default is 8, except on 32-bit Windows
systems, where the default depends on the value of innodb_buffer_pool_size
:
If innodb_buffer_pool_size
is greater than 1.3GB, the default
for innodb_buffer_pool_instances
is innodb_buffer_pool_size
/128MB, with individual memory
allocation requests for each chunk. 1.3GB was chosen as the boundary at which there is
significant risk for 32-bit Windows to be unable to allocate the contiguous address space
needed for a single buffer pool.
Otherwise, the default is 1.
Introduced | 5.6.3 | ||
Command-Line Format | --innodb_buffer_pool_load_abort=# |
||
Option-File Format | innodb_buffer_pool_load_abort |
||
System Variable Name | innodb_buffer_pool_load_abort
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | boolean |
||
Default | OFF |
Interrupts the process of restoring InnoDB buffer pool contents triggered
by innodb_buffer_pool_load_at_startup
or innodb_buffer_pool_load_now
.
innodb_buffer_pool_load_at_startup
Introduced | 5.6.3 | ||
Command-Line Format | --innodb_buffer_pool_load_at_startup=# |
||
Option-File Format | innodb_buffer_pool_load_at_startup |
||
System Variable Name | innodb_buffer_pool_load_at_startup
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | boolean |
||
Default | OFF |
Specifies that, on MySQL server startup, the InnoDB buffer pool is
automatically warmed up by
loading the same pages it held at an earlier time. Typically used in combination with innodb_buffer_pool_dump_at_shutdown
.
Introduced | 5.6.3 | ||
Command-Line Format | --innodb_buffer_pool_load_now=# |
||
Option-File Format | innodb_buffer_pool_load_now |
||
System Variable Name | innodb_buffer_pool_load_now
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | boolean |
||
Default | OFF |
Immediately warms up the InnoDB buffer pool by loading a set of data pages, without waiting for a server restart. Can be useful to bring cache memory back to a known state during benchmarking, or to ready the MySQL server to resume its normal workload after running queries for reports or maintenance.
Command-Line Format | --innodb_buffer_pool_size=# |
||
Option-File Format | innodb_buffer_pool_size |
||
System Variable Name | innodb_buffer_pool_size
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | numeric |
||
Default | 134217728 |
||
Min Value | 5242880 |
The size in bytes of the buffer
pool, the memory area where InnoDB
caches table and index data. The
default value is 128MB. The maximum value depends on the CPU architecture; the maximum is 4294967295
(232-1) on 32-bit systems and 18446744073709551615 (264-1) on 64-bit systems.
On 32-bit systems, the CPU architecture and operating system may impose a lower practical maximum
size than the stated maximum. When the size of the buffer pool is greater than 1GB, setting innodb_buffer_pool_instances
to a value greater than 1 can
improve the scalability on a busy server.
The larger you set this value, the less disk I/O is needed to access the same data in tables more than once. On a dedicated database server, you might set this to up to 80% of the machine physical memory size. Be prepared to scale back this value if these other issues occur:
Competition for physical memory might cause paging in the operating system.
InnoDB
reserves additional memory for
buffers and control structures, so that the total allocated space is approximately 10%
greater than the specified size.
The address space must be contiguous, which can be an issue on Windows systems with DLLs that load at specific addresses.
The time to initialize the buffer pool is roughly proportional to its
size. On large installations, this initialization time might be significant. For example, on
a modern Linux x86_64 server, initialization of a 10GB buffer pool takes approximately 6
seconds. See Section 8.9.1, "The InnoDB
Buffer Pool".
Introduced | 5.6.2 | ||
Command-Line Format | --innodb_change_buffer_max_size=# |
||
Option-File Format | innodb_change_buffer_max_size |
||
System Variable Name | innodb_change_buffer_max_size
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 25 |
||
Range | 0 .. 50 |
Maximum size for the InnoDB change buffer, as a percentage of the total
size of the buffer
pool. You might increase this value for a MySQL server with heavy insert, update, and delete
activity, or decrease it for a MySQL server with unchanging data used for reporting. For general I/O
tuning advice, see Section 8.5.7, "Optimizing InnoDB
Disk I/O".
Command-Line Format | --innodb_change_buffering=# |
||
Option-File Format | innodb_change_buffering |
||
System Variable Name | innodb_change_buffering
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | enumeration |
||
Default | all |
||
Valid Values | inserts |
||
deletes |
|||
purges |
|||
changes |
|||
all |
|||
none |
Whether InnoDB
performs change
buffering, an optimization that delays write operations to secondary indexes so that the I/O
operations can be performed sequentially. The permitted values are inserts
(buffer insert operations), deletes
(buffer delete operations; strictly speaking, the writes that
mark index records for later deletion during a purge operation), changes
(buffer insert and delete-marking operations), purges
(buffer purge operations, the writes when
deleted index entries are finally garbage-collected), all
(buffer
insert, delete-marking, and purge operations) and none
(do not buffer
any operations). The default is all
. For details, see Section
14.2.4.2.13, "Controlling InnoDB Change Buffering". For general I/O tuning advice, see Section 8.5.7, "Optimizing InnoDB
Disk I/O".
Introduced | 5.6.3 | ||
Command-Line Format | --innodb_checksum_algorithm=# |
||
Option-File Format | innodb_checksum_algorithm |
||
System Variable Name | innodb_checksum_algorithm
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values (<= 5.6.5) | |||
Type | enumeration |
||
Default | innodb |
||
Valid Values | innodb |
||
crc32 |
|||
none |
|||
strict_innodb |
|||
strict_crc32 |
|||
strict_none |
|||
Permitted Values (>= 5.6.6, <= 5.6.6) | |||
Type | enumeration |
||
Default | crc32 |
||
Valid Values | innodb |
||
crc32 |
|||
none |
|||
strict_innodb |
|||
strict_crc32 |
|||
strict_none |
|||
Permitted Values (>= 5.6.7) | |||
Type | enumeration |
||
Default | innodb |
||
Valid Values | innodb |
||
crc32 |
|||
none |
|||
strict_innodb |
|||
strict_crc32 |
|||
strict_none |
Specifies how to generate and verify the checksum stored in each disk block
of each InnoDB
tablespace. Replaces the innodb_checksums
option.
The value innodb
is backward-compatible with all versions of MySQL. The
value crc32
uses an algorithm that is faster to compute the checksum
for every modified block, and to check the checksums for each disk read. The value none
writes a constant value in the checksum field rather than
computing a value based on the block data. The blocks in a tablespace can use a mix of old, new, and
no checksum values, being updated gradually as the data is modified; once any blocks in a tablespace
are modified to use the crc32
algorithm, the associated tables cannot
be read by earlier versions of MySQL.
The default value was changed from innodb
to crc32 in MySQL 5.6.6, but switched back to innodb
in 5.6.7 for improved compatibility of InnoDB
data files during a downgrade to an earlier MySQL version, and for use of MySQL
Enterprise Backup for backups.
The strict_*
forms work the same as innodb
,
crc32
, and none
, except that InnoDB
halts if it encounters a mix of checksum values in the same
tablespace. You can only use these options in a completely new instance, to set up all tablespaces
for the first time. The strict_*
settings are somewhat faster, because
they do not need to compute both new and old checksum values to accept both during disk reads.
For usage information, including a matrix of valid combinations of checksum values during read and write operations, see Section 14.2.4.2.7, "Fast CRC32 Checksum Algorithm".
Command-Line Format | --innodb_checksums |
||
Option-File Format | innodb_checksums |
||
System Variable Name | innodb_checksums
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | boolean |
||
Default | ON |
InnoDB
can use checksum validation on all
tablespace pages read from the disk to ensure extra fault tolerance against hardware faults or
corrupted data files. This validation is enabled by default. Under specialized circumstances (such
as when running benchmarks) this extra safety feature can be disabled with --skip-innodb-checksums
.
You can specify the method of calculating the checksum with innodb_checksum_algorithm
.
In MySQL 5.6.3 and higher, this option is deprecated, replaced by innodb_checksum_algorithm
. innodb_checksum_algorithm=innodb
is the same as innodb_checksums=ON
(the default). innodb_checksum_algorithm=none
is the same as innodb_checksums=OFF
.
Remove any innodb_checksums
options from your configuration files and
startup scripts, to avoid conflicts with innodb_checksum_algorithm
:
innodb_checksums=OFF
would automatically set innodb_checksum_algorithm=none
;
innodb_checksums=ON
would be ignored and overridden by any other
setting for innodb_checksum_algorithm
.
Introduced | 5.6.7 | ||
Command-Line Format | --innodb_cmp_per_index_enabled=# |
||
Option-File Format | innodb_cmp_per_index_enabled |
||
System Variable Name | innodb_cmp_per_index_enabled
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | boolean |
||
Default | OFF |
||
Valid Values | OFF |
||
ON |
Enables per-index compression-related statistics in the INFORMATION_SCHEMA.INNODB_CMP_PER_INDEX
table. Because these
statistics can be expensive to gather, only enable this option on development, test, or slave
instances during performance tuning related to InnoDB
compressed
tables.
Command-Line Format | --innodb_commit_concurrency=# |
||
Option-File Format | innodb_commit_concurrency |
||
System Variable Name | innodb_commit_concurrency
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 0 |
||
Range | 0 .. 1000 |
The number of threads that can commit at the same time. A value of 0 (the default) permits any number of transactions to commit simultaneously.
The value of innodb_commit_concurrency
cannot be changed at runtime
from zero to nonzero or vice versa. The value can be changed from one nonzero value to another.
innodb_compression_failure_threshold_pct
Introduced | 5.6.7 | ||
Command-Line Format | --innodb_compression_failure_threshold_pct=#
|
||
Option-File Format | innodb_compression_failure_threshold_pct |
||
System Variable Name | innodb_compression_failure_threshold_pct
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 5 |
||
Range | 0 .. 100 |
Sets the cutoff point at which MySQL begins adding padding within compressed pages to avoid expensive compression failures. A value of zero disables the mechanism that monitors compression efficiency and dynamically adjusts the padding amount.
Introduced | 5.6.7 | ||
Command-Line Format | --innodb_compression_level=# |
||
Option-File Format | innodb_compression_level |
||
System Variable Name | innodb_compression_level
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 6 |
||
Range | 0 .. 9 |
Specifies the level of zlib compression to use for InnoDB
compressed tables and
indexes.
innodb_compression_pad_pct_max
Introduced | 5.6.7 | ||
Command-Line Format | --innodb_compression_pad_pct_max=# |
||
Option-File Format | innodb_compression_pad_pct_max |
||
System Variable Name | innodb_compression_pad_pct_max
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 50 |
||
Range | 0 .. 75 |
Specifies the maximum percentage that can be reserved as free space within each compressed page, allowing room to reorganize
the data and modification log within the page when a compressed table or
index is updated and the data might be recompressed. Only applies when innodb_compression_failure_threshold_pct
is set to a non-zero
value, and the rate of compression failures passes the cutoff
point.
Command-Line Format | --innodb_concurrency_tickets=# |
||
Option-File Format | innodb_concurrency_tickets |
||
System Variable Name | innodb_concurrency_tickets
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values (<= 5.6.5) | |||
Type | numeric |
||
Default | 500 |
||
Range | 1 .. 4294967295 |
||
Permitted Values (>= 5.6.6) | |||
Type | numeric |
||
Default | 5000 |
||
Range | 1 .. 4294967295 |
Determines the number of threads
that can enter InnoDB
concurrently. A thread is placed in a queue when
it tries to enter InnoDB
if the number of threads has already reached
the concurrency limit. When a thread is permitted to enter InnoDB
, it
is given a number of "free tickets"
equal to the value of innodb_concurrency_tickets
, and the thread can enter and leave
InnoDB
freely until it has used up its tickets. After that point, the
thread again becomes subject to the concurrency check (and possible queuing) the next time it tries
to enter InnoDB
. The default value is 5000 as of MySQL 5.6.6, 500
before that.
Command-Line Format | --innodb_data_file_path=name |
||
Option-File Format | innodb_data_file_path |
||
System Variable Name | innodb_data_file_path
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values (<= 5.6.6) | |||
Type | string |
||
Default | ibdata1:10M:autoextend |
||
Permitted Values (>= 5.6.7) | |||
Type | string |
||
Default | ibdata1:12M:autoextend |
The paths to individual InnoDB
data files and
their sizes. The full directory path to each data file is formed by concatenating innodb_data_home_dir
to each path specified here. The file sizes
are specified in KB, MB, or GB (1024MB) by appending K
, M
, or G
to the size value. The sum of
the sizes of the files must be at least slightly larger than 10MB. If you do not specify innodb_data_file_path
, the default behavior is to create a single
auto-extending data file, slightly larger than 12MB, named ibdata1
.
The size limit of individual files is determined by your operating system. You can set the file size
to more than 4GB on those operating systems that support big files. You can also use
raw disk partitions as data files. For detailed information on configuring InnoDB
tablespace files, see Section 14.2.1.2, "Configuring InnoDB
".
Command-Line Format | --innodb_data_home_dir=path |
||
Option-File Format | innodb_data_home_dir |
||
System Variable Name | innodb_data_home_dir
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | file name |
The common part of the directory path for all InnoDB
data
files in the system tablespace. This setting does not affect
the location offile-per-table
tablespaces when innodb_file_per_table
is enabled. The default value is the MySQL
data directory. If you specify the value as an empty string, you can use absolute file paths in innodb_data_file_path
.
innodb_disable_sort_file_cache
Introduced | 5.6.4 | ||
Command-Line Format | --innodb_disable_sort_file_cache=# |
||
Option-File Format | innodb_disable_sort_file_cache |
||
System Variable Name | innodb_disable_sort_file_cache
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | boolean |
||
Default | OFF |
If enabled, this variable disables the operating system file system cache for merge-sort temporary
files. The effect is to open such files with the equivalent of O_DIRECT
.
This variable was added in MySQL 5.6.4.
Command-Line Format | --innodb-doublewrite |
||
Option-File Format | innodb_doublewrite |
||
System Variable Name | innodb_doublewrite
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | boolean |
If this variable is enabled (the default), InnoDB
stores all data
twice, first to the doublewrite buffer, then to the actual data files. This
variable can be turned off with --skip-innodb_doublewrite
for benchmarks
or cases when top performance is needed rather than concern for data integrity or possible failures.
Command-Line Format | --innodb_fast_shutdown[=#] |
||
Option-File Format | innodb_fast_shutdown |
||
System Variable Name | innodb_fast_shutdown
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 1 |
||
Valid Values | 0 |
||
1 |
|||
2 |
The InnoDB
shutdown mode. If the value is 0,
InnoDB
does a slow shutdown, a full purge and an insert buffer
merge before shutting down. If the value is 1 (the default), InnoDB
skips these operations at shutdown, a process known as a fast shutdown.
If the value is 2, InnoDB
flushes its logs and shuts down cold, as if
MySQL had crashed; no committed transactions are lost, but the crash
recovery operation makes the next startup take longer.
The slow shutdown can take minutes, or even hours in extreme cases where substantial amounts of data are still buffered. Use the slow shutdown technique before upgrading or downgrading between MySQL major releases, so that all data files are fully prepared in case the upgrade process updates the file format.
Use innodb_fast_shutdown=2
in emergency or troubleshooting situations,
to get the absolute fastest shutdown if data is at risk of corruption.
Command-Line Format | --innodb_file_format=# |
||
Option-File Format | innodb_file_format |
||
System Variable Name | innodb_file_format
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | string |
||
Default | Antelope |
||
Valid Values | Antelope |
||
Barracuda |
The file format to use
for new InnoDB
tables. Currently, Antelope
and Barracuda
are supported. This applies only for tables that have
their own tablespace, so
for it to have an effect, innodb_file_per_table
must be enabled. The Barracuda
file format is required for certain InnoDB features such as table compression.
Command-Line Format | --innodb_file_format_check=# |
||
Option-File Format | innodb_file_format_check |
||
System Variable Name | innodb_file_format_check
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | boolean |
||
Default | ON |
This variable can be set to 1 or 0 at server startup to enable or disable whether InnoDB
checks the file format tag in the system
tablespace (for example, Antelope
or Barracuda
).
If the tag is checked and is higher than that supported by the current version of InnoDB
, an error occurs and InnoDB
does
not start. If the tag is not higher, InnoDB
sets the value of innodb_file_format_max
to the file format tag.
Despite the default value sometimes being displayed as ON
or OFF
, always use the numeric values 1 or 0 to turn this option on
or off in your configuration file or command line.
Command-Line Format | --innodb_file_format_max=# |
||
Option-File Format | innodb_file_format_max |
||
System Variable Name | innodb_file_format_max
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | string |
||
Default | Antelope |
||
Valid Values | Antelope |
||
Barracuda |
At server startup, InnoDB
sets the value of this variable to the file format tag in
the system
tablespace (for example, Antelope
or Barracuda
).
If the server creates or opens a table with a "higher"
file format, it sets the value of innodb_file_format_max
to that format.
Command-Line Format | --innodb_file_per_table |
||
Option-File Format | innodb_file_per_table |
||
System Variable Name | innodb_file_per_table
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values (<= 5.6.5) | |||
Type | boolean |
||
Default | OFF |
||
Permitted Values (>= 5.6.6) | |||
Type | boolean |
||
Default | ON |
When innodb_file_per_table
is enabled (the default in 5.6.6 and
higher), InnoDB
stores the data and indexes for each newly created
table in a separate .ibd
file, rather than in the system tablespace. The storage for
these InnoDB
tables is reclaimed when such tables are dropped or
truncated. This setting enables several other InnoDB
features, such as
table compression. See
Section 5.4.1, "Managing InnoDB Tablespaces" for
details about such features.
When innodb_file_per_table
is disabled, InnoDB
stores the data for all tables and indexes in the ibdata
files that make up the system tablespace. This setting reduces
the performance overhead of filesystem operations for operations such as DROP TABLE
or TRUNCATE TABLE
. It is most appropriate for a server environment
where entire storage devices are devoted to MySQL data. Because the system tablespace never shrinks,
and is shared across all databases in an instance, avoid loading huge
amounts of temporary data on a space-constrained system when innodb_file_per_table=OFF
.
Set up a separate instance in such cases, so that you can drop the entire instance to reclaim the
space.
By default, innodb_file_per_table
is enabled as of MySQL 5.6.6,
disabled before that. Consider disabling it if backward compatibility with MySQL 5.5 or 5.1 is a
concern. This will prevent ALTER
TABLE
from moving InnoDB
tables from the system tablespace to individual .ibd
files.
Introduced | 5.6.6 | ||
System Variable Name | innodb_flush_log_at_timeout
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 1 |
||
Range | 0 .. 2700 |
Write and flush the logs every N
seconds. innodb_flush_log_at_timeout
was introduced in MySQL 5.6.6. It allows
the timeout period between flushes to be increased in order to reduce flushing and avoid impacting
performance of binary log group commit. Prior to MySQL 5.6.6, flushing frequency was once per
second. The default setting for innodb_flush_log_at_timeout
is also once per second.
innodb_flush_log_at_trx_commit
Command-Line Format | --innodb_flush_log_at_trx_commit[=#] |
||
Option-File Format | innodb_flush_log_at_trx_commit |
||
System Variable Name | innodb_flush_log_at_trx_commit
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | enumeration |
||
Default | 1 |
||
Valid Values | 0 |
||
1 |
|||
2 |
Controls the balance between strict ACID compliance for commit operations, and higher performance that is possible when commit-related I/O operations are rearranged and done in batches. You can achieve better performance by changing the default value, but then you can lose up to one second worth of transactions in a crash.
The default value of 1 is required for full ACID compliance. With this value, the log buffer is written out to the log file at each transaction commit and the flush to disk operation is performed on the log file.
With a value of 0, any mysqld process crash can erase the last second of transactions. The log buffer is written out to the log file once per second and the flush to disk operation is performed on the log file, but no writes are done at a transaction commit.
With a value of 2, only an operating system crash or a power outage can
erase the last second of transactions. The log buffer is written out to the file at each
commit, but the flush to disk operation is not performed on it. Before MySQL 5.6.6, the
flushing on the log file takes place once per second. Note that the once-per-second flushing
is not 100% guaranteed to happen every second, due to process scheduling issues. As of MySQL
5.6.6, flushing frequency is controlled by innodb_flush_log_at_timeout
instead.
InnoDB
's crash
recovery works regardless of the value. Transactions are either applied entirely or
erased entirely.
For the greatest possible durability and consistency in a replication setup using InnoDB
with transactions, use innodb_flush_log_at_trx_commit=1
and sync_binlog=1
in your master server my.cnf
file.
Many operating systems and some disk hardware fool the flush-to-disk operation. They
may tell mysqld that the flush has taken place, even
though it has not. Then the durability of transactions is not guaranteed even with the setting
1, and in the worst case a power outage can even corrupt InnoDB
data. Using a battery-backed disk cache in the SCSI disk controller or in the disk itself speeds
up file flushes, and makes the operation safer. You can also try using the Unix command hdparm to disable the caching of disk writes in
hardware caches, or use some other command specific to the hardware vendor.
Command-Line Format | --innodb_flush_method=name |
||
Option-File Format | innodb_flush_method |
||
System Variable Name | innodb_flush_method
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values (<= 5.6.6) | |||
Type (linux) | enumeration |
||
Default | fdatasync |
||
Valid Values | O_DSYNC |
||
O_DIRECT |
|||
Permitted Values (<= 5.6.6) | |||
Type (hpux) | enumeration |
||
Default | fdatasync |
||
Valid Values | O_DSYNC |
||
O_DIRECT |
|||
Permitted Values (<= 5.6.6) | |||
Type (solaris) | enumeration |
||
Default | fdatasync |
||
Valid Values | O_DSYNC |
||
O_DIRECT |
|||
Permitted Values (>= 5.6.7) | |||
Type (linux) | enumeration |
||
Default | fdatasync |
||
Valid Values | fdatasync |
||
O_DSYNC |
|||
O_DIRECT |
|||
O_DIRECT_NO_FSYNC |
|||
Permitted Values (>= 5.6.7) | |||
Type (solaris) | enumeration |
||
Default | fdatasync |
||
Valid Values | fdatasync |
||
O_DSYNC |
|||
O_DIRECT |
|||
O_DIRECT_NO_FSYNC |
|||
Permitted Values (>= 5.6.7) | |||
Type (hpux) | enumeration |
||
Default | fdatasync |
||
Valid Values | fdatasync |
||
O_DSYNC |
|||
O_DIRECT |
|||
O_DIRECT_NO_FSYNC |
Controls the system calls used to flush
data to the InnoDB
data files and log files, which can
influence I/O throughput. This variable is relevant only for Unix and Linux systems. On Windows
systems, the flush method is always async_unbuffered
and cannot be
changed.
By default, InnoDB
uses the fsync()
system
call to flush both the data and log files. If innodb_flush_method
option is set to O_DSYNC
,
InnoDB
uses O_SYNC
to open and flush the
log files, and fsync()
to flush the data files. If O_DIRECT
is specified (available on some GNU/Linux versions, FreeBSD,
and Solaris), InnoDB
uses O_DIRECT
(or
directio()
on Solaris) to open the data files, and uses fsync()
to flush both the data and log files. Note that InnoDB
uses fsync()
instead of fdatasync()
, and it does not use O_DSYNC
by default because there have been problems with it on many varieties of Unix.
An alternative setting is O_DIRECT_NO_FSYNC
: it uses the O_DIRECT
flag during flushing I/O, but skips the fsync()
system call afterwards. This setting is suitable for some types of filesystems but not others. For
example, it is not suitable for XFS. If you are not sure whether the filesystem you use requires an
fsync()
, for example to preserve all file metadata, use O_DIRECT
instead.
Depending on hardware configuration, setting innodb_flush_method
to
O_DIRECT
or O_DIRECT_NO_FSYNC
can have
either a positive or negative effect on performance. Benchmark your particular configuration to
decide which setting to use, or whether to keep the default. Examine the Innodb_data_fsyncs
status variable to see the overall number of
fsync()
calls done with each setting. The mix of read and write
operations in your workload can also affect which setting performs better for you. For example, on a
system with a hardware RAID controller and battery-backed write cache, O_DIRECT
can help to avoid double buffering between the InnoDB
buffer pool and
the operating system's filesystem cache. On some systems where InnoDB
data and log files are located on a SAN, the default value or O_DSYNC
might be faster for a read-heavy workload with mostly SELECT
statements. Always test this parameter with the same type of hardware and workload that reflects
your production environment. For general I/O tuning advice, see Section
8.5.7, "Optimizing InnoDB
Disk I/O".
Formerly, a value of fdatasync
also specified the default behavior.
This value was removed, due to confusion that a value of fdatasync
caused fsync()
system calls rather than fdatasync()
for flushing. To obtain the default value now, do not set any value for innodb_flush_method
at startup.
Introduced | 5.6.3 | ||
Command-Line Format | --innodb_flush_neighbors |
||
Option-File Format | innodb_flush_neighbors |
||
System Variable Name | innodb_flush_neighbors
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | enumeration |
||
Default | 1 |
||
Valid Values | 0 |
||
1 |
|||
2 |
Specifies whether flushing a page from the InnoDB buffer pool also flushes other dirty pages in the same extent.
The default value of 1 flushes contiguous dirty pages in the same extent from the buffer pool.
A setting of 0 turns innodb_flush_neighbors
off and no other dirty pages are flushed
from the buffer pool.
A setting of 2 flushes dirty pages in the same extent from the buffer pool.
When the table data is stored on a traditional HDD storage device, flushing such
neighbor pages in
one operation reduces I/O overhead (primarily for disk seek operations) compared to flushing
individual pages at different times. For table data stored on SSD, seek time is
not a significant factor and you can turn this setting off to spread out the write operations. For
general I/O tuning advice, see Section 8.5.7,
"Optimizing InnoDB
Disk I/O".
Introduced | 5.6.6 | ||
Command-Line Format | --innodb_flushing_avg_loops=# |
||
Option-File Format | innodb_flushing_avg_loops |
||
System Variable Name | innodb_flushing_avg_loops
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 30 |
||
Range | 1 .. 1000 |
Number of iterations for which InnoDB keeps the previously calculated snapshot of the flushing state, controlling how quickly adaptive flushing responds to changing workloads. Increasing the value makes the the rate of flush operations change smoothly and gradually as the workload changes. Decreasing the value makes adaptive flushing adjust quickly to workload changes, which can cause spikes in flushing activity if the workload increases and decreases suddenly.
Introduced | 5.6.3 | ||
Command-Line Format | --innodb_force_load_corrupted |
||
Option-File Format | innodb_force_load_corrupted |
||
System Variable Name | innodb_force_load_corrupted
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | boolean |
||
Default | OFF |
Lets InnoDB load tables at startup that are marked as corrupted. Use only during troubleshooting, to recover data that is otherwise inaccessible. When troubleshooting is complete, turn this setting back off and restart the server.
Command-Line Format | --innodb_force_recovery=# |
||
Option-File Format | innodb_force_recovery |
||
System Variable Name | innodb_force_recovery
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | enumeration |
||
Default | 0 |
||
Valid Values | 0 |
||
1 |
|||
2 |
|||
3 |
|||
4 |
|||
5 |
|||
6 |
The crash
recovery mode, typically only changed in serious troubleshooting situations. Possible values are
from 0 to 6. The meanings of these values are described in Section
14.2.4.6, "Starting InnoDB
on a Corrupted Database".
Only set this variable greater than 0 in an emergency situation, to dump your tables
from a corrupt database. As a safety measure, InnoDB
prevents any
changes to its data when this variable is greater than 0. This restriction also prohibits some
queries that use WHERE
or ORDER BY
clauses, because high values can prevent queries from using indexes, to guard against possible
corrupt index data.
Introduced | 5.6.4 | ||
Command-Line Format | --innodb_ft_aux_table=db_name/table_name |
||
Option-File Format | innodb_ft_aux_table |
||
System Variable Name | innodb_ft_aux_table
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | string |
Specifies the qualified name of an InnoDB
table containing a FULLTEXT
index. After you set this variable to a name in the format
the db_name
/table_name
INFORMATION_SCHEMA
tables INNODB_FT_INDEX_TABLE
, INNODB_FT_INDEX_CACHE
, INNODB_FT_CONFIG
, INNODB_FT_DELETED
, and INNODB_FT_BEING_DELETED
then reflect information about the search
index for the specified table.
Introduced | 5.6.4 | ||
Command-Line Format | --innodb_ft_cache_size=# |
||
Option-File Format | innodb_ft_cache_size |
||
System Variable Name | innodb_ft_cache_size
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values (>= 5.6.4, <= 5.6.9) | |||
Type | numeric |
||
Default | 32000000 |
||
Permitted Values (>= 5.6.10) | |||
Type | numeric |
||
Default | 8000000 |
Size of the cache that holds a parsed document in memory while creating an InnoDB FULLTEXT
index.
Introduced | 5.6.4 | ||
Command-Line Format | --innodb_ft_enable_diag_print=# |
||
Option-File Format | innodb_ft_enable_diag_print |
||
System Variable Name | innodb_ft_enable_diag_print
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values (<= 5.6.6) | |||
Type | boolean |
||
Default | OFF |
||
Permitted Values (>= 5.6.7) | |||
Type | boolean |
||
Default | ON |
Whether to enable additional full-text search diagnostic output.
Introduced | 5.6.4 | ||
Command-Line Format | --innodb_ft_enable_stopword=# |
||
Option-File Format | innodb_ft_enable_stopword |
||
System Variable Name | innodb_ft_enable_stopword
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | boolean |
||
Default | ON |
Specifies that a set of stopwords
is associated with an InnoDB
FULLTEXT
index at the time the index is created. If the innodb_ft_user_stopword_table
option is set, the stopwords are
taken from that table. Else, if the innodb_ft_server_stopword_table
option is set, the stopwords are
taken from that table. Otherwise, a built-in set of default stopwords is used.
Introduced | 5.6.4 | ||
Command-Line Format | --innodb_ft_max_token_size=# |
||
Option-File Format | innodb_ft_max_token_size |
||
System Variable Name | innodb_ft_max_token_size
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | numeric |
||
Default | 84 |
||
Range | 10 .. 252 |
Maximum length of words that are stored in an InnoDB FULLTEXT
index.
Setting a limit on this value reduces the size of the index, thus speeding up queries, by omitting
long keywords or arbitrary collections of letters that are not real words and are not likely to be
search terms.
Introduced | 5.6.4 | ||
Command-Line Format | --innodb_ft_min_token_size=# |
||
Option-File Format | innodb_ft_min_token_size |
||
System Variable Name | innodb_ft_min_token_size
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | numeric |
||
Default | 3 |
||
Range | 0 .. 16 |
Minimum length of words that are stored in an InnoDB FULLTEXT
index.
Increasing this value reduces the size of the index, thus speeding up queries, by omitting common
word that are unlikely to be significant in a search context, such as the English words "a" and "to". For content using a CJK (Chinese, Japanese, Korean)
character set, specify a value of 1.
Introduced | 5.6.4 | ||
Command-Line Format | --innodb_ft_num_word_optimize=# |
||
Option-File Format | innodb_ft_num_word_optimize |
||
System Variable Name | innodb_ft_num_word_optimize
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 2000 |
Number of words to process during each OPTIMIZE TABLE
operation on an InnoDB
FULLTEXT
index. Because a bulk insert or update operation to a table
containing a full-text search index could require substantial index maintenance to incorporate all
changes, you might do a series of OPTIMIZE
TABLE
statements, each picking up where the last left off.
innodb_ft_server_stopword_table
Introduced | 5.6.4 | ||
Command-Line Format | --innodb_ft_server_stopword_table=db_name/table_name |
||
Option-File Format | innodb_ft_server_stopword_table |
||
System Variable Name | innodb_ft_server_stopword_table
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | string |
||
Default | NULL |
Name of the table containing a list of words to ignore when creating an InnoDB FULLTEXT
index, in the format
.db_name
/table_name
The stopword table must be an InnoDB
table, containing a
single VARCHAR
column named VALUE
. The
stopword table must exist before you specify its name in the configuration option value.
Introduced | 5.6.4 | ||
Command-Line Format | --innodb_ft_sort_pll_degree=# |
||
Option-File Format | innodb_ft_sort_pll_degree |
||
System Variable Name | innodb_ft_sort_pll_degree
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | numeric |
||
Default | 2 |
||
Range | 1 .. 32 |
Number of threads used in parallel to index and tokenize text in an InnoDB
FULLTEXT
index, when building a search index for a
large table.
Introduced | 5.6.4 | ||
Command-Line Format | --innodb_ft_user_stopword_table=db_name/table_name |
||
Option-File Format | innodb_ft_user_stopword_table |
||
System Variable Name | innodb_ft_user_stopword_table
|
||
Variable Scope | Global, Session | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | string |
||
Default | NULL |
Name of the table containing a list of words to ignore when creating an InnoDB FULLTEXT
index, in the format
.db_name
/table_name
The stopword table must be an InnoDB
table, containing a
single VARCHAR
column named VALUE
. The
stopword table must exist before you specify its name in the configuration option value.
Command-Line Format | --innodb_io_capacity=# |
||
Option-File Format | innodb_io_capacity |
||
System Variable Name | innodb_io_capacity
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Platform Bit Size | 32 |
||
Type | numeric |
||
Default | 200 |
||
Range | 100 .. 2**32-1 |
||
Permitted Values | |||
Platform Bit Size | 64 |
||
Type | numeric |
||
Default | 200 |
||
Range | 100 .. 2**64-1 |
The innodb_io_capacity
parameter sets an upper limit, per buffer pool instance, on the I/O activity performed by the InnoDB
background tasks, such as flushing pages
from the buffer pool
and merging data from the insert buffer. The default value is 200. For
busy systems capable of higher I/O rates, you can set a higher value at server startup, to help the
server handle the background maintenance work associated with a high rate of row changes.
Specifying a server startup value for innodb_io_capacity
will render innodb_io_capacity_max
inoperable.
For systems with individual 5400 RPM or 7200 RPM drives, you might lower the value to the former
default of 100
.
This parameter should be set to approximately the number of I/O operations that the system can perform per second. Ideally, keep this setting as low as practical, but not so low that these background activities fall behind. If the value is too high, data is removed from the buffer pool and insert buffer too quickly to provide significant benefit from the caching.
The value represents an estimated proportion of the I/O operations per second (IOPS) available to older-generation disk drives that could perform about 100 IOPS. The current default of 200 reflects that modern storage devices are capable of much higher I/O rates.
In general, you can increase the value as a function of the number of drives used for InnoDB
I/O,
particularly fast drives capable of high numbers of IOPS. For example, systems that use multiple
disks or solid-state disks for InnoDB
are likely to benefit from the ability to control this parameter.
Although you can specify a very high number, in practice such large values have little if any benefit; for example, a value of one million would be considered very high.
You can set the innodb_io_capacity
value to any number 100 or greater,
and the default value is 200
. You can set the value of this parameter
in the MySQL option file (my.cnf
or my.ini
)
or change it dynamically with the SET GLOBAL
command, which requires
the SUPER
privilege.
See Section 14.2.4.2.20,
"Controlling the InnoDB Master Thread I/O Rate" for more guidelines about this option. For
general information about InnoDB I/O performance, see Section
8.5.7, "Optimizing InnoDB
Disk I/O".
Introduced | 5.6.6 | ||
Command-Line Format | --innodb_io_capacity_max=# |
||
Option-File Format | innodb_io_capacity_max |
||
System Variable Name | innodb_io_capacity_max
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Platform Bit Size | 32 |
||
Type | numeric |
||
Default | see formula in description |
||
Range | 2000 .. 4294967295 |
||
Permitted Values | |||
Platform Bit Size | 64 |
||
Type | numeric |
||
Default | see formula in description |
||
Range | 2000 .. 18446744073709547520 |
The limit up to which InnoDB
is allowed to extend the innodb_io_capacity
setting, per buffer pool instance, in case of
emergency. Its default value is twice the default value of innodb_io_capacity
, with a lower limit of 2000. It is inoperative
if you have specified any value for innodb_io_capacity
at server startup.
For a brief period during MySQL 5.6 development, this variable was known as innodb_max_io_capacity
.
Introduced | 5.6.3 | ||
Command-Line Format | --innodb_large_prefix |
||
Option-File Format | innodb_large_prefix |
||
System Variable Name | innodb_large_prefix
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | boolean |
||
Default | OFF |
Enable this option to allow index key prefixes longer than 767 bytes (up
to 3072 bytes), for InnoDB
tables that use the DYNAMIC
and COMPRESSED
row formats. (Creating such tables also requires the option values innodb_file_format=barracuda
and innodb_file_per_table=true
.) See Section
14.2.7, "Limits on InnoDB
Tables" for the relevant maximums
associated with index key prefixes under various settings.
For tables using the REDUNDANT
and
COMPACT
row formats, this option does
not affect the allowed key prefix length. It does introduce a new error possibility. When this
setting is enabled, attempting to create an index prefix with a key length greater than 3072 for a
REDUNDANT
or COMPACT
table causes an error
ER_INDEX_COLUMN_TOO_LONG
(1727).
Command-Line Format | --innodb_lock_wait_timeout=# |
||
Option-File Format | innodb_lock_wait_timeout |
||
System Variable Name | innodb_lock_wait_timeout
|
||
Variable Scope | Global, Session | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 50 |
||
Range | 1 .. 1073741824 |
The timeout in seconds an InnoDB
transaction
waits for a row lock before
giving up. The default value is 50 seconds. A transaction that tries to access a row that is locked
by another InnoDB
transaction waits at most this many seconds for write
access to the row before issuing the following error:
ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
When a lock wait timeout occurs, the current statement is rolled back (not
the entire transaction). To have the entire transaction roll back, start the server with the --innodb_rollback_on_timeout
option. See also Section
14.2.3.14, "InnoDB
Error Handling".
You might decrease this value for highly interactive applications or OLTP systems, to display user feedback quickly or put the update into a queue for processing later. You might increase this value for long-running back-end operations, such as a transform step in a data warehouse that waits for other large insert or update operations to finish.
innodb_lock_wait_timeout
applies to InnoDB
row locks only. A MySQL table
lock does not happen inside InnoDB
and this timeout does not
apply to waits for table locks.
The lock wait timeout value does not apply to deadlocks, because InnoDB
detects them immediately and rolls back one of the deadlocked
transactions.
innodb_locks_unsafe_for_binlog
Deprecated | 5.6.3 | ||
Command-Line Format | --innodb_locks_unsafe_for_binlog |
||
Option-File Format | innodb_locks_unsafe_for_binlog |
||
System Variable Name | innodb_locks_unsafe_for_binlog
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | boolean |
||
Default | OFF |
This variable affects how InnoDB
uses gap
locking for searches and index scans. As of MySQL 5.6.3, innodb_locks_unsafe_for_binlog
is deprecated and will be removed in a future MySQL release.
Normally, InnoDB
uses an algorithm called next-key locking that
combines index-row locking with gap
locking. InnoDB
performs row-level locking in such a way that
when it searches or scans a table index, it sets shared or exclusive locks on the index records it
encounters. Thus, the row-level locks are actually index-record locks. In addition, a next-key lock
on an index record also affects the "gap"
before that index record. That is, a next-key lock is an index-record lock plus a gap lock on the
gap preceding the index record. If one session has a shared or exclusive lock on record R
in an index, another session cannot insert a new index record in
the gap immediately before R
in the index order. See Section
14.2.3.5, "InnoDB
Record, Gap, and Next-Key Locks".
By default, the value of innodb_locks_unsafe_for_binlog
is 0
(disabled), which means that gap locking is enabled: InnoDB
uses
next-key locks for searches and index scans. To enable the variable, set it to 1. This causes gap
locking to be disabled: InnoDB
uses only index-record locks for
searches and index scans.
Enabling innodb_locks_unsafe_for_binlog
does not disable the use of gap
locking for foreign-key constraint checking or duplicate-key checking.
The effect of enabling innodb_locks_unsafe_for_binlog
is similar to but
not identical to setting the transaction isolation level to READ COMMITTED
:
Enabling innodb_locks_unsafe_for_binlog
is a global setting and
affects all sessions, whereas the isolation level can be set globally for all sessions, or
individually per session.
innodb_locks_unsafe_for_binlog
can be set only at server
startup, whereas the isolation level can be set at startup or changed at runtime.
READ
COMMITTED
therefore offers finer and more flexible control than innodb_locks_unsafe_for_binlog
. For additional details about the
effect of isolation level on gap locking, see Section
13.3.6, "SET TRANSACTION
Syntax".
Enabling innodb_locks_unsafe_for_binlog
may cause phantom problems
because other sessions can insert new rows into the gaps when gap locking is disabled. Suppose that
there is an index on the id
column of the child
table and that you want to read and lock all rows from the
table having an identifier value larger than 100, with the intention of updating some column in the
selected rows later:
SELECT * FROM child WHERE id > 100 FOR UPDATE;
The query scans the index starting from the first record where id
is
greater than 100. If the locks set on the index records in that range do not lock out inserts made
in the gaps, another session can insert a new row into the table. Consequently, if you were to
execute the same SELECT
again within the same transaction, you would see a new row
in the result set returned by the query. This also means that if new items are added to the
database, InnoDB
does not guarantee serializability. Therefore, if
innodb_locks_unsafe_for_binlog
is enabled, InnoDB
guarantees at most an isolation level of READ COMMITTED
. (Conflict serializability is still guaranteed.)
For additional information about phantoms, see Section
14.2.3.6, "Avoiding the Phantom Problem Using Next-Key Locking".
Enabling innodb_locks_unsafe_for_binlog
has additional effects:
For UPDATE
or DELETE
statements, InnoDB
holds
locks only for rows that it updates or deletes. Record locks for nonmatching rows are
released after MySQL has evaluated the WHERE
condition. This
greatly reduces the probability of deadlocks, but they can still happen.
For UPDATE
statements, if a row is already locked, InnoDB
performs a "semi-consistent"
read, returning the latest committed version to MySQL so that MySQL can determine whether
the row matches the WHERE
condition of the UPDATE
. If the row matches (must be updated), MySQL reads
the row again and this time InnoDB
either locks it or waits for
a lock on it.
Consider the following example, beginning with this table:
CREATE TABLE t (a INT NOT NULL, b INT) ENGINE = InnoDB;INSERT INTO t VALUES (1,2),(2,3),(3,2),(4,3),(5,2);COMMIT;
In this case, table has no indexes, so searches and index scans use the hidden clustered index for record locking (see Section 14.2.3.12.2, "Clustered and Secondary Indexes").
Suppose that one client performs an UPDATE
using these statements:
SET autocommit = 0;UPDATE t SET b = 5 WHERE b = 3;
Suppose also that a second client performs an UPDATE
by executing these statements following those of the first
client:
SET autocommit = 0;UPDATE t SET b = 4 WHERE b = 2;
As InnoDB
executes each UPDATE
, it first acquires an exclusive lock for each row, and then
determines whether to modify it. If InnoDB
does not modify the row and
innodb_locks_unsafe_for_binlog
is enabled, it releases the lock.
Otherwise, InnoDB
retains the lock until the end of the transaction.
This affects transaction processing as follows.
If innodb_locks_unsafe_for_binlog
is disabled, the first UPDATE
acquires x-locks and does not release any of them:
x-lock(1,2); retain x-lockx-lock(2,3); update(2,3) to (2,5); retain x-lockx-lock(3,2); retain x-lockx-lock(4,3); update(4,3) to (4,5); retain x-lockx-lock(5,2); retain x-lock
The second UPDATE
blocks as soon as it tries to acquire any locks (because first
update has retained locks on all rows), and does not proceed until the first UPDATE
commits or rolls back:
x-lock(1,2); block and wait for first UPDATE to commit or roll back
If innodb_locks_unsafe_for_binlog
is enabled, the first UPDATE
acquires x-locks and releases those for rows that it does not
modify:
x-lock(1,2); unlock(1,2)x-lock(2,3); update(2,3) to (2,5); retain x-lockx-lock(3,2); unlock(3,2)x-lock(4,3); update(4,3) to (4,5); retain x-lockx-lock(5,2); unlock(5,2)
For the second UPDATE
, InnoDB
does a "semi-consistent" read, returning the latest
committed version of each row to MySQL so that MySQL can determine whether the row matches the WHERE
condition of the UPDATE
:
x-lock(1,2); update(1,2) to (1,4); retain x-lockx-lock(2,3); unlock(2,3)x-lock(3,2); update(3,2) to (3,4); retain x-lockx-lock(4,3); unlock(4,3)x-lock(5,2); update(5,2) to (5,4); retain x-lock
Command-Line Format | --innodb_log_buffer_size=# |
||
Option-File Format | innodb_log_buffer_size |
||
System Variable Name | innodb_log_buffer_size
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | numeric |
||
Default | 8388608 |
||
Range | 262144 .. 4294967295 |
The size in bytes of the buffer that InnoDB
uses to write to the log files on disk. The
default value is 8MB. A large log buffer enables large transactions
to run without a need to write the log to disk before the transactions commit.
Thus, if you have transactions that update, insert, or delete many rows, making the log buffer
larger saves disk I/O. For general I/O tuning advice, see Section
8.5.7, "Optimizing InnoDB
Disk I/O".
Introduced | 5.6.11 | ||
Command-Line Format | --innodb_log_compressed_pages=# |
||
Option-File Format | innodb_log_compressed_pages |
||
System Variable Name | innodb_log_compressed_pages
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | boolean |
||
Default | ON |
Specifies whether images of re-compressed pages are
stored in InnoDB
redo logs.
This variable was added in MySQL 5.6.11.
Command-Line Format | --innodb_log_file_size=# |
||
Option-File Format | innodb_log_file_size |
||
System Variable Name | innodb_log_file_size
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values (>= 5.6.3, <= 5.6.7) | |||
Type | numeric |
||
Default | 5242880 |
||
Range | 1048576 .. 512GB / innodb_log_files_in_group
|
||
Permitted Values (>= 5.6.8) | |||
Type | numeric |
||
Default | 50331648 |
||
Range | 1048576 .. 512GB / innodb_log_files_in_group
|
The size in bytes of each log
file in a log group.
The combined size of log files (innodb_log_file_size
* innodb_log_files_in_group
) cannot exceed a maximum value that is
slightly less than 512GB. A pair of 255 GB log files, for example, would allow you to approach the
limit but not exceed it. The default value is 48MB. Sensible values range from 1MB to 1/N
-th of the size of the buffer
pool, where N
is the number of log files in the
group. The larger the value, the less checkpoint flush activity is needed in the buffer pool, saving
disk I/O. Larger log files also make crash recovery slower, although
improvements to recovery performance in MySQL 5.5 and higher make the log file size less of a
consideration. For general I/O tuning advice, see Section
8.5.7, "Optimizing InnoDB
Disk I/O".
Command-Line Format | --innodb_log_files_in_group=# |
||
Option-File Format | innodb_log_files_in_group |
||
System Variable Name | innodb_log_files_in_group
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | numeric |
||
Default | 2 |
||
Range | 2 .. 100 |
The number of log files in
the log group. InnoDB
writes to the files in a circular fashion. The default (and
recommended) value is 2. The location of these files is specified by innodb_log_group_home_dir
. The combined size of log files (innodb_log_file_size
* innodb_log_files_in_group
) can be up to 512GB.
Command-Line Format | --innodb_log_group_home_dir=path |
||
Option-File Format | innodb_log_group_home_dir |
||
System Variable Name | innodb_log_group_home_dir
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | file name |
The directory path to the InnoDB
redo log
files, whose number is specified by innodb_log_files_in_group
. If you do not specify any InnoDB
log variables, the default is to create two files named ib_logfile0
and ib_logfile1
in the
MySQL data directory. Their size is given by the size of the innodb_log_file_size
system variable.
Introduced | 5.6.3 | ||
Command-Line Format | --innodb_lru_scan_depth=# |
||
Option-File Format | innodb_lru_scan_depth |
||
System Variable Name | innodb_lru_scan_depth
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Platform Bit Size | 32 |
||
Type | numeric |
||
Default | 1024 |
||
Range | 100 .. 2**32-1 |
||
Permitted Values | |||
Platform Bit Size | 64 |
||
Type | numeric |
||
Default | 1024 |
||
Range | 100 .. 2**64-1 |
A parameter that influences the algorithms and heuristics for the flush
operation for the InnoDB
buffer pool.
Primarily of interest to performance experts tuning I/O-intensive workloads. It specifies, per
buffer pool instance, how far down the buffer pool LRU list the page_cleaner
thread scans looking for dirty
pages to flush. This is a background operation performed once a second. If you have spare
I/O capacity under a typical workload, increase the value. If a write-intensive workload saturates
your I/O capacity, decrease the value, especially if you have a large buffer pool. For general I/O
tuning advice, see Section 8.5.7, "Optimizing InnoDB
Disk I/O".
Command-Line Format | --innodb_max_dirty_pages_pct=# |
||
Option-File Format | innodb_max_dirty_pages_pct |
||
System Variable Name | innodb_max_dirty_pages_pct
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 75 |
||
Range | 0 .. 99 |
InnoDB
tries to flush data from the buffer
pool so that the percentage of dirty pages does not exceed this value.
Specify an integer in the range from 0 to 99. The default value is 75. For general I/O tuning
advice, see Section 8.5.7, "Optimizing InnoDB
Disk I/O".
innodb_max_dirty_pages_pct_lwm
Introduced | 5.6.6 | ||
Command-Line Format | --innodb_max_dirty_pages_pct_lwm=# |
||
Option-File Format | innodb_max_dirty_pages_pct_lwm |
||
System Variable Name | innodb_max_dirty_pages_pct_lwm
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 0 |
||
Range | 0 .. 99 |
Low water mark representing percentage of dirty pages where preflushing is enabled to control the dirty page ratio. The default of 0 disables the preflushing behavior entirely.
Command-Line Format | --innodb_max_purge_lag=# |
||
Option-File Format | innodb_max_purge_lag |
||
System Variable Name | innodb_max_purge_lag
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 0 |
||
Range | 0 .. 4294967295 |
This variable controls how to delay INSERT
, UPDATE
,
and DELETE
operations when purge operations are
lagging (see Section 14.2.3.11, "InnoDB
Multi-Versioning"). The default value is 0 (no delays).
The InnoDB
transaction system maintains a list of transactions that
have index records delete-marked by UPDATE
or DELETE
operations. The length of this list represents the purge_lag
value. When purge_lag
exceeds innodb_max_purge_lag
, each INSERT
, UPDATE
,
and DELETE
operation is delayed.
To prevent excessive delays in extreme situations where purge_lag
becomes huge, you can put a cap on the amount of
delay by setting the innodb_max_purge_lag_delay
configuration option. The delay is
computed at the beginning of a purge batch.
A typical setting for a problematic workload might be 1 million, assuming that transactions are
small, only 100 bytes in size, and it is permissible to have 100MB of unpurged InnoDB
table rows.
The lag value is displayed as the history list length in the TRANSACTIONS
section of InnoDB Monitor output. For example, if the output
includes the following lines, the lag value is 20:
------------TRANSACTIONS------------Trx id counter 0 290328385Purge done for trx's n:o < 0 290315608 undo n:o < 0 17History list length 20
For general I/O tuning advice, see Section 8.5.7,
"Optimizing InnoDB
Disk I/O".
Introduced | 5.6.5 | ||
Command-Line Format | --innodb_max_purge_lag_delay=# |
||
Option-File Format | innodb_max_purge_lag_delay |
||
System Variable Name | innodb_max_purge_lag_delay
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 0 |
||
Min Value | 0 |
Specifies the maximum delay in milliseconds for the delay imposed by the innodb_max_purge_lag
configuration option. Any non-zero value
represents an upper limit on the delay period computed from the formula based on the value of innodb_max_purge_lag
. The default of zero means that there is no
upper limit imposed on the delay interval.
For general I/O tuning advice, see Section 8.5.7,
"Optimizing InnoDB
Disk I/O".
Has no effect. This variable is deprecated as of MySQL 5.6.11 and will be removed in a future MySQL release.
Introduced | 5.6.2 | ||
Command-Line Format | --innodb_monitor_disable=[counter|module|pattern|all] |
||
Option-File Format | innodb_monitor_disable |
||
System Variable Name | innodb_monitor_disable
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | string |
Turns off one or more counters
in the INFORMATION_SCHEMA.INNODB_METRICS
table. For usage information, see Section
20.30.19, "The INFORMATION_SCHEMA INNODB_METRICS
Table".
Introduced | 5.6.2 | ||
Command-Line Format | --innodb_monitor_enable=name |
||
Option-File Format | innodb_monitor_enable |
||
System Variable Name | innodb_monitor_enable
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | string |
Turns on one or more counters
in the INFORMATION_SCHEMA.INNODB_METRICS
table. For usage information, see Section
20.30.19, "The INFORMATION_SCHEMA INNODB_METRICS
Table".
Introduced | 5.6.2 | ||
Command-Line Format | --innodb_monitor_reset=[counter|module|pattern|all] |
||
Option-File Format | innodb_monitor_reset |
||
System Variable Name | innodb_monitor_reset
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | string |
Resets to zero the count value for one or more counters in the INFORMATION_SCHEMA.INNODB_METRICS
table. For usage information, see Section
20.30.19, "The INFORMATION_SCHEMA INNODB_METRICS
Table".
Introduced | 5.6.2 | ||
Command-Line Format | --innodb_monitor_reset_all=[counter|module|pattern|all]
|
||
Option-File Format | innodb_monitor_reset_all |
||
System Variable Name | innodb_monitor_reset_all
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | string |
Resets all values (minimum, maximum, and so on) for one or more counters in
the INFORMATION_SCHEMA.INNODB_METRICS
table. For usage information, see Section
20.30.19, "The INFORMATION_SCHEMA INNODB_METRICS
Table".
Command-Line Format | --innodb_old_blocks_pct=# |
||
Option-File Format | innodb_old_blocks_pct |
||
System Variable Name | innodb_old_blocks_pct
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 37 |
||
Range | 5 .. 95 |
Specifies the approximate percentage of the InnoDB
buffer
pool used for the old block sublist.
The range of values is 5 to 95. The default value is 37 (that is, 3/8 of the pool). Often used in
combination with innodb_old_blocks_time
. See Section
8.9.1, "The InnoDB
Buffer Pool" for information about buffer
pool management, such as the LRU
algorithm and eviction
policies.
Command-Line Format | --innodb_old_blocks_time=# |
||
Option-File Format | innodb_old_blocks_time |
||
System Variable Name | innodb_old_blocks_time
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values (<= 5.6.5) | |||
Type | numeric |
||
Default | 0 |
||
Range | 0 .. 2**32-1 |
||
Permitted Values (>= 5.6.6) | |||
Type | numeric |
||
Default | 1000 |
||
Range | 0 .. 2**32-1 |
Non-zero values protect against the buffer pool being filled up by data that is referenced only for a brief period, such as during a full table scan. Increasing this value offers more protection against full table scans interfering with data cached in the buffer pool.
Specifies how long in milliseconds (ms) a block inserted into the old sublist must stay there after its first access before it can be moved to the new sublist. If the value is 0, a block inserted into the old sublist moves immediately to the new sublist the first time it is accessed, no matter how soon after insertion the access occurs. If the value is greater than 0, blocks remain in the old sublist until an access occurs at least that many ms after the first access. For example, a value of 1000 causes blocks to stay in the old sublist for 1 second after the first access before they become eligible to move to the new sublist.
The default value is 1000 as of MySQL 5.6.6, 0 before that.
This variable is often used in combination with innodb_old_blocks_pct
. See Section
8.9.1, "The InnoDB
Buffer Pool" for information about buffer pool
management, such as the LRU algorithm
and eviction policies.
innodb_online_alter_log_max_size
Introduced | 5.6.6 | ||
Command-Line Format | --innodb_online_alter_log_max_size=# |
||
Option-File Format | innodb_online_alter_log_max_size |
||
System Variable Name | innodb_online_alter_log_max_size
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 134217728 |
||
Range | 65536 .. 2**64-1 |
Specifies an upper limit on the size of the temporary log files used during online
DDL operations for InnoDB
tables. There is one such log file for
each index being created or table being altered. This log file stores data inserted, updated, or
deleted in the table during the DDL operation. The temporary log file is extended when needed by the
value of innodb_sort_buffer_size
, up to the maximum specified by innodb_online_alter_log_max_size
. If any temporary log file exceeds
the upper size limit, the ALTER
TABLE
operation fails and all uncommitted concurrent DML operations are rolled back.
Thus, a large value for this option allows more DML to happen during an online DDL operation, but
also causes a longer period at the end of the DDL operation when the table is locked to apply the
data from the log.
Command-Line Format | --innodb_open_files=# |
||
Option-File Format | innodb_open_files |
||
System Variable Name | innodb_open_files
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values (<= 5.6.5) | |||
Type | numeric |
||
Default | 300 |
||
Range | 10 .. 4294967295 |
||
Permitted Values (>= 5.6.6) | |||
Type | numeric |
||
Default | -1 (autosized) |
||
Range | 10 .. 4294967295 |
This variable is relevant only if you use multiple InnoDB
tablespaces. It
specifies the maximum number of .ibd
files
that MySQL can keep open at one time. The minimum value is 10. As of MySQL 5.6.6, the default value
is 300 if innodb_file_per_table
is not enabled, and the higher of 300 and
table_open_cache
otherwise. Before 5.6.6, the default value is 300.
The file descriptors used for .ibd
files are for InnoDB
tables only. They are independent of those specified by the --open-files-limit
server option, and do not affect the operation of
the table cache. For general I/O tuning advice, see Section
8.5.7, "Optimizing InnoDB
Disk I/O".
Introduced | 5.6.4 | ||
Command-Line Format | --innodb_optimize_fulltext_only=# |
||
Option-File Format | innodb_optimize_fulltext_only |
||
System Variable Name | innodb_optimize_fulltext_only
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | boolean |
||
Default | OFF |
Changes the way the OPTIMIZE
TABLE
statement operates on InnoDB
tables. Intended to be
enabled temporarily, during maintenance operations for InnoDB
tables
with FULLTEXT
indexes.
By default, OPTIMIZE TABLE
reorganizes the data in the clustered
index of the table. When this option is enabled, OPTIMIZE TABLE
skips this reorganization of the table data, and instead processes the newly added, deleted, and
updated token data for a FULLTEXT
index, See Section
14.2.3.12.3, "FULLTEXT
Indexes" for more information about
FULLTEXT
indexes for InnoDB
tables.
Introduced | 5.6.4 | ||
Command-Line Format | --innodb_page_size=#k |
||
Option-File Format | innodb_page_size |
||
System Variable Name | innodb_page_size
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | enumeration |
||
Default | 16384 |
||
Valid Values | 4k |
||
8k |
|||
16k |
|||
4096 |
|||
8192 |
|||
16384 |
Specifies the page size
for all InnoDB
tablespaces in a MySQL instance. This value is
set when the instance is created and remains constant afterwards. You can specify page size using
the values 16k
(the default), 8k
, or 4k
.
The default, with the largest page size, is appropriate for a wide range of workloads,
particularly for queries involving table scans and DML operations involving bulk updates. Smaller
page sizes might be more efficient for OLTP
workloads involving many small writes, where contention can be an issue when a single page contains
many rows. Smaller pages might also be efficient with SSD storage devices, which
typically use small block sizes. Keeping the InnoDB
page size close to
the storage device block size minimizes the amount of unchanged data that is rewritten to disk. For
general I/O tuning advice, see Section 8.5.7,
"Optimizing InnoDB
Disk I/O".
Introduced | 5.6.2 | ||
Command-Line Format | --innodb_print_all_deadlocks=# |
||
Option-File Format | innodb_print_all_deadlocks |
||
System Variable Name | innodb_print_all_deadlocks
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | boolean |
||
Default | OFF |
When this option is enabled, information about all deadlocks in InnoDB
user transactions is recorded in the mysqld
error log. Otherwise, you see
information about only the last deadlock, using the SHOW ENGINE INNODB
STATUS
command. An occasional InnoDB
deadlock is not
necessarily an issue, because InnoDB
detects the condition immediately,
and rolls back one of the transactions automatically. You might use this option to troubleshoot why
deadlocks are happening if an application does not have appropriate error-handling logic to detect
the rollback and retry its operation. A large number of deadlocks might indicate the need to
restructure transactions that issue DML or SELECT ... FOR
UPDATE
statements for multiple tables, so that each transaction accesses the tables in
the same order, thus avoiding the deadlock condition.
Command-Line Format | --innodb_purge_batch_size=# |
||
Option-File Format | innodb_purge_batch_size |
||
System Variable Name | innodb_purge_batch_size
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values (>= 5.6.3) | |||
Type | numeric |
||
Default | 300 |
||
Range | 1 .. 5000 |
The granularity of changes, expressed in units of redo log records, that
trigger a purge operation,
flushing the changed buffer
pool blocks to disk. This option is intended for tuning performance in combination with the
setting innodb_purge_threads=
, and typical users do not need to modify it.
n
Command-Line Format | --innodb_purge_threads=# |
||
Option-File Format | innodb_purge_threads |
||
System Variable Name | innodb_purge_threads
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values (>= 5.6.2) | |||
Type | numeric |
||
Default | 0 |
||
Range | 0 .. 32 |
||
Permitted Values (>= 5.6.5) | |||
Type | numeric |
||
Default | 1 |
||
Range | 1 .. 32 |
The number of background threads devoted to the InnoDB purge operation. The new default and minimum value of 1 in MySQL 5.6.5 signifies that the purge operation is always performed by background threads, never as part of the master thread. Non-zero values runs the purge operation in one or more background threads, which can reduce internal contention within InnoDB, improving scalability. Increasing the value to greater than 1 creates that many separate purge threads, which can improve efficiency on systems where DML operations are performed on multiple tables. The maximum is 32.
Introduced | 5.6.3 | ||
Command-Line Format | --innodb_random_read_ahead=# |
||
Option-File Format | innodb_random_read_ahead |
||
System Variable Name | innodb_random_read_ahead
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | boolean |
||
Default | OFF |
Enables the random read-ahead
technique for optimizing InnoDB
I/O. This is a setting that was
originally on by default, then was removed in MySQL 5.5, and now is available but turned off by
default. See Section 14.2.4.2.16,
"Changes in the Read-Ahead Algorithm" for details about the performance considerations for
the different types of read-ahead requests. For general I/O tuning advice, see Section
8.5.7, "Optimizing InnoDB
Disk I/O".
Command-Line Format | --innodb_read_ahead_threshold=# |
||
Option-File Format | innodb_read_ahead_threshold |
||
System Variable Name | innodb_read_ahead_threshold
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 56 |
||
Range | 0 .. 64 |
Controls the sensitivity of linear read-ahead that InnoDB
uses to prefetch pages into the buffer pool. If InnoDB
reads at least innodb_read_ahead_threshold
pages sequentially from an
extent (64 pages), it initiates
an asynchronous read for the entire following extent. The permissible range of values is 0 to 64.
The default is 56: InnoDB
must read at least 56 pages sequentially from
an extent to initiate an asynchronous read for the following extent. For general I/O tuning advice,
see Section 8.5.7, "Optimizing InnoDB
Disk I/O".
Command-Line Format | --innodb_read_io_threads=# |
||
Option-File Format | innodb_read_io_threads |
||
System Variable Name | innodb_read_io_threads
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | numeric |
||
Default | 4 |
||
Range | 1 .. 64 |
The number of I/O threads for read operations in InnoDB
. The default
value is 4. Its counterpart for write threads is innodb_write_io_threads
. For general I/O tuning advice, see Section 8.5.7, "Optimizing InnoDB
Disk I/O".
On Linux systems, running multiple MySQL servers (typically more than 12) with default
settings for innodb_read_io_threads
, innodb_write_io_threads
, and the Linux aio-max-nr
setting can exceed system limits. Ideally, increase the aio-max-nr
setting; as a workaround, you might reduce the settings for one or both of the MySQL
configuration options.
Introduced | 5.6.7 | ||
Command-Line Format | --innodb_read_only=# |
||
Option-File Format | innodb_read_only |
||
System Variable Name | innodb_read_only
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | boolean |
||
Default | OFF |
Starts the server in read-only mode. For distributing database applications or data sets on read-only media. Can also be used in data warehouses to share the same data directory between multiple instances. See Section 14.2.5.1, "Support for Read-Only Media" for usage instructions.
Command-Line Format | --innodb_replication_delay=# |
||
Option-File Format | innodb_replication_delay |
||
System Variable Name | innodb_replication_delay
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 0 |
||
Range | 0 .. 4294967295 |
The replication thread delay (in ms) on a slave server if innodb_thread_concurrency
is reached.
Command-Line Format | --innodb_rollback_on_timeout |
||
Option-File Format | innodb_rollback_on_timeout |
||
System Variable Name | innodb_rollback_on_timeout
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | boolean |
||
Default | OFF |
In MySQL 5.6, InnoDB
rolls back only the last
statement on a transaction timeout by default. If --innodb_rollback_on_timeout
is specified, a transaction timeout
causes InnoDB
to abort and roll back the entire transaction (the same
behavior as in MySQL 4.1).
Introduced | 5.6.2 | ||
Command-Line Format | --innodb_rollback_segments=# |
||
Option-File Format | innodb_rollback_segments |
||
System Variable Name | innodb_rollback_segments
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 128 |
||
Range | 1 .. 128 |
Defines how many of the rollback segments in the system
tablespace that InnoDB uses within a transaction. This setting, while
still valid, is replaced by innodb_undo_logs
.
Introduced | 5.6.4 | ||
Command-Line Format | --innodb_sort_buffer_size=# |
||
Option-File Format | innodb_sort_buffer_size |
||
System Variable Name | innodb_sort_buffer_size
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values (>= 5.6.4) | |||
Type | numeric |
||
Default | 1048576 |
||
Range | 524288 .. 67108864 |
||
Permitted Values (>= 5.6.5) | |||
Type | numeric |
||
Default | 1048576 |
||
Range | 65536 .. 67108864 |
Specifies the sizes of several buffers used for sorting data during creation of an InnoDB
index. Before this setting was made configurable, the size was
hardcoded to 1MB, and that value remains the default. This sort area is only used for merge sorts
during index creation, not during later index maintenance operations. During an ALTER TABLE
or CREATE TABLE
statement that creates an index, 3 buffers are
allocated, each with a size defined by this option. These buffers are deallocated when the index
creation completes.
The value of this option also controls the amount by which the temporary log file is extended, to record concurrent DML during online DDL operations.
Command-Line Format | --innodb_spin_wait_delay=# |
||
Option-File Format | innodb_spin_wait_delay |
||
System Variable Name | innodb_spin_wait_delay
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 6 |
||
Range | 0 .. 4294967295 |
The maximum delay between polls for a spin lock. The low-level implementation of this mechanism varies depending on the combination of hardware and operating system, so the delay does not correspond to a fixed time interval. The default value is 6.
Introduced | 5.6.6 | ||
Command-Line Format | --innodb_stats_auto_recalc=# |
||
Option-File Format | innodb_stats_auto_recalc |
||
System Variable Name | innodb_stats_auto_recalc
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | boolean |
||
Default | ON |
Causes InnoDB
to automatically recalculate persistent
statistics after the data in a table is changed substantially. The threshold value is currently
10% of the rows in the table. This setting applies to tables created when the innodb_stats_persistent
option is enabled, or where the clause
STATS_PERSISTENT=1
is enabled by a CREATE TABLE
or ALTER TABLE
statement. The amount of data sampled to produce the
statistics is controlled by the innodb_stats_persistent_sample_pages
configuration option.
Introduced | 5.6.2 | ||
Command-Line Format | --innodb_stats_method=name |
||
Option-File Format | innodb_stats_method |
||
System Variable Name | innodb_stats_method
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | enumeration |
||
Default | nulls_equal |
||
Valid Values | nulls_equal |
||
nulls_unequal |
|||
nulls_ignored |
How the server treats NULL
values when collecting statistics
about the distribution of index values for InnoDB
tables. This variable
has three possible values, nulls_equal
, nulls_unequal
,
and nulls_ignored
. For nulls_equal
, all
NULL
index values are considered equal and form a single value group
that has a size equal to the number of NULL
values. For nulls_unequal
, NULL
values are
considered unequal, and each NULL
forms a distinct value group of size
1. For nulls_ignored
, NULL
values are
ignored.
The method that is used for generating table statistics influences how the optimizer chooses indexes
for query execution, as described in Section
8.3.7, "InnoDB
and MyISAM
Index
Statistics Collection".
Command-Line Format | --innodb_stats_on_metadata |
||
Option-File Format | innodb_stats_on_metadata |
||
System Variable Name | innodb_stats_on_metadata
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values (<= 5.6.5) | |||
Type | boolean |
||
Default | ON |
||
Permitted Values (>= 5.6.6) | |||
Type | boolean |
||
Default | OFF |
When this variable is enabled, InnoDB
updates statistics
during metadata statements such as SHOW TABLE STATUS
or SHOW INDEX
, or when accessing the INFORMATION_SCHEMA
tables TABLES
or STATISTICS
.
(These updates are similar to what happens for ANALYZE TABLE
.) When disabled, InnoDB
does not update statistics during these operations. Leaving
this setting disabled can improve access speed for schemas that have a large number of tables or
indexes. It can also improve the stability of execution plans
for queries that involve InnoDB
tables.
This variable is disabled by default as of MySQL 5.6.6, enabled before that.
Introduced | 5.6.6 | ||
Command-Line Format | --innodb_stats_persistent=setting |
||
Option-File Format | innodb_stats_persistent |
||
System Variable Name | innodb_stats_persistent
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | boolean |
||
Default | ON |
||
Valid Values | OFF |
||
ON |
|||
0 |
|||
1 |
|||
default |
Specifies whether the InnoDB
index statistics produced by the ANALYZE TABLE
command are stored on disk, remaining consistent until a
subsequent ANALYZE TABLE
. Otherwise, the statistics are recalculated
more frequently, such as at each server restart, which can lead to variations in query
execution plans. This setting is stored with each table when the table is created. You can
specify or change it through SQL with the STATS_PERSISTENT
clause of
the CREATE TABLE
and ALTER TABLE
commands.
innodb_stats_persistent_sample_pages
Introduced | 5.6.2 | ||
Command-Line Format | --innodb_stats_persistent_sample_pages=# |
||
Option-File Format | innodb_stats_persistent_sample_pages |
||
System Variable Name | innodb_stats_persistent_sample_pages
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 20 |
The number of index pages to sample
when estimating cardinality
and other statistics for
an indexed column, such as those calculated by ANALYZE TABLE
. Increasing the value improves the accuracy of
index statistics, which can improve the query execution plan, at
the expense of increased I/O during the execution of ANALYZE TABLE
for an InnoDB
table.
This option only applies when the innodb_stats_persistent
setting is turned on for a table; when that
option is turned off for a table, the innodb_stats_transient_sample_pages
setting applies instead.
Deprecated | 5.6.3 | ||
Command-Line Format | --innodb_stats_sample_pages=# |
||
Option-File Format | innodb_stats_sample_pages |
||
System Variable Name | innodb_stats_sample_pages
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 8 |
||
Range | 1 .. 2**64-1 |
Deprecated, use innodb_stats_transient_sample_pages
instead.
innodb_stats_transient_sample_pages
Introduced | 5.6.2 | ||
Command-Line Format | --innodb_stats_transient_sample_pages=# |
||
Option-File Format | innodb_stats_transient_sample_pages |
||
System Variable Name | innodb_stats_transient_sample_pages
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 8 |
The number of index pages to sample
when estimating cardinality
and other statistics for
an indexed column, such as those calculated by ANALYZE TABLE
. The default value is 8. Increasing the value
improves the accuracy of index statistics, which can improve the query
execution plan, at the expense of increased I/O when opening an InnoDB
table or recalculating statistics.
This option only applies when the innodb_stats_persistent
setting is turned off for a table; when this
option is turned on for a table, the innodb_stats_persistent_sample_pages
setting applies instead.
Takes the place of the innodb_stats_sample_pages
option. For more
information, see Section
14.2.5, "InnoDB
Features for Flexibility, Ease of Use and
Reliability".
Command-Line Format | --innodb_strict_mode=# |
||
Option-File Format | innodb_strict_mode |
||
System Variable Name | innodb_strict_mode
|
||
Variable Scope | Global, Session | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | boolean |
||
Default | OFF |
Whether InnoDB
returns errors rather than warnings for certain
conditions. This is analogous to strict SQL mode. The default value is OFF
. See Section 14.2.5.7,
"InnoDB
Strict Mode" for a list of the conditions that are
affected.
Command-Line Format | --innodb_support_xa |
||
Option-File Format | innodb_support_xa |
||
System Variable Name | innodb_support_xa
|
||
Variable Scope | Global, Session | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | boolean |
||
Default | TRUE |
Enables InnoDB
support for two-phase commit in XA
transactions, causing an extra disk flush for transaction preparation. This setting is the default.
The XA mechanism is used internally and is essential for any server that has its binary log turned
on and is accepting changes to its data from more than one thread. If you turn it off, transactions
can be written to the binary log in a different order from the one in which the live database is
committing them. This can produce different data when the binary log is replayed in disaster
recovery or on a replication slave. Do not turn it off on a replication master server unless you
have an unusual setup where only one thread is able to change data.
For a server that is accepting data changes from only one thread, it is safe and recommended to turn
off this option to improve performance for InnoDB
tables. For example,
you can turn it off on replication slaves where only the replication SQL thread is changing data.
You can also turn off this option if you do not need it for safe binary logging or replication, and you also do not use an external XA transaction manager.
Introduced | 5.6.3 | ||
Command-Line Format | --innodb_sync_array_size=# |
||
Option-File Format | innodb_sync_array_size |
||
System Variable Name | innodb_sync_array_size
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | numeric |
||
Default | 1 |
||
Range | 1 .. 1024 |
Splits an internal data structure used to coordinate threads, for higher concurrency in workloads with large numbers of waiting threads. This setting must be configured when the MySQL instance is starting up, and cannot be changed afterward. Increasing this option value is recommended for workloads that frequently produce a large number of waiting threads, typically greater than 768.
Command-Line Format | --innodb_sync_spin_loops=# |
||
Option-File Format | innodb_sync_spin_loops |
||
System Variable Name | innodb_sync_spin_loops
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 30 |
||
Range | 0 .. 4294967295 |
The number of times a thread waits for an InnoDB
mutex to be freed
before the thread is suspended. The default value is 30.
Command-Line Format | --innodb_table_locks |
||
Option-File Format | innodb_table_locks |
||
System Variable Name | innodb_table_locks
|
||
Variable Scope | Global, Session | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | boolean |
||
Default | TRUE |
If autocommit
= 0
, InnoDB
honors LOCK TABLES
; MySQL does not return from LOCK
TABLES ... WRITE
until all other threads have released all their locks to the table. The
default value of innodb_table_locks
is 1, which means that LOCK TABLES
causes InnoDB to lock a table internally if autocommit
= 0
.
In MySQL 5.6, innodb_table_locks = 0
has no effect for tables locked explicitly
with LOCK TABLES ...
WRITE
. It does have an effect for tables locked for read or write by LOCK TABLES ... WRITE
implicitly (for example, through triggers)
or by LOCK TABLES ...
READ
.
Command-Line Format | --innodb_thread_concurrency=# |
||
Option-File Format | innodb_thread_concurrency |
||
System Variable Name | innodb_thread_concurrency
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 0 |
||
Range | 0 .. 1000 |
InnoDB
tries to keep the number of operating system threads concurrently
inside InnoDB
less than or equal to the limit given by this variable.
Once the number of threads reaches this limit, additional threads are placed into a wait state
within a FIFO queue for execution. Threads waiting for locks are not counted in the number of
concurrently executing threads.
The correct value for this variable is dependent on environment and workload. Try a range of different values to determine what value works for your applications. A recommended value is 2 times the number of CPUs plus the number of disks.
The range of this variable is 0 to 1000. A value of 0 (the default) is interpreted as infinite
concurrency (no concurrency checking). Disabling thread concurrency checking enables InnoDB to
create as many threads as it needs. A value of 0 also disables the queries
inside InnoDB
and queries in queue counters
in the ROW OPERATIONS
section of SHOW ENGINE INNODB
STATUS
output.
Command-Line Format | --innodb_thread_sleep_delay=# |
||
Option-File Format | innodb_thread_sleep_delay |
||
System Variable Name | innodb_thread_sleep_delay
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 10000 |
How long InnoDB
threads sleep before joining the InnoDB
queue, in microseconds. The default value is 10,000. A value of 0 disables sleep. In MySQL 5.6.3 and
higher, you can set the configuration option innodb_adaptive_max_sleep_delay
to the highest value you would
allow for innodb_thread_sleep_delay
, and InnoDB automatically adjusts
innodb_thread_sleep_delay
up or down depending on the current
thread-scheduling activity. This dynamic adjustment helps the thread scheduling mechanism to work
smoothly during times when the system is lightly loaded and when it is operating near full capacity.
Introduced | 5.6.3 | ||
Command-Line Format | --innodb_undo_directory=name |
||
Option-File Format | innodb_undo_directory |
||
System Variable Name | innodb_undo_directory
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | string |
||
Default | . |
The relative or absolute directory path where InnoDB
creates separate
tablespaces for the undo logs. Typically used to place those logs on a different storage device.
Used in conjunction with innodb_undo_logs
and innodb_undo_tablespaces
, which determine the disk layout of the
undo logs outside the system tablespace. Its default value of .
represents the same directory where InnoDB
creates its other log files by default.
Introduced | 5.6.3 | ||
Command-Line Format | --innodb_undo_logs=# |
||
Option-File Format | innodb_undo_logs |
||
System Variable Name | innodb_undo_logs
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Type | numeric |
||
Default | 128 |
||
Range | 0 .. 128 |
Defines how many of the rollback segments in the system
tablespace that InnoDB
uses within a transaction.
This setting is appropriate for tuning performance if you observe mutex contention related to the
undo logs. Replaces the innodb_rollback_segments
setting. For the total
number of available undo logs, rather than the number of active ones, see the Innodb_available_undo_logs
status variable.
Although you can increase or decrease how many rollback segments are used within a transaction, the
number of rollback segments physically present in the system never decreases. Thus you might start
with a low value for this parameter and gradually increase it, to avoid allocating rollback segments
that are not needed later. If innodb_undo_logs
is not set, it defaults to the maximum value of
128. For information about managing rollback segments, see Section
14.2.3.11, "InnoDB
Multi-Versioning".
Introduced | 5.6.3 | ||
Command-Line Format | --innodb_undo_tablespaces=# |
||
Option-File Format | innodb_undo_tablespaces |
||
System Variable Name | innodb_undo_tablespaces
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | numeric |
||
Default | 0 |
||
Range | 0 .. 126 |
The number of tablespace
files that the undo logs are
divided between, when you use a non-zero innodb_undo_logs
setting. By default, all the undo logs are part
of the system
tablespace and the system tablespace will always contain one undo tablespace in addition to
those configured by innodb_undo_tablespaces
. Because the undo logs can become large
during long-running transactions, splitting the undo logs between multiple tablespaces reduces the
maximum size of any one tablespace. The tablespace files are created in the location defined by innodb_undo_directory
,
with names of the form undo
,
where N
N
is a sequential series of integers, including
leading zeros. The default size of undo tablespaces files is 10M. The number of innodb_undo_tablespaces
must be set prior to initializing InnoDB
. Attempting to restart InnoDB
after changing the number of innodb_undo_tablespaces
will result in a failed start with an
error stating that InnoDB did not find the expected number of undo tablespaces.
Command-Line Format | --innodb_use_native_aio=# |
||
Option-File Format | innodb_use_native_aio |
||
System Variable Name | innodb_use_native_aio
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | boolean |
||
Default | ON |
Specifies whether to use the Linux asynchronous I/O subsystem. This variable applies to Linux systems only, and cannot be changed while the server is running.
Normally, you do not need to touch this option, because it is enabled by default. If a problem with
the asynchronous I/O subsystem in the OS prevents InnoDB
from starting,
start the server with this variable disabled (use innodb_use_native_aio=0
in the option file). This option could
also be turned off automatically during startup, if InnoDB
detects a
potential problem such as a combination of tmpdir
location, tmpfs
filesystem, and Linux kernel that that does not support AIO on
tmpfs
.
Deprecated | 5.6.3 | ||
Command-Line Format | --innodb_use_sys_malloc=# |
||
Option-File Format | innodb_use_sys_malloc |
||
System Variable Name | innodb_use_sys_malloc
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | boolean |
||
Default | ON |
Whether InnoDB
uses the operating system memory allocator (ON
) or its own (OFF
). The default value is
ON
.
As of MySQL 5.6.3, innodb_use_sys_malloc
is deprecated and will be removed in a future
MySQL release.
The InnoDB
version number. Starting in 5.6.11, the separate numbering
for InnoDB
is discontinued and this value is the same as for the version
variable.
Command-Line Format | --innodb_write_io_threads=# |
||
Option-File Format | innodb_write_io_threads |
||
System Variable Name | innodb_write_io_threads
|
||
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | |||
Type | numeric |
||
Default | 4 |
||
Range | 1 .. 64 |
The number of I/O threads for write operations in InnoDB
. The default
value is 4. Its counterpart for read threads is innodb_read_io_threads
. For general I/O tuning advice, see Section 8.5.7, "Optimizing InnoDB
Disk I/O".
On Linux systems, running multiple MySQL servers (typically more than 12) with default
settings for innodb_read_io_threads
, innodb_write_io_threads
,
and the Linux aio-max-nr
setting can exceed system limits. Ideally,
increase the aio-max-nr
setting; as a workaround, you might reduce
the settings for one or both of the MySQL configuration options.
sync_binlog
Command-Line Format | --sync-binlog=# |
||
Option-File Format | sync_binlog |
||
System Variable Name | sync_binlog
|
||
Variable Scope | Global | ||
Dynamic Variable | Yes | ||
Permitted Values | |||
Platform Bit Size | 32 |
||
Type | numeric |
||
Default | 0 |
||
Range | 0 .. 4294967295 |
||
Permitted Values | |||
Platform Bit Size | 64 |
||
Type | numeric |
||
Default | 0 |
||
Range | 0 .. 18446744073709547520 |
If the value of this variable is greater than 0, the MySQL server synchronizes its binary log to
disk (using fdatasync()
) after every sync_binlog
writes to the binary log. There is one write to the
binary log per statement if autocommit is enabled, and one write per transaction otherwise. The
default value of sync_binlog
is 0, which does no synchronizing to disk. A value of 1 is the safest choice, because in the event
of a crash you lose at most one statement or transaction from the binary log. However, it is also
the slowest choice (unless the disk has a battery-backed cache, which makes synchronization very
fast). For general I/O tuning advice, see Section
8.5.7, "Optimizing InnoDB
Disk I/O".