Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Discover InnoDB, the default storage engine for MariaDB Server. Learn about its transaction-safe capabilities, foreign key support, and high performance for demanding workloads.
The doublewrite buffer is a storage area where InnoDB writes pages before writing them to the data file, preventing data corruption from partial page writes.
The InnoDB doublewrite buffer was implemented to recover from half-written pages. This can happen when there's a power failure while InnoDB is writing a page to disk. On reading that page, InnoDB can discover the corruption from the mismatch of the page checksum. However, in order to recover, an intact copy of the page would be needed.
The double write buffer provides such a copy.
Whenever InnoDB flushes a page to disk, it is first written to the double write buffer. Only when the buffer is safely flushed to disk will InnoDB write the page to the final destination. When recovering, InnoDB scans the double write buffer and for each valid page in the buffer checks if the page in the data file is valid too.
To turn off the doublewrite buffer, set the system variable to 0. This is safe on filesystems that write pages atomically - that is, a page write fully succeeds or fails. But with other filesystems, it is not recommended for production systems. An alternative option is atomic writes. See for more details.
This page is licensed: CC BY-SA / Gnu FDL
InnoDB Monitors, such as the Standard, Lock, and Tablespace monitors, provide detailed internal state information to the error log for diagnostics.
The InnoDB Monitor refers to particular kinds of monitors included in MariaDB and since the early versions of MySQL.
There are four types: the standard InnoDB monitor, the InnoDB Lock Monitor, InnoDB Tablespace Monitor and the InnoDB Table Monitor.
The standard InnoDB Monitor returns extensive InnoDB information, particularly lock, semaphore, I/O and buffer activity:
To enable the standard InnoDB Monitor, from , set the innodb_status_output system variable to 1. Before , running the following statement was the method used:
To disable the standard InnoDB monitor, either set the system variable to zero, or, before , drop the table
The CREATE TABLE and DROP TABLE method of enabling and disabling the InnoDB Monitor has been deprecated, and may be removed in a future version of MariaDB.
For a description of the output, see .
The InnoDB Lock Monitor displays additional lock information.
To enable the InnoDB Lock Monitor, the standard InnoDB monitor must be enabled. Then, from , set the system variable to 1. Before , running the following statement was the method used:
To disable the standard InnoDB monitor, either set the system variable to zero, or, before , drop the table
The CREATE TABLE and DROP TABLE method of enabling and disabling the InnoDB Lock Monitor has been deprecated, and may be removed in a future version of MariaDB.
The InnoDB Tablespace Monitor is deprecated, and may be removed in a future version of MariaDB.
Enabling the Tablespace Monitor outputs a list of file segments in the shared tablespace to the error log, and validates the tablespace allocation data structures.
To enable the Tablespace Monitor, run the following statement:
To disable it, drop the table:
The InnoDB Table Monitor is deprecated, and may be removed in a future version of MariaDB.
Enabling the Table Monitor outputs the contents of the InnoDB internal data dictionary to the error log every fifteen seconds.
To enable the Table Monitor, run the following statement:
To disable it, drop the table:
The statement can be used to obtain the standard InnoDB Monitor output when required, rather than sending it to the error log. It will also display the InnoDB Lock Monitor information if the system variable is set to 1.
This page is licensed: CC BY-SA / Gnu FDL
Understand how group commit works with InnoDB to improve performance by reducing the number of disk syncs required during transaction commits.
When both innodb_flush_log_at_trx_commit=1 (the default) is set and the binary log is enabled, there is now one less sync to disk inside InnoDB during commit (2 syncs shared between a group of transactions instead of 3).
Durability of commits is not decreased — this is because even if the server crashes before the commit is written to disk by InnoDB, it are recovered from the binary log at next server startup (and it is guaranteed that sufficient information is synced to disk so that such a recovery is always possible).
The old behavior, with 3 syncs to disk per (group) commit (and consequently lower performance), can be selected with the new option. There is normally no benefit to doing this, however there are a couple of edge cases to be aware of.
If is set and the is enabled, but is set, then commits are not guaranteed durable inside InnoDB after commit. This is because if is set and if the server crashes, then transactions that were not flushed to the binary log prior to the crash are missing from the binary log.
In this specific scenario, can be set to ensure that transactions are durable in InnoDB, even if they are not necessarily durable from the perspective of the binary log.
One should be aware that if is set, then a crash is nevertheless likely to cause transactions to be missing from the binary log. This will cause the binary log and InnoDB to be inconsistent with each other. This is also likely to cause any to become inconsistent, since transactions are replicated through the . Thus it is recommended to set . With the improvements introduced in , this setting has much less penalty in recent versions compared to older versions of MariaDB and MySQL.
and only see transactions that have been flushed to the . With the improvements, there may be a small delay (defined by the system variable) between when a commit happens and when the commit are included in a backup.
Note that the backup will still be fully consistent with itself and the . This problem is normally not an issue in practice. A backup usually takes a long time to complete (relative to the 1 second or so that is normally set to), and a backup usually includes a lot of transactions that were committed during the backup. With this in mind, it is not generally noticeable if the backup does not include transactions that were committed during the last 1 second or so of the backup process. It is just mentioned here for completeness.
This page is licensed: CC BY-SA / Gnu FDL
Learn about the specialized I/O threads in MariaDB Enterprise Server's InnoDB engine that handle asynchronous read and write operations efficiently.
Starting with MariaDB Enterprise Server 10.5 and MariaDB Community Server 10.5, the InnoDB I/O Threads were replaced by the asynchronous I/O functionality in the InnoDB Background Thread Pool.
This page is: Copyright © 2025 MariaDB. All rights reserved.
This feature allows for the secure deletion of data by overwriting deleted records in tablespaces and logs to prevent data recovery.
Most of the background and redo log scrubbing code has been removed in . See and .
Sometimes there is a requirement that when some data is deleted, it is really gone. This might be the case when one stores user's personal information or some other sensitive data. Normally though, when a row is deleted, the space is only marked as free on the page. It may eventually be overwritten, but there is no guarantee when that will happen. A copy of the deleted rows may also be present in the log files.
Support for data scrubbing: Background threads periodically scan tablespaces and logs and remove all data that should be deleted. The number of background threads for tablespace scans is set by . Log scrubbing happens in a separate thread.
To configure scrubbing one can use the following variables:
Learn about the different file formats supported by InnoDB, such as Antelope and Barracuda, and how they impact table features and storage.
An overview of the InnoDB storage engine, detailing its support for ACID transactions, row-level locking, and crash recovery.
InnoDB employs Row-Level Locking with Shared (S) and Exclusive (X) locks, along with Intention locks, to manage concurrent transaction access.
Locks are acquired by a transaction to prevent concurrent transactions from modifying, or even reading, some rows or ranges of rows. This is done to make sure that concurrent write operations never collide.
supports a number of lock modes.
The two standard row-level locks are share locks(S) and exclusive locks(X).
A shared lock is obtained to read a row, and allows other transactions to read the locked row, but not to write to the locked row. Other transactions may also acquire their own shared locks.
CREATE TABLE innodb_monitor (a INT) ENGINE=INNODB;Troubleshoot InnoDB issues in MariaDB Server. Find solutions and best practices for common problems, ensuring your InnoDB-based applications run smoothly and efficiently.
Explore InnoDB row formats in MariaDB Server. Understand different formats like Compact, Dynamic, and Compressed, and how they impact storage efficiency and performance for your data.
Manage InnoDB tablespaces in MariaDB Server. Understand their role in data organization, performance, and recovery, including file-per-table and shared tablespaces.
Quantity
Set by and
Thread
InnoDB I/O Threads
Storage Engine
InnoDB
Purpose
Reading data from disk / Writing data to disk
Availability
Seconds
Check at this intervall if tablespaces needs scrubbing. Deprecated and ignored.
Boolean
Enable scrubbing of compressed data by background threads. Deprecated and ignored.
Seconds
Scrub spaces that were last scrubbed longer than this many seconds ago. Deprecated and ignored.
Boolean
Enable scrubbing of uncompressed data by background threads. Deprecated and ignored.
Boolean
Enable scrubbing of uncompressed data.
Redo log scrubbing did not fully work as intended, and was deprecated and ignored in (MDEV-21870). If old log contents should be kept secret, enabling innodb_encrypt_log or setting a smaller innodb_log_file_size could help.
The Information Schema INNODB_TABLESPACES_SCRUBBING table contains scrubbing information.
Scrubbing was donated to the MariaDB project by Google.
This page is licensed: CC BY-SA / Gnu FDL
The InnoDB storage engine supports two different file formats:
Antelope
Barracuda
In and before, the default file format is Antelope. In and later, the Antelope file format is deprecated.
Antelope is the original InnoDB file format. It supports the COMPACT and REDUNDANT row formats, but not the DYNAMIC or COMPRESSED row formats.
In and before, the Barracuda file format is only supported if the innodb_file_per_table system variable is set to ON. In and later, the default file format is Barracuda and Antelope is deprecated.
Barracuda is a newer InnoDB file format. It supports the COMPACT, REDUNDANT, DYNAMIC and COMPRESSED row formats. Tables with large BLOB or TEXT columns in particular could benefit from the dynamic row format.
InnoDB might use new file formats in the future. Each format will have an identifier from 0 to 25, and a name. The names have already been decided, and are animal names listed in an alphabetical order: Antelope, Barracuda, Cheetah, Dragon, Elk, Fox, Gazelle, Hornet, Impala, Jaguar, Kangaroo, Leopard, Moose, Nautilus, Ocelot, Porpoise, Quail, Rabbit, Shark, Tiger, Urchin, Viper, Whale, Xenops, Yak and Zebra.
The information_schema.INNODB_SYS_TABLES table can be queried to see the file format used by a table.
A table's tablespace is tagged with the lowest InnoDB file format that supports the table's row format. So, even if the Barracuda file format is enabled, tables that use the COMPACT or REDUNDANT row formats are tagged with the Antelope file format in the information_schema.INNODB_SYS_TABLES table.
Each tablespace is tagged with the id of the most recent file format used by one of its tables. All versions of InnoDB can read tables that use an older file format. However, it can not read from more recent formats. For this reason, each time InnoDB opens a table it checks the tablespace's format, and returns an error if a newer format is used.
This check can be skipped via the innodb_file_format_check variable. Beware that, is InnoDB tries to repair a table in an unknown format, the table are corrupted! This happens on restart if innodb_file_format_check is disabled and the server crashed, or it was closed with fast shutdown.
To downgrade a table from the Barracuda format to Antelope, the table's ROW_FORMAT can be set to a value supported by Antelope, via an ALTER TABLE statement. This recreates the indexes.
The Antelope format can be used to make sure that tables work on MariaDB and MySQL servers which are older than 5.5.
This page is licensed: CC BY-SA / Gnu FDL
Is available with all versions of and MariaDB Community Server.
Is a general purpose storage engine.
Is transactional and well-suited for online transactional processing (OLTP) workloads.
Is ACID-compliant.
Performs well for mixed read-write workloads.
Supports online DDL.
Storage Engine
InnoDB
Availability
All ES and CS versions
Workload Optimization
Transactional
Table Orientation
Row
Background Thread Pool
This page is: Copyright © 2025 MariaDB. All rights reserved.
InnoDB also permits table locking, and to allow locking at both table and row level to co-exist gracefully, a series of locks called intention locks exist.
An intention shared lock(IS) indicates that a transaction intends to set a shared lock.
An intention exclusive lock(IX) indicates that a transaction intends to set an exclusive lock.
Whether a lock is granted or not can be summarised as follows:
An X lock is not granted if any other lock (X, S, IX, IS) is held.
An S lock is not granted if an X or IX lock is held. It is granted if an S or IS lock is held.
An IX lock is not granted if in X or S lock is held. It is granted if an IX or IS lock is held.
An IS lock is not granted if an X lock is held. It is granted if an S, IX or IS lock is held.
Locks are also required for auto-increments - see AUTO_INCREMENT handling in InnoDB.
With the default isolation level, REPEATABLE READ, and, until , the default setting of the innodb_locks_unsafe_for_binlog variable, a method called gap locking is used. When InnoDB sets a shared or exclusive lock on a record, it's actually on the index record. Records will have an internal InnoDB index even if they don't have a unique index defined. At the same time, a lock is held on the gap before the index record, so that another transaction cannot insert a new index record in the gap between the record and the preceding record.
The gap can be a single index value, multiple index values, or not exist at all depending on the contents of the index.
If a statement uses all the columns of a unique index to search for unique row, gap locking is not used.
Similar to the shared and exclusive intention locks described above, there can be a number of types of gap locks. These include the shared gap lock, exclusive gap lock, intention shared gap lock and intention exclusive gap lock.
Gap locks are disabled if the innodb_locks_unsafe_for_binlog system variable is set (until ), or the isolation level is set to READ COMMITTED.
This page is licensed: CC BY-SA / Gnu FDL
Learn about the change buffer, an optimization that delays secondary index writes to reduce I/O overhead for non-unique index modifications.
The change buffer has been disabled by default from , MariaDB 10.6.7, and (MDEV-27734), was deprecated and ignored from (MDEV-27735), and was removed in (MDEV-29694).
Benchmarks attached to MDEV-19514 show that the change buffer sometimes reduces performance, and in the best case seem to bring a few per cent improvement to throughput. However, such improvement could come with a price: If the buffered changes are never merged (MDEV-19514, motivated by the reduction of random crashes and the removal of an innodb_force_recovery option that can inflict further corruption), then the InnoDB system tablespace can grow out of control (MDEV-21952).
INSERT, UPDATE, and DELETE statements can be particularly heavy operations to perform, as all indexes need to be updated after each change. For this reason these changes are often buffered.
Pages are modified in the , and not immediately on disk. After all the records that cover the changes to a data page have been written to the InnoDB redo log, the changed page may be written (''flushed'') to a data file. Pages that have been modified in memory and not yet flushed are called dirty pages.
The Change Buffer is an optimization that allows some data to be modified even though the data page does not exist in the buffer pool. Instead of modifying the data in its final destination, we would insert a record into a special Change Buffer that resides in the system tablespace. When the page is read into the buffer pool for any reason, the buffered changes are applied to it.
The Change Buffer only contains changes to secondary index leaf pages.
In the days of old, only inserted rows could be buffered, so this buffer was called Insert Buffer. The old name still appears in several places, for example in the output of .
Inserts to UNIQUE secondary indexes cannot be buffered unless is used. This may sometimes allow duplicates to be inserted into the UNIQUE secondary index. Much of the time, the UNIQUE constraint would be checked because the change buffer could only be used if the index page is not located in the buffer pool.
When rows are deleted, a flag is set, thus rows are not immediately deleted. Delete-marked records may be purged after the transaction has been committed and any read views that were created before the commit have been closed. Delete-mark and purge buffering of any secondary indexes is allowed.
ROLLBACK never makes use of the change buffer; it would force a merge of any changes that were buffered during the execution of the transaction.
The Change Buffer is an optimization because:
Some random-access page reads are transformed into modifications of change buffer pages.
A change buffer page can be modified several times in memory and be flushed to disk only once.
Dirty pages are flushed together, so the number of IO operations is lower.
If the server crashes or is shut down, the Change Buffer might not be empty. The Change Buffer resides in the InnoDB system tablespace, covered by the write-ahead log, so they can be applied at server restart. A shutdown with will merge all buffered changes.
There is no background task that merges the change buffer to the secondary index pages. Changes are only merged on demand.
The Change Buffer was removed in because it has been a prominent source of corruption bugs that have been extremely hard to reproduce.
The main server system variable here is , which determines which form of change buffering, if any, to use.
The following settings are available:
inserts
Only buffer insert operations
deletes
Only buffer delete operations
Modifying the value of this variable only affects the buffering of new operations. The merging of already buffered changes is not affected.
The system variable determines the maximum size of the change buffer, expressed as a percentage of the buffer pool.
This page is licensed: CC BY-SA / Gnu FDL
Learn about the background processes that flush dirty pages from the buffer pool to disk, including adaptive flushing algorithms to optimize I/O.
InnoDB page cleaner threads flush dirty pages from the InnoDB buffer pool. These dirty pages are flushed using a least-recently used (LRU) algorithm.
The variable specifies the maximum percentage of unwritten (dirty) pages in the . If this percentage is exceeded, flushing will take place.
The variable determines the low-water mark percentage of dirty pages that will enable preflushing to lower the dirty page ratio. The value 0 (the default) means that there are no separate background flushing so long as:
the share of dirty pages does not exceed
the last checkpoint age (LSN difference since the latest checkpoint) does not exceed (minus some safety margin)
the is not running out of space, which could trigger eviction flushing
To make flushing more eager, set to a higher value, for example SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.001;
The system variable makes it possible to use multiple InnoDB page cleaner threads. It is deprecated and ignored now as the original reasons for splitting the buffer pool have mostly gone away.
The number of InnoDB page cleaner threads can be configured by setting the system variable. The system variable can be set in a server in an prior to starting up the server:
The system variable can be changed dynamically with :
This system variable's default value is either 4 or the configured value of the system variable, whichever is lower.
Since the original reasons for splitting the buffer pool have mostly gone away, only a single InnoDB page cleaner thread is supported.
InnoDB's multi-thread flush feature can be enabled by setting the system variable. The number of threads cane be configured by setting the system variable. This system variable can be set in a server in an prior to starting up the server:
The system variable's default value is 8. The maximum value is 64. In multi-core systems, it is recommended to set its value close to the configured value of the system variable. However, it is also recommended to use your own benchmarks to find a suitable value for your particular application.
InnoDB's multi-thread flush feature is deprecated. Use multiple InnoDB page cleaner threads instead.
Increasing the amount of I/O capacity available to InnoDB can also help increase the performance of page flushing.
The amount of I/O capacity available to InnoDB can be configured by setting the system variable. This system variable can be changed dynamically with :
This system variable can also be set in a server in an prior to starting up the server:
The maximum amount of I/O capacity available to InnoDB in an emergency defaults to either 2000 or twice , whichever is higher, or can be directly configured by setting the system variable. This system variable can be changed dynamically with :
This system variable can also be set in a server in an prior to starting up the server:
This page is licensed: CC BY-SA / Gnu FDL
This page explains how InnoDB manages AUTO_INCREMENT columns, including initialization behavior, gap handling, and potential restart effects.
A comprehensive guide to the InnoDB Buffer Pool, the key memory area for caching data and indexes, including configuration and resizing tips.
The InnoDB storage engine in MariaDB Enterprise Server utilizes the Buffer Pool as a crucial in-memory cache. This Buffer Pool stores recently accessed data pages, enabling faster retrieval for subsequent requests. Recognizing patterns of access, InnoDB also employs predictive prefetching, caching nearby pages when sequential access is detected. To manage memory efficiently, a least recently used (LRU) algorithm is used to evict older, less frequently accessed pages.
To optimize server restarts, the Buffer Pool's contents can be preserved across shutdowns. At shutdown, the page numbers of all pages residing in the Buffer Pool are recorded. Upon the next startup, InnoDB reads this dump of page numbers and reloads the corresponding data pages from their respective data files, effectively avoiding a "cold" cache scenario.
The size of each individual page within the Buffer Pool is determined by the setting of the innodb_page_size system variable.
Explore how InnoDB uses asynchronous I/O on various operating systems to handle multiple read and write requests concurrently without blocking.
[mariadb]
...
innodb_read_io_threads=8
innodb_write_io_threads=8SET GLOBAL innodb_read_io_threads=8;
SET GLOBAL innodb_write_io_threads=8;
SHOW GLOBAL VARIABLES
LIKE 'innodb_%_io_threads';+-------------------------+-------+
| Variable_name | Value |
+-------------------------+-------+
| innodb_read_io_threads | 8 |
| innodb_write_io_threads | 8 |
+-------------------------+-------+CREATE DATABASE hq_sales;CREATE TABLE hq_sales.invoices (
invoice_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL,
branch_id INT NOT NULL,
customer_id INT,
invoice_date DATETIME(6),
invoice_total DECIMAL(13, 2),
payment_method ENUM('NONE', 'CASH', 'WIRE_TRANSFER', 'CREDIT_CARD', 'GIFT_CARD'),
PRIMARY KEY(invoice_id)
) ENGINE = InnoDB;SELECT TABLE_SCHEMA, TABLE_NAME, ENGINE
FROM information_schema.TABLES
WHERE TABLE_SCHEMA='hq_sales'
AND TABLE_NAME='invoices';
+--------------+------------+--------+
| TABLE_SCHEMA | TABLE_NAME | ENGINE |
+--------------+------------+--------+
| hq_sales | invoices | InnoDB |
+--------------+------------+--------+DROP TABLE innodb_monitor;CREATE TABLE innodb_lock_monitor (a INT) ENGINE=INNODB;DROP TABLE innodb_lock_monitor;CREATE TABLE innodb_tablespace_monitor (a INT) ENGINE=INNODB;DROP TABLE innodb_tablespace_monitor;CREATE TABLE innodb_table_monitor (a INT) ENGINE=INNODB;DROP TABLE innodb_table_monitor;Understand InnoDB's architecture for MariaDB Enterprise Server. This section details its components and their interactions, focusing on performance, scalability, and reliability for enterprise workloa
Learn about InnoDB operations in MariaDB Enterprise Server. This section covers critical management tasks, including configuration, performance tuning, and troubleshooting for enterprise-grade deploym
The buffer pool attempts to keep frequently-used blocks in the buffer, and so essentially works as two sublists, a new sublist of recently-used information, and an old sublist of older information. By default, 37% of the list is reserved for the old list.
When new information is accessed that doesn't appear in the list, it is placed at the top of the old list, the oldest item in the old list is removed, and everything else bumps back one position in the list.
When information is accessed that appears in the old list, it is moved to the top the new list, and everything above moves back one position.
The most important server system variable is innodb_buffer_pool_size. This size should contain most of the active data set of your server so that SQL request can work directly with information in the buffer pool cache. Starting at several gigabytes of memory is a good starting point if you have that RAM available. Once warmed up to its normal load there should be very few innodb_buffer_pool_reads compared to innodb_buffer_pool_read_requests. Look how these values change over a minute. If the change in innodb_buffer_pool_reads is less than 1% of the change in innodb_buffer_pool_read_requests then you have a good amount of usage. If you are getting the status variable innodb_buffer_pool_wait_free increasing then you don't have enough buffer pool (or your flushing isn't occurring frequently enough).
The larger the size, the longer it takes to initialize. On a 64-bit server with a 10GB memory pool, this can take five seconds or longer.
The buffer pool can be set dynamically. See Setting Innodb Buffer Pool Size Dynamically.
From MariaDB 10.11.12 / 11.4.6 / 11.8.2, there are significant changes to the InnoDB buffer pool behavior.
MariaDB server deprecates and ignores the innodb_buffer_pool_chunk_size . Now, the buffer pool size is changed in arbitrary 1-megabyte increments, all the way up to innodb_buffer_pool_size_max, which must be specified at startup.
If innodb_buffer_pool_size_max is 0 or not specified, it defaults to the innodb_buffer_pool_size value.
The innodb_buffer_pool_size_auto_min variable specifies the minimum size the buffer pool can be shrunk to by a memory pressure event. When a memory pressure event occurs, MariaDB server attempts to shrink innodb_buffer_pool_size halfway between its current value and the innodb_buffer_pool_size_auto_min value. If innodb_buffer_pool_size_auto_min is not specified or 0, its default value is adjusted to innodb_buffer_pool_size — in other words, memory pressure events are disregarded by default.
The minimum innodb_buffer_pool_size is 320 pages (256*5/4). With the default value of innodb_page_size=16k, this corresponds to 5 MiB. However, since innodb_buffer_pool_size includes the memory allocated for the block descriptors, the minimum is effectively innodb_buffer_pool_size=6m.
When the buffer pool is shrunk, InnoDB tries to inform the operating system that the underlying memory for part of the virtual address range is no longer needed and may be zeroed out. On many POSIX-like systems this is done by madvise(MADV_DONTNEED) where available (Linux, FreeBSD, NetBSD, OpenBSD, Dragonfly BSD, IBM AIX, Apple macOS). On Microsoft Windows, VirtualFree(MEM_DECOMMIT) is invoked. On many systems, there is also MADV_FREE, which would be a deferred variant of MADV_DONTNEED, not freeing the virtual memory mapping immediately. We prefer immediate freeing so that the resident set size of the process reflects the current innodb_buffer_pool_size value. Shrinking the buffer pool is a rarely executed intensive operation, and the immediate configuration of the MMU mappings should not incur significant additional penalty.
The Innodb_buffer_pool_resize_status variable is removed. Issuing SET GLOBAL innodb_buffer_pool_size blocks until the buffer pool has been resized or the operation was aborted by a KILL or SHUTDOWN command, a client disconnect, or an interrupt.
The default 37% reserved for the old list can be adjusted by changing the value of innodb_old_blocks_pct. It can accept anything between 5% and 95%.
The innodb_old_blocks_time variable specifies the delay before a block can be moved from the old to the new sublist. 0 means no delay, while the default has been set to 1000.
Before changing either of these values from their defaults, make sure you understand the impact and how your system currently uses the buffer. Their main reason for existence is to reduce the impact of full table scans, which are usually infrequent, but large, and previously could clear everything from the buffer. Setting a non-zero delay could help in situations where full table scans are performed in quick succession.
Temporarily changing these values can also be useful to avoid the negative impact of a full table scan, as explained in InnoDB logical backups.
When the server starts, the buffer pool is empty. As it starts to access data, the buffer pool will slowly be populated. As more data are accessed, the most frequently accessed data are put into the buffer pool, and old data may be evicted. This means that a certain period of time is necessary before the buffer pool is really useful. This period of time is called the warmup.
InnoDB can dump the buffer pool before the server shuts down, and restore it when it starts again. If this feature is used, no warmup is necessary. Use the innodb_buffer_pool_dump_at_shutdown and innodb_buffer_pool_load_at_startup system variables to enable or disable the buffer pool dump at shutdown and the restore at startup respectively.
It is also possible to dump the InnoDB buffer pool at any moment while the server is running, and it is possible to restore the last buffer pool dump at any moment. To do this, the special innodb_buffer_pool_dump_now and innodb_buffer_pool_load_now system variables can be set to ON. When selected, their value is always OFF.
A buffer pool restore, both at startup or at any other moment, can be aborted by setting innodb_buffer_pool_load_abort to ON.
The file which contains the buffer pool dump is specified via the innodb_buffer_pool_filename system variable.
This page is licensed: CC BY-SA / Gnu FDL
This section provides information about unmaintained or deprecated features related to InnoDB in MariaDB Server. It is advisable to review this content for compatibility and migration planning.
[mariadb]
...
innodb_page_cleaners=8SET GLOBAL innodb_page_cleaners=8;[mariadb]
...
innodb_use_mtflush = ON
innodb_mtflush_threads = 8SET GLOBAL innodb_io_capacity=20000;[mariadb]
...
innodb_io_capacity=20000SET GLOBAL innodb_io_capacity_max=20000;[mariadb]
...
innodb_io_capacity_max=20000changes
Buffer both insert and delete operations
purges
Buffer the actual physical deletes that occur in the background
all
Buffer inserts, deletes and purges. Default setting from until , MariaDB 10.6.6, and .
none
Don't buffer any operations. Default from , MariaDB 10.6.7, and .
When innodb_autoinc_lock_mode is set to 0, InnoDB uses the traditional lock mode.
In this mode, InnoDB holds a table-level lock for all INSERT statements until the statement completes.
When innodb_autoinc_lock_mode is set to 1, InnoDB uses the consecutive lock mode.
In this mode, InnoDB holds a table-level lock for all bulk INSERT statements (such as LOAD DATA or INSERT ... SELECT) until the end of the statement. For simple INSERT statements, no table-level lock is held. Instead, a lightweight mutex is used which scales significantly better. This is the default setting.
When innodb_autoinc_lock_mode is set to 2, InnoDB uses the interleaved lock mode.
In this mode, InnoDB does not hold any table-level locks at all. This is the fastest and most scalable mode, but is not safe for statement-based replication.
The AUTO_INCREMENT value for an InnoDB table can be set for a table by executing the ALTER TABLE statement and specifying the AUTO_INCREMENT table option:
However, in and before, InnoDB stores the table's AUTO_INCREMENT counter in memory. In these versions, when the server restarts, the counter is re-initialized to the highest value found in the table. This means that the above operation can be undone if the server is restarted before any rows are written to the table.
In and later, the AUTO_INCREMENT counter is persistent, so this restriction is no longer present. Persistent, however, does not mean transactional. Gaps may still occur in some cases, such as if a INSERT IGNORE statement fails, or if a user executes ROLLBACK or ROLLBACK TO SAVEPOINT.
For example:
If the server is restarted at this point, then the AUTO_INCREMENT counter will revert to 101, which is the persistent value set as part of the failed INSERT IGNORE.
Sequences - an alternative to auto_increment available from
This page is licensed: CC BY-SA / Gnu FDL
For asynchronous writes, this typically occurs in the buffer pool flushing code.
For asynchronous reads, this may happen during buffer pool loading at startup or in prefetching logic.
COMPLETED_IN_OS – The operating system notifies InnoDB that the I/O operation is complete.
If using libaio or io_uring, a dedicated thread handles this notification.
The completed IO operation is then submitted to InnoDB’s internal thread pool (tpool).
EXECUTING_COMPLETION_TASK – A tpool thread processes the completion task for the IO operation.
COMPLETED – The IO operation is fully handled.
The total number of pending asynchronous IO operations is limited by:
where number_of_IO_threads refers to either innodb_io_read_threads or innodb_io_write_threads.
Each IO operation is associated with an IO slot, which contains necessary metadata such as the file handle, operation type, offset, length, and any OS error codes. Initially, all total_count slots are free, but as pending IO requests accumulate, slots get occupied. If all slots are in use, additional IO requests must wait for a free slot.
The number of completion tasks (EXECUTING_COMPLETION_TASK stage) that can run in parallel is also limited by innodb_io_read_threads or innodb_io_write_threads. If too many IO operations complete simultaneously, they cannot all be processed in parallel and must be queued, respecting the thread limit.
From , a number of status variables were added to give insight into the above operations:
innodb_async_reads_pending – Number of read IO operations currently in progress (from SUBMITTED to COMPLETED).
innodb_async_reads_tasks_running – Number of read IO operations currently in the EXECUTING_COMPLETION_TASK state.
innodb_async_reads_total_count – Total number of read completion tasks that have finished execution.
innodb_async_reads_queue_size – Current size of the queue (see Queuing Mechanism).
– Total wait time for a free IO slot (see Waiting for IO Slots).
– Total number of read operations that were queued (see ). Includes those still waiting and making up innodb_async_reads_queue_size.
Similar variables exist for write operations:
This page is licensed: CC BY-SA / Gnu FDL
Boolean
Enable redo log scrubbing. Deprecated and ignored.
Bytes/sec
Redo log scrubbing speed in bytes/sec. Deprecated and ignored.
Default Row Format
Dynamic
ACID-compliant
Yes
XA Transactions
Yes
Primary Keys
Yes
InnoDB Primary Keys
Auto-Increment
Yes
Sequences
Yes
InnoDB Sequences
Foreign Keys
Yes
InnoDB Foreign Keys
Indexes
Yes
InnoDB Indexes
Secondary Indexes
Yes
InnoDB Secondary Indexes
Unique Indexes
Yes
InnoDB Unique Indexes
Full-text Search
Yes
InnoDB Full-text Indexes
Spatial Indexes
Yes
InnoDB Spatial Indexes
Compression
Yes
Data-at-Rest Encryption
Yes
High Availability (HA)
Yes
Main Memory Caching
Yes
Transaction Logging
Yes
Garbage Collection
Yes
Online Schema changes
Yes
Non-locking Reads
Yes
Row Locking
Yes
A list of constraints and limits within the InnoDB engine, including maximum table size, column counts, and index key lengths.
The InnoDB storage engine has the following limitations.
InnoDB tables can have a maximum of 1,017 columns. This includes virtual generated columns.
InnoDB tables can have a maximum of 64 secondary indexes.
A multicolumn index on InnoDB can use a maximum of 32 columns. If you attempt to create a multicolumn index that uses more than 32 columns, MariaDB returns an Error 1070.
With the exception of variable-length columns (that is, , , and ), rows in InnoDB have a maximum length of roughly half the page size for 4KB, 8KB, 16KB and 32KB page sizes.
The maximum size for and columns is 4GB. This also applies to and .
MariaDB imposes a row-size limit of 65,535 bytes for the combined sizes of all columns. If the table contains or columns, these only count for 9 - 12 bytes in this calculation, given that their content is stored separately.
Using the system variable, you can configure the size in bytes for InnoDB pages. Pages default to 16KB. There are certain limitations on how you use this variable.
MariaDB instances using one page size cannot use data files or log files from an instance using a different page size.
When using a Page Size of 4KB or 8KB, the maximum index key length is lowered proportionately.
InnoDB has the following table-specific limitations.
When you issue a statement, InnoDB doesn't regenerate the table, rather it deletes each row from the table one by one.
When running MariaDB on Windows, InnoDB stores databases and tables in lowercase. When moving databases and tables in a binary format from Windows to a Unix-like system or from a Unix system to Windows, you need to rename these to use lowercase.
When using cascading , operations in the cascade don't activate triggers.
When running twice on a table in which statements or transactions are running, MariaDB blocks the second until the statement or transaction is complete. This occurs because the statement or transaction blocks the second statement from reloading the table definition, which it must do since the old one was marked as obsolete after the first statement.
statements do not provide accurate statistics for InnoDB, except for the physical table size.
The InnoDB storage engine does not maintain internal row counts. Transactions isolate writes, which means that concurrent transactions will not have the same row counts.
When defining an index on an auto-incrementing column, it must be defined in a way that allows the equivalent of SELECT MAX(col) lookups on the table.
Restarting MariaDB may cause InnoDB to reuse old auto-increment values, such as in the case of a transaction that was rolled back.
When auto-incrementing columns run out of values, statements generate duplicate-key errors.
You can modify data on a maximum of 96 * 1023 concurrent transactions that generate undo records.
Of the 128 rollback segments, InnoDB assigns 32 to non-redo logs for transactions that modify temporary tables and related objects, reducing the maximum number of concurrent data-modifying transactions to 96,000, from 128.000.
The limit is 32,000 concurrent transactions when all data-modifying transactions also modify temporary tables.
Issuing a statement sets two locks on each table when the system variable is enabled (the default).
This page is licensed: CC BY-SA / Gnu FDL
Information about XtraDB, an storage engine used in old MariaDB versions.
XtraDB, previously the default InnoDB replacement in MariaDB, is no longer included in standard distributions. MariaDB now uses InnoDB by default.
The reasons you may want to use InnoDB instead of XtraDB in earlier versions of MariaDB are:
You want to benchmark the difference between InnoDB/XtraDB
You hit a bug in XtraDB
You got a table space crash in XtraDB and recovery doesn't work. In some cases InnoDB may do a better job to recover data.
This page is licensed: CC BY-SA / Gnu FDL
ALTER TABLE tab AUTO_INCREMENT=100;CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY, i INT, UNIQUE (i)) ENGINE=InnoDB;
INSERT INTO t1 (i) VALUES (1),(2),(3);
INSERT IGNORE INTO t1 (pk, i) VALUES (100,1);
Query OK, 0 rows affected, 1 warning (0.099 sec)
SELECT * FROM t1;
+----+------+
| pk | i |
+----+------+
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
+----+------+
SHOW CREATE TABLE t1\G
*************************** 1. row ***************************
Table: t1
Create Table: CREATE TABLE `t1` (
`pk` int(11) NOT NULL AUTO_INCREMENT,
`i` int(11) DEFAULT NULL,
PRIMARY KEY (`pk`),
UNIQUE KEY `i` (`i`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1# Restart server
SHOW CREATE TABLE t1\G
*************************** 1. row ***************************
Table: t1
Create Table: CREATE TABLE `t1` (
`pk` int(11) NOT NULL AUTO_INCREMENT,
`i` int(11) DEFAULT NULL,
PRIMARY KEY (`pk`),
UNIQUE KEY `i` (`i`)
) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=latin1total_count = number_of_IO_threads * 25632-bit operating systems have a maximum file size limit of 2GB. When working with large tables using this architecture, configure InnoDB to use smaller data files.
The maximum size for the combined InnoDB log files is 512GB.
With tablespaces, the minimum size is 10MB, the maximum varies depending on the InnoDB Page Size.
When you commit or roll back a transaction, any locks set in the transaction are released. You don't need to issue LOCK TABLES statements when the autocommit variable is enabled, as InnoDB would immediately release the table locks.
4KB
16TB
8KB
32TB
16KB
64TB
32KB
128TB
64KB
256TB
4KB
768B
8KB
1536B
16KB
3072B
The purge process is a garbage collection mechanism that removes old row versions from the undo log that are no longer required for MVCC.
When a transaction updates a row in an InnoDB table, InnoDB's MVCC implementation keeps old versions of the row in the InnoDB undo log. The old versions are kept at least until all transactions older than the transaction that updated the row are no longer open. At that point, the old versions can be deleted. InnoDB has purge process that is used to delete these old versions.
In MariaDB Enterprise Server, the InnoDB storage engine uses Purge Threads to perform garbage collection in the background. The Purge Threads are related to multi-version concurrency control (MVCC).
The Purge Threads perform garbage collection of various items:
The Purge Threads perform garbage collection of the . When a row is updated in the clustered index, InnoDB updates the values in the clustered index, and the old row version is added to the Undo Log. The Purge Threads scan the Undo Log for row versions that are not needed by open transactions and permanently delete them. In ES 10.5 and later, if the remaining clustered index record is the oldest possible row version, the Purge Thread resets the record's hidden DB_TRX_ID field to 0.
The Purge Threads perform garbage collection of index records. When an indexed column is updated, InnoDB creates a new index record for the updated value in each affected index, and the old index records are delete-marked. When the primary key column is updated, InnoDB creates a new index record for the updated value in every index, and each old index record is delete-marked. The Purge Threads scan for delete-marked index records and permanently delete them.
The Purge Threads perform garbage collection of freed overflow pages. , , , , , and related types are sometimes stored on overflow pages. When the value on the overflow page is deleted or updated, the overflow page is no longer needed. The Purge Threads delete these freed overflow pages.
The number of purge threads can be set by configuring the system variable. This system variable can be specified as a command-line argument to or it can be specified in a relevant server in an :
The purge batch size is defined as the number of records that must be written before triggering purge. The purge batch size can be set by configuring the system variable. This system variable can be specified as a command-line argument to or it can be specified in a relevant server in an :
If purge operations are lagging on a busy server, then this can be a tough situation to recover from. As a solution, InnoDB allows you to set the max purge lag. The max purge lag is defined as the maximum number of that can be waiting to be purged from the history until InnoDB begins delaying DML statements.
The max purge lag can be set by configuring the system variable. This system variable can be changed dynamically with :
This system variable can also be specified as a command-line argument to or it can be specified in a relevant server in an :
The maximum delay can be set by configuring the system variable. This system variable can be changed dynamically with :
This system variable can also be specified as a command-line argument to or it can be specified in a relevant server in an :
The purge rollback segment truncation frequency is defined as the number of purge loops that are run before unnecessary rollback segments are truncated. The purge rollback segment truncation frequency can be set by configuring the system variable. This system variable can be changed dynamically with :
This system variable can also be specified as a command-line argument to or it can be specified in a relevant server in an :
Purge undo log truncation occurs when InnoDB truncates an entire tablespace, rather than deleting individual records.
Purge undo log truncation can be enabled by configuring the system variable. This system variable can be changed dynamically with :
This system variable can also be specified as a command-line argument to or it can be specified in a relevant server in an :
An tablespace is truncated when it exceeds the maximum size that is configured for tablespaces. The maximum size can be set by configuring the system variable. This system variable can be changed dynamically with :
This system variable can also be specified as a command-line argument to or it can be specified in a relevant server in an :
An InnoDB table's clustered index has three hidden system columns that are automatically generated. These hidden system columns are:
DB_ROW_ID - If the table has no other PRIMARY KEY or no other UNIQUE KEY defined as NOT NULL that can be promoted to the table's PRIMARY KEY, then InnoDB will use a hidden system column called DB_ROW_ID. InnoDB will automatically generated the value for the column from a global InnoDB-wide 48-bit sequence (instead of being table-local).
DB_TRX_ID - The transaction ID of either the transaction that last changed the row or the transaction that currently has the row locked.
If a row's last record is purged, this can obviously effect the value of the row's DB_ROLL_PTR column, because there would no longer be any record for the pointer to reference.
The purge process will set a row's DB_TRX_ID column to 0 after all of the row's associated records have been deleted. This change allows InnoDB to perform an optimization: if a query wants to read a row, and if the row's DB_TRX_ID column is set to 0, then it knows that no other transaction has the row locked. Usually, InnoDB needs to lock the transaction system's mutex in order to safely check whether a row is locked, but this optimization allows InnoDB to confirm that the row can be safely read without any heavy internal locking.
This optimization can speed up reads, but it come at a noticeable cost at other times. For example, it can cause the purge process to use more I/O after inserting a lot of rows, since the value of each row's DB_TRX_ID column will have to be reset.
This page is licensed: CC BY-SA / Gnu FDL
The undo log stores the "before" image of data modified by active transactions, supporting rollbacks and consistent read views.
When a transaction writes data, it always inserts them in the table indexes or data (in the buffer pool or in physical files). No private copies are created. The old versions of data being modified by active InnoDB transactions are stored in the undo log. The original data can then be restored, or viewed by a consistent read.
Before a row is modified, a diff is copied into the undo log. Each normal row contains a pointer to the most recent version of the same row in the undo log. Each row in the undo log contains a pointer to previous version, if any. So, each modified row has a history chain.
Rows are never physically deleted until a transaction ends. If they were deleted, the restore in ROLLBACK would be impossible. Thus, rows are simply marked for deletion.
Each transaction uses a view of the records. The determines how this view is created. For example, READ UNCOMMITTED usually uses the current version of rows, even if they are not committed (dirty reads). Other isolation levels require that the most recent committed version of rows is searched in the undo log. READ COMMITTED uses a different view for each table, while REPEATABLE READ and SERIALIZABLE use the same view for all tables.
There is also a global history list of the data. When a transaction is committed, its history is added to this history list. The order of the list is the chronological order of the commits.
The purge thread deletes the rows in the undo log which are not needed by any existing view. The rows for which a most recent version exists are deleted, as well as the delete-marked rows.
If InnoDB needs to restore an old version, it will simply replace the newer version with the older one. When a transaction inserts a new row, there is no older version. However, in that case, the restore can be done by deleting the inserted rows.
Understanding how the undo log works helps with understanding the negative effects long transactions.
Long transactions generate several old versions of the rows in the undo log. Those rows will probably be needed for a longer time, because other long transactions will need them. Since those transactions will generate more modified rows, a sort of combinatorial explosion can be observed. Thus, the undo log requires more space.
Transaction may need to read very old versions of the rows in the history list, thus their performance will degrade.
Of course read-only transactions do not write more entries in the undo log; however, they delay the purging of existing entries.
Also, long transactions can more likely result in deadlocks, but this problem is not related to the undo log.
System variables affecting undo logs include:
The undo log is not a log file that can be viewed on disk in the usual sense, such as the or , but rather an area of storage.
Before , the undo log is usually part of the physical system tablespace, but from , the and system variables can be used to split into different tablespaces and store in a different location (perhaps on a different storage device). From , multiple undo tablespaces are enabled by default, and the default is changed to 3 so that the space occupied by possible bursts of undo log records can be reclaimed after is set.
Each insert or update portion of the undo log is known as a rollback segment. The system variable allowed to reduce the number of rollback segments from the usual 128, to limit the number of concurrently active write transactions. was deprecated and ignored in and removed in , as it always makes sense to use the maximum number of rollback segments.
The related status variable stores the total number of available InnoDB undo logs.
This page is licensed: CC BY-SA / Gnu FDL
This page details the dedicated thread pool in MariaDB Enterprise Server that manages InnoDB background tasks, improving scalability and performance.
Starting with MariaDB Enterprise Server 10.5 and MariaDB Community Server 10.5, InnoDB uses the InnoDB Background Thread Pool to perform internal operations in the background. In previous versions, the internal operations were performed by dedicated threads. By using the InnoDB Background Thread Pool instead of many dedicated threads, InnoDB can reduce context switching and use system resources more effectively.
The InnoDB Background Thread Pool performs internal operations in multiple categories: tasks, timers, and asynchronous I/O.
Tasks are used to perform internal operations that are triggered by some event. In ES 10.5 and later and CS 10.5 and later, the following threads have been replaced by tasks with the InnoDB Background Thread Pool:
The InnoDB Buffer Pool Resize Thread
The InnoDB Buffer Pool Dump Thread
The InnoDB Full-Text Search (FTS) Optimization Thread
Timers are used to perform internal operations that are triggered periodically. In ES 10.5 and later and CS 10.5 and later, the following threads have been replaced by timers with the InnoDB Background Thread Pool:
The InnoDB Master Thread
The InnoDB Defragmentation Thread
The InnoDB Monitor Thread
The InnoDB Error Monitor Thread
Asynchronous I/O is used to read from and write to disk asynchronously. In ES 10.5 and later and CS 10.5 and later, the following threads have been replaced by asynchronous I/O with the InnoDB Background Thread Pool:
The
This page is: Copyright © 2025 MariaDB. All rights reserved.
Information on the legacy REDUNDANT row format, primarily maintained for backward compatibility with older MySQL versions.
The REDUNDANT row format is the original non-compacted row format.
The REDUNDANT row format was the only available row format before MySQL 5.0.3. In that release, this row format was retroactively named the REDUNDANT row format. In the same release, the COMPACT row format was introduced as the new default row format.
REDUNDANT Row FormatRedundant row format should not be used in modern versions of MariaDB Server.
Redundant row format does not store large columns as efficiently as the Dynamic row format.
Redundant row format limits indexing column values to 767 bytes, which is significant smaller than the Dynamic row format.
The easiest way to create an InnoDB table that uses the REDUNDANT row format is by setting the table option to REDUNDANT in a or statement.
It is recommended to set the system variable to ON when using this format.
The REDUNDANT row format is supported by both the Antelope and the Barracuda , so tables with this row format can be created regardless of the value of the system variable.
For example:
REDUNDANT Row FormatThe REDUNDANT row format supports index prefixes up to 767 bytes.
REDUNDANT Row FormatAll InnoDB row formats can store certain kinds of data in overflow pages. This allows for the maximum row size of an InnoDB table to be larger than the maximum amount of data that can be stored in the row's main data page. See for more information about the other factors that can contribute to the maximum row size for InnoDB tables.
In the REDUNDANT row format variable-length columns, such as columns using the , , and data types, can be partially stored in overflow pages.
InnoDB only considers using overflow pages if the table's row size is greater than half of . If the row size is greater than this, then InnoDB chooses variable-length columns to be stored on overflow pages until the row size is less than half of .
For , , and columns, only values longer than 767 bytes are considered for storage on overflow pages. Bytes that are stored to track a value's length do not count towards this limit. This limit is only based on the length of the actual column's data.
Fixed-length columns greater than 767 bytes are encoded as variable-length columns, so they can also be stored in overflow pages if the table's row size is greater than half of . Even though a column using the data type can hold at most 255 characters, a column can still exceed 767 bytes in some cases. For example, a char(255) column can exceed 767 bytes if the is utf8mb4.
If a column is chosen to be stored on overflow pages, then the first 767 bytes of the column's value and a 20-byte pointer to the column's first overflow page are stored on the main page. Each overflow page is the size of [innodb-system-variables#innodb_page_size|innodb_page_size]]. If a column is too large to be stored on a single overflow page, then it is stored on multiple overflow pages. Each overflow page contains part of the data and a 20-byte pointer to the next overflow page, if a next page exists.
This page is licensed: CC BY-SA / Gnu FDL
A detailed reference list of specific schema change operations (like adding columns or indexes) and their compatibility with INSTANT, INPLACE, and NOCOPY algorithms.
Changes in enterprise databases and applications are inevitable. Schema changes often block other workloads, incur unique production situations that cannot be fully simulated for testing, and may have unpredictable execution times.
MariaDB Enterprise Server includes the In-place ALTER functionality for the InnoDB storage engine, such that:
When possible, schema change operations are performed INPLACE, minimizing impact on other workloads.
When the alter_algorithm system variable is set to INPLACE, schema change operations will not run unless they can be performed INPLACE, minimizing the risk of unpredictable behavior.
Additional information is available .
Changes in enterprise databases and applications are inevitable. Schema changes often block other workloads, incur unique production situations that cannot be fully simulated for testing, and may have unpredictable execution times.
MariaDB Enterprise Server includes the Instant ALTER functionality for the InnoDB storage engine, such that:
When possible, schema change operations are performed INSTANT, minimizing impact on other workloads.
When the alter_algorithm system variable is set to INSTANT, schema change operations will not run unless they can be performed INSTANT, minimizing the risk of unpredictable behavior.
Additional information is available .
Changes in enterprise databases and applications are inevitable. Schema changes often block other workloads, incur unique production situations that cannot be fully simulated for testing, and may have unpredictable execution times.
MariaDB Enterprise Server includes the No-copy ALTER functionality for the InnoDB storage engine, such that:
When possible, schema change operations are performed NOCOPY, minimizing impact on other workloads.
When the alter_algorithm system variable is set to NOCOPY, schema change operations will not run unless they can be performed NOCOPY, minimizing the risk of unpredictable behavior.
Additional information is available .
This page is: Copyright © 2025 MariaDB. All rights reserved.
Learn how to resolve inconsistencies between the InnoDB internal data dictionary and the file system, such as orphan .frm or .ibd files.
If InnoDB returns something like the following error:
it may be that an orphan .frm file exists. Something like the following may also appear in the error log:
If this is the case, as the text describes, delete the orphan .frm file on the filesystem.
In this case the table definition, the .frm file, is missing and the InnoDB dictionary expects it to be there. To remove the InnoDB dictionary entry, the existence of the file needs to faked and then dropped. The existence of the file is faked by creating the tablename.frm and potential the database directory if it is missing. Then a DROP TABLE or DROP DATABASE can be executed which will remove the InnoDB dictionary entry.
Use the query to identify potentially other tablespaces that are known but missing with:
An orphan intermediate table may prevent you from dropping the tablespace even if it is otherwise empty, and generally takes up unnecessary space.
It may come about if MariaDB exits in the middle of an operation. They are listed in the table, and always start with an #sql-ib prefix. The accompanying .frm file also begins with #sql-, but has a different name.
To identify orphan tables, run:
When is set, the #sql-*.ibd file will also be visible in the database directory.
To remove an orphan intermediate table:
Rename the #sql-*.frm file (in the database directory) to match the base name of the orphan intermediate table, for example:
Drop the table, for example:
This page is licensed: CC BY-SA / Gnu FDL
ERROR 1016: Can't open file: 'x.ibd'. (errno: 1)InnoDB: Cannot find table test/x from the internal data dictionary
InnoDB: of InnoDB though the .frm file for the table exists. Maybe you
InnoDB: have deleted and recreated InnoDB data files but have forgotten
InnoDB: to delete the corresponding .frm files of InnoDB tables?Thread Pool
InnoDB Background Thread Pool
Storage Engine
InnoDB
Purpose
Handles background tasks for InnoDB
Availability
• ES 10.5+ • CS 10.5+
Perform online DDL operations with InnoDB in MariaDB Server. Learn how to alter tables without blocking read/write access, ensuring high availability for your applications.
SET SESSION innodb_strict_mode=ON;
CREATE TABLE tab (
id INT,
str VARCHAR(50)
) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'dbname/%';SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE '%#sql%';mv #sql-36ab_2.frm #sql-ib87-856498050.frmDROP TABLE `#mysql50##sql-ib87-856498050`;Quantity
Set by
DB_ROLL_PTR - A pointer to the InnoDB undo log that contains the row's previous record. The value of DB_ROLL_PTR is only valid if DB_TRX_ID belongs to the current read view. The oldest valid read view is the purge view.
Thread
InnoDB Purge Threads
Storage Engine
InnoDB
Purpose
Garbage Collection of: • InnoDB Undo Log • Delete-marked secondary index records • Freed overflow pages
Availability
All ES and CS versions
Location
By default, located in InnoDB system tablespace When
innodb_undo_tablespaces is set, located in directory set by (Defaults to )
Quantity
Set by
Size
10 MB per tablespace by default (grows as needed)
Transaction Log
InnoDB Undo Log
Storage Engine
InnoDB
Purpose
Multi-Version Concurrency Control (MVCC)
Availability
All ES and CS versions
A focused guide on the Instant ADD COLUMN feature, explaining how it works by modifying metadata and its advantages over traditional table-rebuilding methods.
Normally, adding a column to a table requires the full table to be rebuilt. The complexity of the operation is proportional to the size of the table, or O(n·m) where n is the number of rows in the table and m is the number of indexes.
In and later, the ALTER TABLE statement supports online DDL for storage engines that have implemented the relevant online DDL algorithms and locking strategies.
The InnoDB storage engine has implemented online DDL for many operations. These online DDL optimizations allow concurrent DML to the table in many cases, even if the table needs to be rebuilt.
See InnoDB Online DDL Overview for more information about online DDL with InnoDB.
Allowing concurrent DML during the operation does not solve all problems. When a column was added to a table with the older in-place optimization, the resulting table rebuild could still significantly increase the I/O and memory consumption and cause replication lag.
In contrast, with the new instant ALTER TABLE ... ADD COLUMN, all that is needed is an O(1) operation to insert a special hidden record into the table, and an update of the data dictionary. For a large table, instead of taking several hours, the operation would be completed in the blink of an eye. The ALTER TABLE ... ADD COLUMN operation is only slightly more expensive than a regular , due to locking constraints.
In the past, some developers may have implemented a kind of "instant add column" in the application by encoding multiple columns in a single or column. MariaDB was an early example of that. A more recent example is and related string manipulation functions.
Adding real columns has the following advantages over encoding columns into a single "expandable" column:
Efficient storage in a native binary format
Data type safety
Indexes can be built natively
Constraints are available: UNIQUE, CHECK, FOREIGN KEY
With instant , you can enjoy all the benefits of structured storage without the drawback of having to rebuild the table.
Instant is available for both old and new InnoDB tables. Basically you can just upgrade from MySQL 5.x or MariaDB and start adding columns instantly.
Columns instantly added to a table exist in a separate data structure from the main table definition, similar to how InnoDB separates BLOB columns. If the table ever becomes empty, (such as from or statements), InnoDB incorporates the instantly added columns into the main table definition. See for more information.
The operation is also crash safe. If the server is killed while executing an instant , when the table is restored InnoDB integrates the new column, flattening the table definition.
In , instant only applies when the added columns appear last in the table. The place specifier LAST is the default. If AFTER col is specified, then col must be the last column, or the operation will require the table to be rebuilt. In , this restriction was lifted.
If the table contains a hidden FTS_DOC_ID column due to a , then instant will not be possible.
InnoDB data files after instant
The above example illustrates that when the added columns are declared NOT NULL, a DEFAULT value must be available, either implied by the data type or set explicitly by the user. The expression need not be constant, but it must not refer to the columns of the table, such as DEFAULT u+1 (a MariaDB extension). The DEFAULT current_timestamp() would be evaluated at the time of the ALTER TABLE and apply to each row, like it does for non-instant ALTER TABLE. If a subsequent ALTER TABLE changes the DEFAULT value for subsequent INSERT, the values of the columns in existing records will naturally be unaffected.
The design was brainstormed in April by engineers from MariaDB Corporation, Alibaba and Tencent. A prototype was developed by Vin Chen (陈福荣) from the Tencent Game DBA Team.
This page is licensed: CC BY-SA / Gnu FDL
This page explains how InnoDB manages temporary tablespaces for non-compressed temporary tables, including configuration and sizing options.
When the user creates a temporary table using the CREATE TEMPORARY TABLE statement and the engine is set as InnoDB, MariaDB creates a temporary tablespace file. When the table is not compressed, MariaDB writes to a shared temporary tablespace as defined by the innodb_temp_data_file_path system variable. MariaDB does not allow the creation of ROW_FORMAT=COMPRESSED temporary tables. All temporary tables are uncompressed. MariaDB deletes temporary tablespaces when the server shuts down gracefully and is recreated when it starts again. It cannot be placed on a raw device.
Internal temporary tablespaces, (that is, temporary tables that cannot be kept in memory) use either Aria or MyISAM, depending on the aria_used_for_temp_tables system variable. You can set the default storage engine for user-created temporary tables using the default_tmp_storage_engine system variable.
Prior to , temporary tablespaces existed as part of the InnoDB system tablespace or were file-per-table depending on the configuration of the innodb_file_per_table system variable.
The options for is one path or a set of paths, separated by ';'.
The syntax for each path is:
size can have extensions 'G' (Gigabytes), 'M' (Megabytes) or 'K' (Kilobytes). If no extension is given, then megabytes is assumed.
The first size argument is the initial size of the temporary table space.
autoextend means that the file size will automatically increase if needed.
max can be used to limit the total size of the temporary file if autoextend is used.
Only the last path can have the autoextend , max and autoshrink options.
In order to size temporary tablespaces, use the system variable. This system variable can be specified as a command-line argument to or it can be specified in a relevant server in an :
This system variable's syntax is the same as the system variable. That is, a file name, size and option. By default, it writes a 12MB autoextending file to ibtmp1 in the data directory.
To increase the size of the temporary tablespace, you can add a path to an additional tablespace file to the value of the system variable. Providing additional paths allows you to spread the temporary tablespace between multiple tablespace files. The last file can have the autoextend attribute, which ensures that you won't run out of space:
Unlike normal tablespaces, temporary tablespaces are deleted when you stop MariaDB. To shrink temporary tablespaces to their minimum sizes, restart the server.
From , the temporary tablespace can be shrunk by setting to ON:
This page is licensed: CC BY-SA / Gnu FDL
A guide to configuring the size and number of InnoDB redo log files in MariaDB Enterprise Server to balance write performance and crash recovery time.
In MariaDB Enterprise Server, the InnoDB storage engine uses a Redo Log. The Redo Log is a transaction log that InnoDB uses to write data to disk in a crash-safe manner.
Redo Log records are identified using the Log Sequence Number (LSN). The Redo Log is a circular log file that is a constant size. Old Redo Log records are frequently overwritten by new Redo Log records. InnoDB regularly performs checkpoints. During a checkpoint, InnoDB flushes Redo Log records to the InnoDB tablespace files.
When the server crashes, InnoDB performs crash recovery during server startup using the Redo Log. During crash recovery, InnoDB finds the last checkpoint in the Redo Log and flushes the Redo Log records since the last checkpoint to the InnoDB tablespace files.
For additional information, see "".
This page describes how to configure the InnoDB Redo Log.
The size of the InnoDB Redo Log is configurable. If your server writes data at a very high frequency, then you may need to increase the redo log size, so that InnoDB does not have to perform checkpoints as frequently.
For the maximum capacity in the Redo Log, the Redo Log size should be the same as the , which is configured by the system variable.
The method to configure the Redo Log size depends on the server version and whether a server restart are performed:
Starting in MariaDB Enterprise Server 10.5, the size of the InnoDB Redo Log can be changed dynamically by setting the system variable using the statement. The statement requires the SUPER privilege.
The resize operation is performed asynchronously in the background. If the server is restarted before the operation completes, the request may be ignored. To ensure that the change survives server restarts, the system variable should also be set in a configuration file.
To configure the InnoDB Redo Log with the statement, use the following procedure:
Connect to the server using MariaDB Client as the root@localhost user account or another user account with the SUPER privilege:
Set the system variable to the new size using the statement.
For example, to set the size to 512 MB:
And to set the size to 2 GB:
The resize operation is performed asynchronously in the background. Confirm that the resize operation is complete by querying the system variable using the statement. The resize operation is complete when the output shows the new size as the value of the system variable.
Execute the following statement until it shows the new size:
Choose a configuration file for custom changes to system variables and options. It is not recommended to make custom changes to Enterprise Server's default configuration files, because your custom changes can be overwritten by other default configuration files that are loaded after.
Ensure that your custom changes are read last by creating a custom configuration file in one of the included directories. Configuration files in included directories are read in alphabetical order. Ensure that your custom configuration file is read last by using the z- prefix in the file name.
Some example configuration file paths for different distributions are shown in the following table:
Set the system variable in the configuration file.
It needs to be set in a group that are read by MariaDB Server, such as [mariadb] or [server].
When set in a configuration file, the value supports units, such as "M", "G", etc.
For example, to set the size to 512 MB:
And to set the size to 2 GB:
Starting in MariaDB Enterprise Server 10.5, the size of the InnoDB Redo Log can be changed by setting the system variable in a configuration file.
To configure the InnoDB Redo Log in a configuration file, use the following procedure:
Choose a configuration file for custom changes to system variables and options.
It is not recommended to make custom changes to Enterprise Server's default configuration files, because your custom changes can be overwritten by other default configuration files that are loaded after.
Ensure that your custom changes are read last by creating a custom configuration file in one of the included directories. Configuration files in included directories are read in alphabetical order. Ensure that your custom configuration file is read last by using the z- prefix in the file name.
Some example configuration file paths for different distributions are shown in the following table:
Set the system variable in the configuration file. It needs to be set in a group that are read by MariaDB Server, such as [mariadb] or [server]. When set in a configuration file, the value supports units, such as "M", "G", etc.
For example, to set the size to 512 MB:
And to set the size to 2 GB:
Starting in MariaDB Community Server 10.5, the server must be restarted for the configuration change to take effect:
Starting in MariaDB Enterprise Server 10.5, the server can use the configuration change without a restart if you use .
This page is: Copyright © 2025 MariaDB. All rights reserved.
Learn how to adjust the number of background purge threads to efficiently manage undo logs and prevent history list growth.
In MariaDB Enterprise Server, the InnoDB storage engine uses Purge Threads to perform garbage collection in the background. The Purge Threads are related to multi-version concurrency control (MVCC).
The Purge Threads perform garbage collection of various items:
The Purge Threads perform garbage collection of the InnoDB Undo Log. When a row is updated in the clustered index, InnoDB updates the values in the clustered index, and the old row version is added to the Undo Log. The Purge Threads scan the Undo Log for row versions that are not needed by open transactions and permanently delete them.
The Purge Threads perform garbage collection of index records. When an indexed column is updated, InnoDB creates a new index record for the updated value in each affected index, and the old index records are delete-marked. When the primary key column is updated, InnoDB creates a new index record for the updated value in every index, and each old index record is delete-marked. The Purge Threads scan for delete-marked index records and permanently delete them.
The Purge Threads perform garbage collection of freed overflow pages. , , , , , and related types are sometimes stored on overflow pages. When the value on the overflow page is deleted or updated, the overflow page is no longer needed. The Purge Threads delete these freed overflow pages.
For additional information, see "".
This page describes how to configure the InnoDB Purge Threads.
The number of the InnoDB Purge Threads is configurable. If your server deletes or updates rows at a very high frequency, then you may need to increase the number of purge threads.
The method to configure the number of Purge Threads depends on the server version and whether a server restart are performed:
The number of InnoDB purge threads can be changed dynamically by setting the system variable using the statement. The statement requires the SUPER privilege.
To ensure that the change survives server restarts, the system variable should also be set in a configuration file.
To configure the number of InnoDB Purge threads with the statement, use the following procedure:
Connect to the server using as the root@localhost user account or another user account with the SUPER privilege:
Set the system variable to the new size using the statement.
For example:
Choose a configuration file for custom changes to system variables and options. It is not recommended to make custom changes to Enterprise Server's default configuration files, because your custom changes can be overwritten by other default configuration files that are loaded after.
Ensure that your custom changes are read last by creating a custom configuration file in one of the included directories. Configuration files in included directories are read in alphabetical order. Ensure that your custom configuration file is read last by using the z- prefix in the file name.
Some example configuration file paths for different distributions are shown in the following table:
Set the system variable in the configuration file. It needs to be set in a group that are read by MariaDB Server, such as [mariadb] or [server].
For example:
The number of InnoDB Purge Threads can be configured by setting the system variable in a configuration file.
To configure the number of in a configuration file, use the following procedure:
Choose a configuration file for custom changes to system variables and options. It is not recommended to make custom changes to Enterprise Server's default configuration files, because your custom changes can be overwritten by other default configuration files that are loaded after.
Ensure that your custom changes are read last by creating a custom configuration file in one of the included directories. Configuration files in included directories are read in alphabetical order. Ensure that your custom configuration file is read last by using the z- prefix in the file name.
Some example configuration file paths for different distributions are shown in the following table:
Set the innodb_purge_threads system variable in the configuration file.
It needs to be set in a group that are read by MariaDB Server, such as [mariadb] or [server].
For example:
Restart the server:
The server can use the configuration change without a restart if you use .
This page is: Copyright © 2025 MariaDB. All rights reserved.
[mariadb]
...
innodb_purge_threads=8SET GLOBAL innodb_purge_threads=8;
SHOW GLOBAL VARIABLES
LIKE 'innodb_purge_threads';+----------------------+-------+
| Variable_name | Value |
+----------------------+-------+
| innodb_purge_threads | 8 |
+----------------------+-------+[mariadb]
...
innodb_purge_batch_size = 50SET GLOBAL innodb_max_purge_lag=1000;[mariadb]
...
innodb_max_purge_lag = 1000SET GLOBAL innodb_max_purge_lag_delay=100;[mariadb]
...
innodb_max_purge_lag_delay = 100SET GLOBAL innodb_purge_rseg_truncate_frequency=64;[mariadb]
...
innodb_purge_rseg_truncate_frequency = 64SET GLOBAL innodb_undo_log_truncate=ON;[mariadb]
...
innodb_undo_log_truncate = ONSET GLOBAL innodb_max_undo_log_size='64M';[mariadb]
...
innodb_max_undo_log_size = 64MES 10.5 and Later
No
Configure size with SET GLOBAL
ES 10.5 and Later CS 10.5 and Later
Yes
Configure size in configuration file
CentOS RHEL Rocky Linux SLES
/etc/my.cnf.d/z-custom-mariadb.cnf
Debian Ubuntu
/etc/mysql/mariadb.conf.d/z-custom-mariadb.cnf
CentOS RHEL Rocky Linux SLES
/etc/my.cnf.d/z-custom-mariadb.cnf
Debian Ubuntu
/etc/mysql/mariadb.conf.d/z-custom-mariadb.cnf
ES 10.5 and Later
No
Any ES Any CS
Yes.
CentOS RHEL Rocky Linux SLES
/etc/my.cnf.d/z-custom-mariadb.cnf
Debian Ubuntu
/etc/mysql/mariadb.conf.d/z-custom-mariadb.cnf
CentOS RHEL Rocky Linux SLES
/etc/my.cnf.d/z-custom-mariadb.cnf
Debian Ubuntu
/etc/mysql/mariadb.conf.d/z-custom-mariadb.cnf
$ mariadb --user=rootSET GLOBAL innodb_log_file_size=(512 * 1024 * 1024);SET GLOBAL innodb_log_file_size=(2 * 1024 * 1024 * 1024);SHOW GLOBAL VARIABLES
LIKE 'innodb_log_file_size';[mariadb]
...
innodb_log_file_size=512M[mariadb]
...
innodb_log_file_size=2G[mariadb]
...
innodb_log_file_size=512M[mariadb]
...
innodb_log_file_size=2G$ sudo systemctl restart mariadb$ mariadb --user=rootSET GLOBAL innodb_purge_threads=8;[mariadb]
...
innodb_purge_threads=8[mariadb]
...
innodb_purge_threads=8$ sudo systemctl restart mariadbTriggers can be written more easily
After using Instant ALTER TABLE ... ADD COLUMN, any table-rebuilding operation such as ALTER TABLE … FORCE will incorporate instantaneously added columns into the main table body.
Instant ALTER TABLE ... ADD COLUMN is not available for ROW_FORMAT=COMPRESSED.
In , ALTER TABLE … DROP COLUMN requires the table to be rebuilt. In , this restriction was lifted.
autoshrink means that the file will shrink to original size when possible.
This page explains the InnoDB system tablespace (ibdata1), which stores the data dictionary, doublewrite buffer, and undo logs, and how to resize it.
When InnoDB needs to store general information relating to the system as a whole, rather than a specific table, the specific file it writes to is the system tablespace. By default, this is the ibdata1 file located in the data directory, (as defined by either the datadir or innodb_data_home_dir system variables). InnoDB uses the system tablespace to store the data dictionary, change buffer, and undo logs.
You can define the system tablespace filename or filenames, size and other options by setting the innodb_data_file_path system variable. This system variable can be specified as a command-line argument to mariadbd or it can be specified in a relevant server option group in an option file:
This system variable defaults to the file ibdata1, and it defaults to a minimum size of 12M, and it defaults with the autoextend attribute enabled.
InnoDB defaults to allocating 12M to the ibdata1 file for the system tablespace. While this is sufficient for most use cases, it may not be for all. You may find after using MariaDB for a while that the allocation is too small for the system tablespace or it grows too large for your disk. Fortunately, you can adjust this size as need later.
When setting the system variable, you can define a size for each file given. In cases where you need a larger system tablespace, add the autoextend option to the last value.
Under this configuration, when the last system tablespace grows beyond the size allocation, InnoDB increases the size of the file by increments. To control the allocation increment, set the system variable.
MariaDB starting with
From , when MariaDB starts up, unused InnoDB tablespace can be reclaimed, reducing the file size (). This is disabled by default and is enabled by adding the :autoshrink attribute to the system variable, e.g.:
Alternatively, starting with , the shrinking can be set to happen during a slow shutdown (e.g. after SET GLOBAL innodb_fast_shutdown=0) ().
Technically, how this works is:
Find the last used extent in the system tablespace by iterating through the BITMAP in the extent descriptor page.
Check whether the tablespace is being used within fixed size, and if the last used extent is less than the fixed size, then set the desired target size to fixed size.
Flush all pages belonging to the system tablespace in flush list.
Truncate the truncated pages from FSP_FREE and FSP_FREE_FRAG list.
MariaDB until
In cases where the InnoDB system tablespace has grown too large, before , the process to reduce it in size is a little more complicated than increasing the size. MariaDB does not allow you to remove data from the tablespace file itself. Instead you need to delete the tablespace files themselves, then restore the database from backups.
The backup utility produces backup files containing the SQL statements needed to recreate the database. As a result, it restores a database with the bare minimum data rather than any additional information that might have built up in the tablespace file.
Use mariadb-dump to backup all of your InnoDB database tables, including the system tables in the mysql database that use InnoDB. You can find out what they are using the Information Schema.
If you only use InnoDB, you may find it easier to back up all databases and tables.
Then stop the MariaDB Server and remove the InnoDB tablespace files. In the data directory or the InnoDB data home directory, delete all the ibdata and ib_log files as well as any file with an .ibd or .frm extension.
Once this is done, restart the server and import the dump file:
Instead of having InnoDB write to the file system, you can set it to use raw disk partitions. On Windows and some Linux distributions, this allows you to perform non-buffered I/O without the file system overhead. Note that in many use cases this may not actually improve performance. Run tests to verify if there are any real gains for your application usage.
To enable a raw disk partition, first start MariaDB with the newraw option set on the tablespace:
When the MariaDB Server starts, it initializes the partition. Don't create or change any data, (any data written to InnoDB at this stage are lost on restart). Once the server has successful started, stop it then edit the configuration file again, changing the newraw keyword to raw.
When you start MariaDB again, it'll read and write InnoDB data to the given disk partition instead of the file system.
When defining a raw disk partition for InnoDB on the Windows operating system, use the same procedure as defined above, but when defining the path for the system variable, use ./ at the start:
The given path is synonymous with the Windows syntax for accessing the physical drive.
InnoDB creates some system tables within the InnoDB System Tablespace:
SYS_DATAFILES
SYS_FOREIGN
SYS_FOREIGN_COLS
SYS_TABLESPACES
These tables cannot be queried. However, you might see references to them in some places, such as in the table in the database.
This page is licensed: CC BY-SA / Gnu FDL
Instructions on tuning the number of InnoDB read and write I/O threads to match your system's disk I/O capabilities.
The InnoDB Read I/O Threads handle completion of read I/O requests, and the InnoDB Write I/O Threads handle completion of write I/O requests.
Starting with MariaDB Enterprise Server 10.5 and MariaDB Community Server 10.5, the InnoDB I/O Threads were replaced by the asynchronous I/O functionality in the .
For additional information, see "".
This page describes how to configure the InnoDB I/O Threads.
A guide to configuring the size and instances of the InnoDB Buffer Pool to optimize memory usage and cache performance.
In MariaDB Enterprise Server, the InnoDB storage engine uses the Buffer Pool as an in-memory cache. The Buffer Pool caches pages that were recently accessed. If a lot of pages are being accessed sequentially, the Buffer Pool also preemptively caches nearby pages. Pages are evicted using a least recently used (LRU) algorithm.
The contents of the Buffer Pool can be reloaded at startup, so that InnoDB does not have to function with a "cold" cache after a restart. To support this, the page numbers of all pages in the Buffer Pool can be dumped at shutdown. During startup, the page numbers are read from the dump, and InnoDB uses the page numbers to reload each page from its corresponding data file.
The size of each page in the Buffer Pool depends on the value of the system variable.
Learn how to manage InnoDB undo logs in MariaDB Enterprise Server, including moving them to separate tablespaces and enabling truncation.
The InnoDB undo log is a transaction log used by InnoDB to keep track of multiple row versions for multi-version concurrency control (MVCC). When a row's value changes, InnoDB stores old versions of the row in the Undo Log.
When transactions are committed and the old row versions are no longer necessary, the InnoDB Purge Threads asynchronously delete old row versions from the Undo Log in the background.
When a transaction is rolled back, InnoDB uses the Undo Log to rollback the transaction's changes.
For additional information, see "".
This page describes how to configure the InnoDB Undo Log.
CREATE TABLE t(id INT PRIMARY KEY, u INT UNSIGNED NOT NULL UNIQUE)
ENGINE=InnoDB;
INSERT INTO t(id,u) VALUES(1,1),(2,2),(3,3);
ALTER TABLE t ADD COLUMN
(d DATETIME DEFAULT current_timestamp(),
p POINT NOT NULL DEFAULT ST_GeomFromText('POINT(0 0)'),
t TEXT CHARSET utf8 DEFAULT 'The quick brown fox jumps over the lazy dog');
UPDATE t SET t=NULL WHERE id=3;
SELECT id,u,d,ST_AsText(p),t FROM t;
SELECT variable_value FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';path:size[:autoextend][:max:size][:autoshrink][mariadb]
...
innodb_temp_data_file_path=ibtmp1:32M:autoextend[mariadb]
...
innodb_temp_data_file_path=ibtmp1:32M;ibtmp2:32M:autoextendSET GLOBAL innodb_truncate_temporary_tablespace_now=1;[mariadb]
...
innodb_data_file_path=ibdata1:50M:autoextendBy default, the InnoDB undo log is located in the InnoDB system tablespace, which is defined by the innodb_data_file_path system variable. However, it can be helpful to configure separate undo log tablespaces to spread out I/O load between different files or storage devices.
InnoDB can be configured to use separate undo log tablespaces by setting the innodb_undo_tablespaces system variable. The separate undo log tablespaces will have file names of the format undoN, where N is an integer.
When you configure separate undo log tablespaces, you can also configure the separate undo log tablespaces to go to a specific directory by setting the innodb_undo_directory system variable. This is most helpful if you want to put the undo log tablespaces on a separate storage device.
Separate InnoDB undo log tablespaces must be configured prior to the initialization of the server's InnoDB data directory. If you try to configure separate InnoDB undo log tablespaces when the InnoDB data directory has already been initializes, you will see errors in the error log during startup similar to the following:
To safely configure separate InnoDB undo log tablespaces:
If you have preexisting data, backup your data with MariaDB Dump.
Ensure that the server is stopped:
Choose a configuration file for custom changes to system variables and options.
It is not recommended to make custom changes to Enterprise Server's default configuration files, because your custom changes can be overwritten by other default configuration files that are loaded after.
Ensure that your custom changes are read last by creating a custom configuration file in one of the included directories. Configuration files in included directories are read in alphabetical order. Ensure that your custom configuration file is read last by using the z- prefix in the file name.
Some example configuration file paths for different distributions are shown in the following table:
CentOS RHEL Rocky Linux SLES
/etc/my.cnf.d/z-custom-mariadb.cnf
Debian Ubuntu
/etc/mysql/mariadb.conf.d/z-custom-mariadb.cnf
Set the innodb_undo_tablespaces system variable in the configuration file.
It needs to be set in a group that are read by MariaDB Server, such as [mariadb] or [server].
For example, to set the number of tablespaces to 8:
If you want your InnoDB undo log tablespaces to be in a specific directory, then also set the innodb_undo_directory system variable in the configuration file:
For example, to set the directory to /innodb/undo:
If you want your InnoDB undo log tablespaces to be in a specific directory, then also create the directory, and give it the proper permissions:
Delete the current contents of the datadir and innodb_data_home_dir.
For example, if the default value of /var/lib/mysql is used for both:
Reinitialize the data directory using the MariaDB Install DB command.
Start the server:
Connect to the server using MariaDB Client:
If your server had preexisting data, then reload the backup taken at the beginning of the procedure.
Confirm that the configuration changes were properly applied by checking the values of the system variables using the SHOW GLOBAL VARIABLES statement:
Consider also enabling undo log truncation to increase performance of the InnoDB Purge Threads.
If a server is configured to have 2 or more separate InnoDB undo log files, then InnoDB undo log truncation can be enabled by setting the innodb_undo_log_truncate system variable using the SET GLOBAL statement. The SET GLOBAL statement requires the SUPER privilege.
When InnoDB undo log truncation is enabled, the InnoDB purge threads can truncate an entire undo log at once, rather than individually freeing each rollback segment within the undo log.
An undo log is truncated when its size exceeds the innodb_max_undo_log_size system variable.
The frequency at which the InnoDB purge threads check for undo logs to truncate is configured by setting the innodb_purge_rseg_truncate_frequency system variable using the SET GLOBAL statement.
To ensure that the changes survive server restarts, the system variables should also be set in a configuration file.
To enable InnoDB undo log truncation:
Connect to the server using MariaDB Client as the root@localhost user account or another user account with the SUPER privilege:
Set the innodb_undo_log_truncate system variable to ON using the SET GLOBAL statement.
For example:
If you would like to change the size at which undo logs are truncated, then also set the innodb_max_undo_log_size system variable to the new size using the SET GLOBAL statement.
For example, to set the size to 2 GB:
If you would like the InnoDB purge threads to check the undo logs more frequently, then also set the innodb_purge_rseg_truncate_frequency system variable to a lower value using the SET GLOBAL statement.
For example, to configure the purge threads to check the undo logs for truncation every 64 iterations:
Choose a configuration file for custom changes to system variables and options. It is not recommended to make custom changes to Enterprise Server's default configuration files, because your custom changes can be overwritten by other default configuration files that are loaded after.
Ensure that your custom changes are read last by creating a custom configuration file in one of the included directories. Configuration files in included directories are read in alphabetical order. Ensure that your custom configuration file is read last by using the z- prefix in the file name.
Some example configuration file paths for different distributions are shown in the following table:
CentOS RHEL Rocky Linux SLES
/etc/my.cnf.d/z-custom-mariadb.cnf
Debian Ubuntu
/etc/mysql/mariadb.conf.d/z-custom-mariadb.cnf
Set the system variables in the configuration file. It needs to be set in a group that are read by MariaDB Server, such as [mariadb] or [server]. When set in a configuration file, the innodb_max_undo_log_size value supports units, such as "M", "G", etc.
For example:
This page is: Copyright © 2025 MariaDB. All rights reserved.
[ERROR] InnoDB: Expected to open innodb_undo_tablespaces=8 but was able to find only 0
[ERROR] InnoDB: Plugin initialization aborted with error Generic error$ sudo systemctl stop mariadb[mariadb]
...
innodb_undo_tablespaces=8[mariadb]
...
innodb_undo_directory=/innodb/undo$ sudo mkdir -p /innodb/undo
$ sudo chown mysql:mysql /innodb/undo$ sudo rm -fr /var/lib/mysql/*$ sudo systemctl start mariadb$ mariadb --user=rootSHOW GLOBAL VARIABLES
WHERE Variable_name IN (
'innodb_undo_tablespaces',
'innodb_undo_directory'
);+-------------------------+--------------+
| Variable_name | Value |
+-------------------------+--------------+
| innodb_undo_directory | /innodb/undo |
| innodb_undo_tablespaces | 8 |
+-------------------------+--------------+$ mariadb --user=rootSET GLOBAL innodb_undo_log_truncate=ON;SET GLOBAL innodb_max_undo_log_size=(2 * 1024 * 1024 * 1024);SET GLOBAL innodb_purge_rseg_truncate_frequency=64;[mariadb]
...
innodb_undo_log_truncate=ON
innodb_max_undo_log_size=2G
innodb_purge_rseg_truncate_frequency=64Reset the bitmap in descriptor pages for the truncated pages.
Update the FSP_SIZE and FSP_FREE_LIMIT in header page.
In case of multiple files, calculate the truncated last file size and do the truncation in last file.
SYS_VIRTUAL
SYS_ZIP_DICT
SYS_ZIP_DICT_COLS
Starting with ES 10.5 and CS 10.5, the InnoDB I/O Threads have been replaced by the asynchronous I/O functionality in the InnoDB Background Thread Pool. In these versions, the innodb_read_io_threads and innodb_write_io_threads system variables have been repurposed. The value of each system variable is multiplied by 256 to determine the maximum number of concurrent asynchronous I/O requests that can be completed by the Background Thread Pool.
For example, if innodb_read_io_threads=2 and innodb_write_io_threads=4 are set, InnoDB are restricted to a maximum of 512 concurrent asynchronous read I/O requests and 1024 concurrent asynchronous write I/O requests.
When asynchronous I/O is enabled, the InnoDB I/O Threads do not receive the initial I/O request from query threads. Instead, the query threads submit asynchronous I/O requests directly to the operating system, and after the operating system performs the operation, the InnoDB I/O Threads handle completion of the request.
Asynchronous I/O is enabled by the innodb_use_native_aio system variable, which is enabled by default.
The innodb_read_io_threads system variable affects completion of the following types of reads:
Linear read-ahead (configured by innodb_read_ahead_threshold)
Random read-ahead (configured by innodb_random_read_ahead)
The innodb_write_io_threads system variable affects completion of the following types of writes:
Page flushing due to adaptive flushing (configured by innodb_adaptive_flushing and innodb_adaptive_flushing_lwm)
Page flushing due to buffer pool capacity (configured by [innodb_max_dirty_pages_pct] and [innodb-system-variables/#innodb_max_dirty_pages_pct_lwm|innodb_max_dirty_pages_pct_lwm)
Page flushing due to LRU page evictions (configured by innodb_lru_flush_size and innodb_lru_scan_depth)
The method to configure the number of I/O threads depends on the server version and whether a server restart are performed:
ES 10.5 and Later
No
Any ES Any CS
Yes.
Starting with , InnoDB's maximum number of asynchronous I/O requests can be changed dynamically by setting the innodb_read_io_threadsinnodb_write_io_threads system variables using the SET GLOBAL statement. The SET GLOBAL statement requires the SUPER privilege.
The value of each system variable is multiplied by 256 to determine the maximum number of asynchronous I/O requests that can be performed by the Background Thread Pool. For example, if you want to allow a maximum of 1024 concurrent asynchronous write I/O requests, the innodb_write_io_threads system variable should be set to 4 (since 1024/256=4).
To ensure that the change survives server restarts, the innodb_read_io_threads innodb_write_io_threads system variables should also be set in a configuration file.
To configure InnoDB's maximum number of asynchronous I/O requests with the SET GLOBAL statement, use the following procedure:
Connect to the server using MariaDB Client as the root@localhost user account or another user account with the SUPER privilege:
Set the innodb_read_io_threads and innodb_write_io_threads system variables to the new values using the SET GLOBAL statement.
For example:
Choose a configuration file for custom changes to system variables and options.
It is not recommended to make custom changes to Enterprise Server's default configuration files, because your custom changes can be overwritten by other default configuration files that are loaded after.
Ensure that your custom changes are read last by creating a custom configuration file in one of the included directories. Configuration files in included directories are read in alphabetical order. Ensure that your custom configuration file is read last by using the z- prefix in the file name.
Some example configuration file paths for different distributions are shown in the following table:
CentOS RHEL Rocky Linux SLES
/etc/my.cnf.d/z-custom-mariadb.cnf
Debian Ubuntu
/etc/mysql/mariadb.conf.d/z-custom-mariadb.cnf
Set the innodb_read_io_threads and innodb_write_io_threads system variables in the configuration file.
It needs to be set in a group that are read by MariaDB Server, such as [mariadb] or [server].
For example:
The number of I/O threads is configured by the innodb_read_io_threads and innodb_write_io_threads system variables.
To configure the number of InnoDB I/O Threads in a configuration file, use the following procedure:
Choose a configuration file for custom changes to system variables and options.
It is not recommended to make custom changes to Enterprise Server's default configuration files, because your custom changes can be overwritten by other default configuration files that are loaded after.
Ensure that your custom changes are read last by creating a custom configuration file in one of the included directories. Configuration files in included directories are read in alphabetical order. Ensure that your custom configuration file is read last by using the z- prefix in the file name.
Some example configuration file paths for different distributions are shown in the following table:
CentOS RHEL Rocky Linux SLES
/etc/my.cnf.d/z-custom-mariadb.cnf
Debian Ubuntu
/etc/mysql/mariadb.conf.d/z-custom-mariadb.cnf
Set the innodb_read_io_threads and innodb_write_io_threads system variables in the configuration file.
It needs to be set in a group that are read by MariaDB Server, such as [mariadb] or [server].
For example:
Restart the server:
Starting with , the server can use the configuration change without a restart if you use SET GLOBAL.
This page is: Copyright © 2025 MariaDB. All rights reserved.
For additional information, see "InnoDB Buffer Pool".
This page describes how to configure the InnoDB Buffer Pool.
The size of the InnoDB Buffer Pool can be configured by setting the innodb_buffer_pool_size system variable. On ES nodes that exclusively use the InnoDB storage engine, the InnoDB Buffer Pool should usually be between 50%-75% of the memory available.
4 GB
2 GB
8 GB
4-8 GB
16 GB
8-12 GB
32 GB
16-24 GB
64 GB
32-56 GB
128 GB
The method to configure the Buffer Pool size depends on whether a server restart are performed:
Any ES Any CS
No
.
Any ES Any CS
No
The size of the InnoDB buffer pool can be changed dynamically by setting the innodb_buffer_pool_size system variable using the SET GLOBAL statement. The SET GLOBAL statement requires the SUPER privilege.
To ensure that the change survives server restarts, the innodb_buffer_pool_size system variable should also be set in a configuration file.
To configure the InnoDB Buffer Pool with the SET GLOBAL statement, use the following procedure:
Connect to the server using MariaDB Client as the root@localhost user account or another user account with the SUPER privilege:
Set the innodb_buffer_pool_size system variable to the new size using the SET GLOBAL statement.
For example, to set the size to 2 GB:
Confirm that the resize operation has been completed by querying the Innodb_buffer_pool_resize_status status variable using the SHOW GLOBAL STATUS statement:
Choose a configuration file for custom changes to system variables and options. It is not recommended to make custom changes to Enterprise Server's default configuration files, because your custom changes can be overwritten by other default configuration files that are loaded after.
Ensure that your custom changes are read last by creating a custom configuration file in one of the included directories. Configuration files in included directories are read in alphabetical order. Ensure that your custom configuration file is read last by using the z- prefix in the file name.
Some example configuration file paths for different distributions are shown in the following table:
CentOS RHEL Rocky Linux SLES
/etc/my.cnf.d/z-custom-mariadb.cnf
Debian Ubuntu
/etc/mysql/mariadb.conf.d/z-custom-mariadb.cnf
Set the innodb_buffer_pool_size system variable in the configuration file. It needs to be set in a group that are read by MariaDB Server, such as [mariadb] or [server]. When set in a configuration file, the value supports units, such as "M", "G", etc.
For example, to set the size to 2 GB:
The size of the InnoDB Buffer Pool can be changed by setting the innodb_buffer_pool_size system variable in a configuration file.
To configure the InnoDB Buffer Pool in a configuration file, use the following procedure:
Choose a configuration file for custom changes to system variables and options. It is not recommended to make custom changes to Enterprise Server's default configuration files, because your custom changes can be overwritten by other default configuration files that are loaded after. Ensure that your custom changes are read last by creating a custom configuration file in one of the included directories. Configuration files in included directories are read in alphabetical order. Ensure that your custom configuration file is read last by using the z- prefix in the file name.
Some example configuration file paths for different distributions are shown in the following table:
CentOS RHEL Rocky Linux SLES
/etc/my.cnf.d/z-custom-mariadb.cnf
Debian Ubuntu
/etc/mysql/mariadb.conf.d/z-custom-mariadb.cnf
Set the innodb_buffer_pool_size system variable in the configuration file.
It needs to be set in a group that are read by MariaDB Server, such as [mariadb] or [server].
When set in a configuration file, the value supports units, such as "M", "G", etc.
For example, to set the size to 2 GB:
Restart the server:
The server can use the configuration change without a restart if you use SET GLOBAL.
This page is: Copyright © 2025 MariaDB. All rights reserved.
An overview of supported online schema change operations in InnoDB, detailing which DDL statements can be performed without locking the table.
Detailed information on the COMPACT row format, which reduces storage space by roughly 20% compared to REDUNDANT, handling NULLs and variable-length columns efficiently.
A starting point for diagnosing InnoDB issues, recommending checks on error logs, deadlocks, and table integrity using various tools.
As with most errors, first take a look at the contents of the . If dealing with a deadlock, setting the option (off by default) will output details of all deadlocks to the error log.
It can also help to enable the various relating to the problem you are experiencing. There are four types: the standard InnoDB monitor, the InnoDB Lock Monitor, InnoDB Tablespace Monitor and the InnoDB Table Monitor.
Running will help determine whether there are errors in the table.
For problems with the InnoDB Data Dictionary, see .
[mariadb]
...
innodb_data_file_path=ibdata1:12M;ibdata2:50M:autoextend[mariadb]
...
innodb_data_file_path=ibdata1:12M;ibdata2:50M:autoextend:autoshrinkSELECT TABLE_NAME FROM information_schema.TABLES
WHERE TABLE_SCHEMA = 'mysql' AND ENGINE = 'InnoDB';$ mariadb-dump -u root -p --all-databases > full-backup.sql$ mysql -u root -p < full-backup.sql[mariadb]
...
innodb_data_file_path=/dev/sdc:10Gnewraw[mariadb]
...
innodb_data_file_path=/dev/sdc:10Graw[mariadb]
...
innodb_data_file_path=//./E::10Graw$ mariadb --user=rootSET GLOBAL innodb_read_io_threads=8;
SET GLOBAL innodb_write_io_threads=8;[mariadb]
...
innodb_read_io_threads=8
innodb_write_io_threads=8[mariadb]
...
innodb_read_io_threads=8
innodb_write_io_threads=8$ sudo systemctl restart mariadb$ mariadb --user=rootSET GLOBAL innodb_buffer_pool_size=(2 * 1024 * 1024 * 1024);SHOW GLOBAL STATUS
LIKE 'Innodb_buffer_pool_resize_status';+----------------------------------+----------------------------------------------------+
| Variable_name | Value |
+----------------------------------+----------------------------------------------------+
| Innodb_buffer_pool_resize_status | Completed resizing buffer pool at 200904 17:49:48. |
+----------------------------------+----------------------------------------------------+[mariadb]
...
innodb_buffer_pool_size=2G[mariadb]
...
innodb_buffer_pool_size=2G$ sudo systemctl restart mariadb64-96 GB
256 GB
128-192 GB
This page is licensed: CC BY-SA / Gnu FDL
COMPACT Row FormatIf you performed a physical upgrade from older version of MariaDB Server or MySQL to a newer MariaDB Server version, then some of your tables may still use COMPACT row format.
Compact row format does not store large columns as efficiently as the Dynamic row format.
Compact row format limits indexing column values to 767 bytes, which is significant smaller than the Dynamic row format.
The easiest way to create an InnoDB table that uses the COMPACT row format is by setting the ROW_FORMAT table option to COMPACT in a CREATE TABLE or ALTER TABLE statement.
It is recommended to set the innodb_strict_mode system variable to ON when using this row format.
The COMPACT row format is supported by both the Antelope and the Barracuda file formats, so tables with this row format can be created regardless of the value of the innodb_file_format system variable.
For example:
The COMPACT row format supports index prefixes up to 767 bytes.
All InnoDB row formats can store certain kinds of data in overflow pages. This allows for the maximum row size of an InnoDB table to be larger than the maximum amount of data that can be stored in the row's main data page. See Maximum Row Size for more information about the other factors that can contribute to the maximum row size for InnoDB tables.
In the COMPACT row format variable-length columns, such as columns using the VARBINARY, VARCHAR, BLOB and TEXT data types, can be partially stored in overflow pages.
InnoDB only considers using overflow pages if the table's row size is greater than half of innodb_page_size. If the row size is greater than this, then InnoDB chooses variable-length columns to be stored on overflow pages until the row size is less than half of innodb_page_size.
For VARBINARY, VARCHAR, BLOB and TEXT columns, only values longer than 767 bytes are considered for storage on overflow pages. Bytes that are stored to track a value's length do not count towards this limit. This limit is only based on the length of the actual column's data.
Fixed-length columns greater than 767 bytes are encoded as variable-length columns, so they can also be stored in overflow pages if the table's row size is greater than half of innodb_page_size. Even though a column using the CHAR data type can hold at most 255 characters, a CHAR column can still exceed 767 bytes in some cases. For example, a char(255) column can exceed 767 bytes if the character set is utf8mb4.
If a column is chosen to be stored on overflow pages, then the first 767 bytes of the column's value and a 20-byte pointer to the column's first overflow page are stored on the main page. Each overflow page is the size of innodb_page_size. If a column is too large to be stored on a single overflow page, then it is stored on multiple overflow pages. Each overflow page contains part of the data and a 20-byte pointer to the next overflow page, if a next page exists.
This page is licensed: CC BY-SA / Gnu FDL
SET SESSION innodb_strict_mode=ON;
CREATE TABLE tab (
id INT,
str VARCHAR(50)
) ENGINE=InnoDB ROW_FORMAT=COMPACT;InnoDB schema changes are performed using the following DDL statements:
InnoDB schema changes and online DDL are performed with a wide range of statements:
Each operation supports a subset of the following algorithms: INSTANT, NOCOPY, INPLACE, or COPY.
By default, InnoDB will use the most efficient algorithm supported by an operation. This behavior can be changed by using the ALGORITHM clause with the ALTER TABLE statement or by changing the value of the alter_algorithm system variable.
Each operation supports a subset of the following locking strategies: NONE, SHARED, or EXCLUSIVE.
By default, InnoDB will use the most permissive locking strategy supported by an operation. This behavior can be changed by using the LOCK clause with the ALTER TABLE statement.
Operations support instant algorithm
Yes
Operations support no-copy algorithm
Yes
Operations support in-place algorithm
Yes
InnoDB Schema Changes with the INPLACE Algorithm
Adding a column
Yes
This page is outdated. It's left in place because release notes for old MariaDB versions refer to it (MariaDB < 10.3).
This page is outdated. It's left in place because release notes for old MariaDB versions refer to it (MariaDB < 10.3).
The InnoDB implementation has diverged substantially from the InnoDB in MySQL. Therefore, in these versions, the InnoDB version is no longer associated with a MySQL release version.
The default InnoDB implementation is based on InnoDB from MySQL 5.7. See Why MariaDB uses InnoDB instead of XtraDB from MariaDB 10.2 for more information.
XtraDB is a performance enhanced fork of InnoDB. For compatibility reasons, the still retain their original innodb prefixes. If the documentation says that something applies to InnoDB, then it usually also applies to the XtraDB fork, unless explicitly stated otherwise. In these versions, it is still possible to use InnoDB instead of XtraDB. See for more information.
Some examples of divergences between MariaDB's InnoDB and MySQL's InnoDB are:
(which is based on MySQL 5.6) included encryption and variable-size page compression before MySQL 5.7 introduced them.
(based on MySQL 5.7) introduced persistent AUTO_INCREMENT () in a GA release before MySQL 8.0.
(based on MySQL 5.7) introduced instant ADD COLUMN () before MySQL.
This page is licensed: CC BY-SA / Gnu FDL
The redo log is a disk-based transaction log used during crash recovery to replay incomplete transactions and ensure data durability.
Directly editing or moving the redo logs can cause corruption, and should never normally be attempted.
The InnoDB storage engine in MariaDB Enterprise Server employs a Redo Log to ensure data is written to disk reliably, even in the event of a crash. This is achieved by the Redo Log acting as a transaction log.
Redo Log records are uniquely identified by a Log Sequence Number (LSN). The Redo Log consists of circular log files of a fixed size, where older records are routinely overwritten by newer ones.
InnoDB periodically performs checkpoints. During a checkpoint operation, InnoDB writes (flushes) the Redo Log records to the InnoDB tablespace files.
In the event of a server crash, InnoDB utilizes the Redo Log for crash recovery during the subsequent server startup. It locates the last checkpoint within the Redo Log and then replays the Redo Log records generated since that checkpoint, effectively flushing these pending changes to the InnoDB tablespace files.
The redo log files are typically named ib_logfileN, where N is an integer. However, starting with , there is a single redo log file, consistently named ib_logfile0. The location of these redo log files is determined by the innodb_log_group_home_dir system variable, if configured. If this variable is not set, the redo log files are created in the directory specified by the datadir system variable. The redo log plays a crucial role during crash recovery and in the background process of flushing transactions to the tablespaces.
The system variable determines how often the transactions are flushed to the redo log, and it is important to achieve a good balance between speed and reliability.
When both (the default) is set and the is enabled, there is one less sync to disk inside InnoDB during commit (2 syncs shared between a group of transactions instead of 3). See for more information.
The redo log group capacity is the total combined size of all InnoDB redo logs. The relevant factors are:
From , there is 1 redo log.
The size of each redo log file is configured by the system variable. This can safely be set to a much higher value from . Before , resizing required the server to be restarted. From the variable can be set dynamically.
The redo log group capacity is determined by the following calculation:
innodb_log_group_capacity = *
For example, if is set to 2G and is set to 2, then we would have the following:
innodb_log_group_capacity = *
= 2G * 2
= 4G
MariaDB starting with
The number of redo log files is fixed.
The size of redo log files can be changed with the following process:
Stop the server.
To change the log file size, configure .
Start the server.
Records within the InnoDB redo log are identified via a log sequence number (LSN).
When InnoDB performs a checkpoint, it writes the LSN of the oldest dirty page in the to the InnoDB redo log. If a page is the oldest dirty page in the , then that means that all pages with lower LSNs have been flushed to the physical InnoDB tablespace files. If the server were to crash, then InnoDB would perform crash recovery by only applying log records with LSNs that are greater than or equal to the LSN of the oldest dirty page written in the last checkpoint.
Checkpoints are one of the tasks performed by the InnoDB master background thread. This thread schedules checkpoints 7 seconds apart when the server is very active, but checkpoints can happen more frequently when the server is less active.
Dirty pages are not actually flushed from the buffer pool to the physical InnoDB tablespace files during a checkpoint. That process happens asynchronously on a continuous basis by InnoDB's write I/O background threads configured by the system variable. If you want to make this process more aggressive, then you can decrease the value of the system variable. You may also need to better tune InnoDB's I/O capacity on your system by setting the system variable.
The checkpoint age is the amount of data written to the InnoDB redo log since the last checkpoint.
MariaDB starting with
reintroduced the status variable for determining the checkpoint age.
The checkpoint age can also be determined by the process shown below.
To determine the InnoDB checkpoint age, do the following:
Query .
Find the LOG section:
Perform the following calculation:
innodb_checkpoint_age = Log sequence number - Last checkpoint at
In the example above, that would be:
innodb_checkpoint_age = Log sequence number - Last checkpoint at
= 252794398789379 - 252792767756840
= 1631032539 bytes
The redo log occupancy is the percentage of the InnoDB redo log capacity that is taken up by dirty pages that have not yet been flushed to the physical InnoDB tablespace files in a checkpoint. Therefore, it's determined by the following calculation:
innodb_log_occupancy = /
For example, if is 1.5G and is 4G, then we would have the following:
innodb_log_occupancy = /
= 1.5G / 4G
= 0.375
If the calculated value for redo log occupancy is too close to 1.0, then the InnoDB redo log capacity may be too small for the current workload.
A number of redo log improvements were made in :
Autosize innodb_buffer_pool_chunk_size ().
Improve the redo log for concurrency ().
Remove FIL_PAGE_FILE_FLUSH_LSN ().
Before , created a zero-length ib_logfile0 as a dummy placeholder. From (), the size of that dummy file was increased to 12304 (0x3010) bytes, and all updates of FIL_PAGE_FILE_FLUSH_LSN in the first page of the system tablespace are removed.
From , if the server is started up with a zero-sized ib_logfile0, it is assumed that an upgrade is being performed after a backup had been prepared. The start LSN will then be read from FIL_PAGE_FILE_FLUSH_LSN, and a new log file are created starting from exactly that LSN.
Manually creating a zero-sized ib_logfile0 without manually updating the FIL_PAGE_FILE_FLUSH_LSN in the system tablespace to a recent enough LSN may result in error messages such as "page LSN is in the future". If a log was discarded while some changes had already been written to data pages, all sort of corruption may occur.
If the database was initialized with a server that never updates the FIL_PAGE_FILE_FLUSH_LSN field, then any server startup attempts with a zero-size ib_logfile0 are refused because of an invalid LSN. If that field was ever updated with a valid LSN by an older server, this safety mechanism cannot work, and the server may "rewind" to an earlier LSN.
This page is licensed: CC BY-SA / Gnu FDL
Dropping a column
Yes
Reordering columns
Yes
Changing a column to NULL
Yes
Changing a column to NOT NULL
Yes
Adding a new ENUM option
Yes
Adding a new SET option
Yes
Adding system versioning
Yes
Removing system versioning
Yes
Setting a column's DEFAULT
Yes
Removing a column's DEFAULT
Yes
Adding a primary key
Yes
Dropping a primary key
Yes
Adding an index
Yes
Dropping an index
Yes
Adding a foreign key
Yes
Dropping a foreign key
Yes
Setting the next AUTO_INCREMENT value
Yes
Setting the row format
Yes
Setting the block size for the Compressed row format
Yes
Enabling page compression
Yes
Setting the page compression level
Yes
Disabling page compression
Yes
Enabling data-at-rest encryption
Yes
Setting the encryption key ID
Yes
Disabling data-at-rest encryption
Yes
Adding a constraint
Yes
Dropping a constraint
Yes
Rebuilding the table
Yes
Renaming the table
Yes
InnoDB 5.7.18
InnoDB 5.7.14
InnoDB 5.6.36
InnoDB 5.6.35
InnoDB 5.6.33
InnoDB 5.6.32
InnoDB 5.6.31
InnoDB 5.6.30
InnoDB 5.6.29
InnoDB 5.6.36
InnoDB 5.6.35
InnoDB 5.6.33
InnoDB 5.6.32
InnoDB 5.6.31
InnoDB 5.6.30
InnoDB 5.6.29
InnoDB 5.6.28
InnoDB 5.6.27
InnoDB 5.6.26
InnoDB 5.6.25
InnoDB 5.6.24
InnoDB 5.6.23
InnoDB 5.6.22
InnoDB 5.6.21
InnoDB 5.6.20
InnoDB 5.6.19
InnoDB 5.6.17
InnoDB 5.6.15
InnoDB 5.6.14
No longer reported
InnoDB 5.7.20
InnoDB 5.7.19
InnoDB 5.7.14
InnoDB 5.7.29
InnoDB 5.7.23
InnoDB 5.7.22
InnoDB 5.7.21
InnoDB 5.7.20
InnoDB 5.7.19
InnoDB 5.6.49
InnoDB 5.6.47
InnoDB 5.6.44
InnoDB 5.6.42
InnoDB 5.6.39
InnoDB 5.6.37
InnoDB 5.6.43
InnoDB 5.6.42
InnoDB 5.6.40
InnoDB 5.6.39
InnoDB 5.6.38
InnoDB 5.6.37
Location
Set by (Defaults to )
Quantity
1 (ES 10.5+, CS 10.5+)
Size
Set by (default varies)
= 1.5 GB of redo log written since last checkpoint
Transaction Log
InnoDB Redo Log
Storage Engine
InnoDB
Purpose
Crash Safety
Availability
All ES and CS versions
InnoDB Strict Mode enforces stricter SQL compliance, returning errors instead of warnings for invalid CREATE TABLE options or potential data loss.
strict mode is similar to . When it is enabled, certain InnoDB warnings become errors instead.
InnoDB strict mode is enabled by default.
InnoDB strict mode can be enabled or disabled by configuring the server system variable.
Its global value can be changed dynamically with :
Its value for the current session can also be changed dynamically with
Learn how to configure InnoDB to store each table in its own .ibd file, enabling features like table compression and easier space reclamation.
When you create a table using the , data written to that table is stored on the file system in a data file called a tablespace. Tablespace files contain both the data and indexes.
When is set, InnoDB uses one tablespace file per InnoDB table. These tablespace files have the .ibd extension. When is set, InnoDB stores all tables in the .
InnoDB versions in MySQL 5.7 and above also support an additional type of tablespace called that are created with . However, InnoDB versions in MariaDB Server do not support general tablespaces or .
[mariadb]
...
innodb_log_file_size=2GSET GLOBAL innodb_log_file_size=(2 * 1024 * 1024 * 1024);
SHOW GLOBAL VARIABLES
LIKE 'innodb_log_file_size';+----------------------+------------+
| Variable_name | Value |
+----------------------+------------+
| innodb_log_file_size | 2147483648 |
+----------------------+------------+---
LOG
---
Log sequence number 252794398789379
Log flushed up to 252794398789379
Pages flushed up to 252792767756840
Last checkpoint at 252792767756840
0 pending log flushes, 0 pending chkp writes
23930412 log i/o's done, 2.03 log i/o's/secondIt can also be set in a server option group in an option file prior to starting up the server:
If InnoDB strict mode is enabled, and if a DDL statement is executed and invalid or conflicting table options are specified, then an error is raised. The error will only be a generic error that says the following:
However, more details about the error can be found by executing SHOW WARNINGS.
For example, the error is raised in the following cases:
The KEY_BLOCK_SIZE table option is set to a non-zero value, but the ROW_FORMAT table option is set to some row format other than the COMPRESSED row format:
The KEY_BLOCK_SIZE table option is set to a non-zero value, but the configured value is larger than either 16 or the value of the innodb_page_size system variable, whichever is smaller.
The KEY_BLOCK_SIZE table option is set to a non-zero value, but the innodb_file_per_table system variable is not set to ON.
The KEY_BLOCK_SIZE table option is set to a non-zero value, but it is not set to one of the supported values: [1, 2, 4, 8, 16].
The ROW_FORMAT table option is set to the COMPRESSED row format, but the innodb_file_per_table system variable is not set to ON.
The ROW_FORMAT table option is set to a value, but it is not set to one of the values supported by InnoDB: REDUNDANT, COMPACT, DYNAMIC, and COMPRESSED.
Either the KEY_BLOCK_SIZE table option is set to a non-zero value or the ROW_FORMAT table option is set to the COMPRESSED row format, but the innodb_page_size system variable is set to a value greater than 16k.
The DATA DIRECTORY table option is set, but the innodb_file_per_table system variable is not set to ON.
The DATA DIRECTORY table option is set, but the table is a temporary table.
The INDEX DIRECTORY table option is set.
The PAGE_COMPRESSED table option is set to 1, so InnoDB page compression is enabled, but the ROW_FORMAT table option is set to some row format other than the COMPACT or DYNAMIC row formats.
The PAGE_COMPRESSED table option is set to 1, so InnoDB page compression is enabled, but the innodb_file_per_table system variable is not set to ON.
The PAGE_COMPRESSED table option is set to 1, so InnoDB page compression is enabled, but the KEY_BLOCK_SIZE table option is also specified.
The PAGE_COMPRESSION_LEVEL table option is set, but
the PAGE_COMPRESSED table option is set to 0, so InnoDB page compression is disabled.
If InnoDB strict mode is enabled, and if a table uses the COMPRESSED row format, and if the table's KEY_BLOCK_SIZE is too small to contain a row, then an error is returned by the statement.
If InnoDB strict mode is enabled, and if a table exceeds its row format's maximum row size, then InnoDB will return an error.
See Troubleshooting Row Size Too Large Errors with InnoDB for more information.
This page is licensed: CC BY-SA / Gnu FDL
SET GLOBAL innodb_strict_mode=ON;SET SESSION innodb_strict_mode=ON;[mariadb]
...
innodb_strict_mode=ONERROR 1005 (HY000): Can't create table `db1`.`tab` (errno: 140 "Wrong create options")SET SESSION innodb_strict_mode=ON;
CREATE OR REPLACE TABLE tab (
id INT PRIMARY KEY,
str VARCHAR(50)
)
KEY_BLOCK_SIZE=4
ROW_FORMAT=DYNAMIC;
ERROR 1005 (HY000): Can't create table `db1`.`tab` (errno: 140 "Wrong create options")
SHOW WARNINGS;
+---------+------+--------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------------------------------------+
| Warning | 1478 | InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE. |
| Error | 1005 | Can't create table `db1`.`tab` (errno: 140 "Wrong create options") |
| Warning | 1030 | Got error 140 "Wrong create options" from storage engine InnoDB |
+---------+------+--------------------------------------------------------------------+
3 rows in set (0.000 sec)SET SESSION innodb_strict_mode=ON;
CREATE OR REPLACE TABLE tab (
id INT PRIMARY KEY,
str VARCHAR(50)
)
KEY_BLOCK_SIZE=16;
ERROR 1005 (HY000): Can't create table `db1`.`tab` (errno: 140 "Wrong create options")
SHOW WARNINGS;
+---------+------+--------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------------------------------------+
| Warning | 1478 | InnoDB: KEY_BLOCK_SIZE=16 cannot be larger than 8. |
| Error | 1005 | Can't create table `db1`.`tab` (errno: 140 "Wrong create options") |
| Warning | 1030 | Got error 140 "Wrong create options" from storage engine InnoDB |
+---------+------+--------------------------------------------------------------------+
3 rows in set (0.000 sec)SET GLOBAL innodb_file_per_table=OFF;
SET SESSION innodb_strict_mode=ON;
CREATE OR REPLACE TABLE tab (
id INT PRIMARY KEY,
str VARCHAR(50)
)
KEY_BLOCK_SIZE=4;
ERROR 1005 (HY000): Can't create table `db1`.`tab` (errno: 140 "Wrong create options")
SHOW WARNINGS;
+---------+------+--------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------------------------------------+
| Warning | 1478 | InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. |
| Error | 1005 | Can't create table `db1`.`tab` (errno: 140 "Wrong create options") |
| Warning | 1030 | Got error 140 "Wrong create options" from storage engine InnoDB |
+---------+------+--------------------------------------------------------------------+
3 rows in set (0.000 sec)SET SESSION innodb_strict_mode=ON;
CREATE OR REPLACE TABLE tab (
id INT PRIMARY KEY,
str VARCHAR(50)
)
KEY_BLOCK_SIZE=5;
ERROR 1005 (HY000): Can't create table `db1`.`tab` (errno: 140 "Wrong create options")
SHOW WARNINGS;
+---------+------+-----------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+-----------------------------------------------------------------------+
| Warning | 1478 | InnoDB: invalid KEY_BLOCK_SIZE = 5. Valid values are [1, 2, 4, 8, 16] |
| Error | 1005 | Can't create table `db1`.`tab` (errno: 140 "Wrong create options") |
| Warning | 1030 | Got error 140 "Wrong create options" from storage engine InnoDB |
+---------+------+-----------------------------------------------------------------------+
3 rows in set (0.000 sec)SET GLOBAL innodb_file_per_table=OFF;
SET SESSION innodb_strict_mode=ON;
CREATE OR REPLACE TABLE tab (
id INT PRIMARY KEY,
str VARCHAR(50)
)
ROW_FORMAT=COMPRESSED;
ERROR 1005 (HY000): Can't create table `db1`.`tab` (errno: 140 "Wrong create options")
SHOW WARNINGS;
+---------+------+--------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------------------------------------+
| Warning | 1478 | InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table. |
| Error | 1005 | Can't create table `db1`.`tab` (errno: 140 "Wrong create options") |
| Warning | 1030 | Got error 140 "Wrong create options" from storage engine InnoDB |
+---------+------+--------------------------------------------------------------------+
3 rows in set (0.000 sec)SET SESSION innodb_strict_mode=ON;
CREATE OR REPLACE TABLE tab (
id INT PRIMARY KEY,
str VARCHAR(50)
)
ROW_FORMAT=PAGE;
ERROR 1005 (HY000): Can't create table `db1`.`tab` (errno: 140 "Wrong create options")
SHOW WARNINGS;
+---------+------+--------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------------------------------------+
| Warning | 1478 | InnoDB: invalid ROW_FORMAT specifier. |
| Error | 1005 | Can't create table `db1`.`tab` (errno: 140 "Wrong create options") |
| Warning | 1030 | Got error 140 "Wrong create options" from storage engine InnoDB |
+---------+------+--------------------------------------------------------------------+
3 rows in set (0.000 sec)SET SESSION innodb_strict_mode=ON;
CREATE OR REPLACE TABLE tab (
id INT PRIMARY KEY,
str VARCHAR(50)
)
ROW_FORMAT=COMPRESSED;
ERROR 1005 (HY000): Can't create table `db1`.`tab` (errno: 140 "Wrong create options")
SHOW WARNINGS;
+---------+------+-----------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+-----------------------------------------------------------------------+
| Warning | 1478 | InnoDB: Cannot create a COMPRESSED table when innodb_page_size > 16k. |
| Error | 1005 | Can't create table `db1`.`tab` (errno: 140 "Wrong create options") |
| Warning | 1030 | Got error 140 "Wrong create options" from storage engine InnoDB |
+---------+------+-----------------------------------------------------------------------+
3 rows in set (0.00 sec)SET GLOBAL innodb_file_per_table=OFF;
SET SESSION innodb_strict_mode=ON;
CREATE OR REPLACE TABLE tab (
id INT PRIMARY KEY,
str VARCHAR(50)
)
DATA DIRECTORY='/mariadb';
ERROR 1005 (HY000): Can't create table `db1`.`tab` (errno: 140 "Wrong create options")
SHOW WARNINGS;
+---------+------+--------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------------------------------------+
| Warning | 1478 | InnoDB: DATA DIRECTORY requires innodb_file_per_table. |
| Error | 1005 | Can't create table `db1`.`tab` (errno: 140 "Wrong create options") |
| Warning | 1030 | Got error 140 "Wrong create options" from storage engine InnoDB |
+---------+------+--------------------------------------------------------------------+
3 rows in set (0.000 sec)SET SESSION innodb_strict_mode=ON;
CREATE OR REPLACE TEMPORARY TABLE tab (
id INT PRIMARY KEY,
str VARCHAR(50)
)
DATA DIRECTORY='/mariadb';
ERROR 1005 (HY000): Can't create table `db1`.`tab` (errno: 140 "Wrong create options")
SHOW WARNINGS;
+---------+------+--------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------------------------------------+
| Warning | 1478 | InnoDB: DATA DIRECTORY cannot be used for TEMPORARY tables. |
| Error | 1005 | Can't create table `db1`.`tab` (errno: 140 "Wrong create options") |
| Warning | 1030 | Got error 140 "Wrong create options" from storage engine InnoDB |
+---------+------+--------------------------------------------------------------------+
3 rows in set (0.000 sec)SET SESSION innodb_strict_mode=ON;
CREATE OR REPLACE TABLE tab (
id INT PRIMARY KEY,
str VARCHAR(50)
)
INDEX DIRECTORY='/mariadb';
ERROR 1005 (HY000): Can't create table `db1`.`tab` (errno: 140 "Wrong create options")
SHOW WARNINGS;
+---------+------+--------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------------------------------------+
| Warning | 1478 | InnoDB: INDEX DIRECTORY is not supported |
| Error | 1005 | Can't create table `db1`.`tab` (errno: 140 "Wrong create options") |
| Warning | 1030 | Got error 140 "Wrong create options" from storage engine InnoDB |
+---------+------+--------------------------------------------------------------------+
3 rows in set (0.000 sec)SET SESSION innodb_strict_mode=ON;
CREATE OR REPLACE TABLE tab (
id INT PRIMARY KEY,
str VARCHAR(50)
)
PAGE_COMPRESSED=1
ROW_FORMAT=COMPRESSED;
ERROR 1005 (HY000): Can't create table `db1`.`tab` (errno: 140 "Wrong create options")
SHOW WARNINGS;
+---------+------+--------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------------------------------------+
| Warning | 140 | InnoDB: PAGE_COMPRESSED table can't have ROW_TYPE=COMPRESSED |
| Error | 1005 | Can't create table `db1`.`tab` (errno: 140 "Wrong create options") |
| Warning | 1030 | Got error 140 "Wrong create options" from storage engine InnoDB |
+---------+------+--------------------------------------------------------------------+
3 rows in set (0.000 sec)SET GLOBAL innodb_file_per_table=OFF;
SET SESSION innodb_strict_mode=ON;
CREATE OR REPLACE TABLE tab (
id INT PRIMARY KEY,
str VARCHAR(50)
)
PAGE_COMPRESSED=1;
ERROR 1005 (HY000): Can't create table `db1`.`tab` (errno: 140 "Wrong create options")
SHOW WARNINGS;
+---------+------+--------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------------------------------------+
| Warning | 140 | InnoDB: PAGE_COMPRESSED requires innodb_file_per_table. |
| Error | 1005 | Can't create table `db1`.`tab` (errno: 140 "Wrong create options") |
| Warning | 1030 | Got error 140 "Wrong create options" from storage engine InnoDB |
+---------+------+--------------------------------------------------------------------+
3 rows in set (0.000 sec)SET SESSION innodb_strict_mode=ON;
CREATE OR REPLACE TABLE tab (
id INT PRIMARY KEY,
str VARCHAR(50)
)
PAGE_COMPRESSED=1
KEY_BLOCK_SIZE=4;
ERROR 1005 (HY000): Can't create table `db1`.`tab` (errno: 140 "Wrong create options")
SHOW WARNINGS;
+---------+------+--------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------------------------------------+
| Warning | 140 | InnoDB: PAGE_COMPRESSED table can't have key_block_size |
| Error | 1005 | Can't create table `db1`.`tab` (errno: 140 "Wrong create options") |
| Warning | 1030 | Got error 140 "Wrong create options" from storage engine InnoDB |
+---------+------+--------------------------------------------------------------------+
3 rows in set (0.000 sec)SET SESSION innodb_strict_mode=ON;
CREATE OR REPLACE TABLE tab (
id INT PRIMARY KEY,
str VARCHAR(50)
)
PAGE_COMPRESSED=0
PAGE_COMPRESSION_LEVEL=9;
ERROR 1005 (HY000): Can't create table `db1`.`tab` (errno: 140 "Wrong create options")
SHOW WARNINGS;
+---------+------+--------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------------------------------------+
| Warning | 140 | InnoDB: PAGE_COMPRESSION_LEVEL requires PAGE_COMPRESSED |
| Error | 1005 | Can't create table `db1`.`tab` (errno: 140 "Wrong create options") |
| Warning | 1030 | Got error 140 "Wrong create options" from storage engine InnoDB |
+---------+------+--------------------------------------------------------------------+
3 rows in set (0.000 sec)ERROR 1118 (42000): Row size too large (> 8126). Changing some columns to
TEXT OR BLOB may help. IN current row format, BLOB prefix of 0 bytes IS stored inline.By default, InnoDB's file-per-table tablespaces are created in the system's data directory, which is defined by the datadir system variable. The system variable innodb_data_home_dir will not change the location of file-per-table tablespaces.
In the event that you have a specific tablespace that you need stored in a dedicated path, you can set the location using the DATA DIRECTORY table option when you create the table.
For instance,
MariaDB then creates a database directory on the configured path and the file-per-table tablespace are created inside that directory. On Unix-like operating systems, you can see the file using the ls command:
Note, the system user that runs the MariaDB Server process (which is usually mysql) must have write permissions on the given path.
InnoDB's file-per-table tablespaces are transportable, which means that you can copy a file-per-table tablespace from one MariaDB Server to another server. You may find this useful in cases where you need to transport full tables between servers and don't want to use backup tools like mariadb-backup or mariadb-dump. In fact, this process can even be used with mariadb-backup in some cases, such as when restoring partial backups or when restoring individual tables or partitions from a backup.
You can copy the transportable tablespace of a non-partitioned table from one server to another by exporting the tablespace file from the original server, and then importing the tablespace file into the new server.
MariaDB starting with
The workflow is simplified starting from . On the source server, simply do:
On the destination server, simply do:
You can export a non-partitioned table by locking the table and copying the table's .ibd and .cfg files from the relevant tablespace location for the table to a backup location. For example, the process would go like this:
First, use the FLUSH TABLES ... FOR EXPORT statement on the target table:
This forces the server to close the table and provides your connection with a read lock on the table.
Then, while your connection still holds the lock on the table, copy the tablespace file and the metadata file to a safe directory:
Then, once you've copied the files, you can release the lock with UNLOCK TABLES:
You can import a non-partitioned table by discarding the table's original tablespace, copying the table's .ibd and .cfg files from the backup location to the relevant tablespace location for the table, and then telling the server to import the tablespace.
For example, the process would go like this:
First, on the destination server, you need to create a copy of the table. Use the same CREATE TABLE statement that was used to create the table on the original server.
Then, use ALTER TABLE ... DISCARD TABLESPACE to discard the new table's tablespace:
Then, copy the .ibd and .cfg files from the original server to the relevant directory on the target MariaDB Server.
File-per-table tablespaces can be imported with just the .ibd file in many cases. If you do not have the tablespace's .cfg file for whatever reason, then it is usually worth trying to import the tablespace with just the .ibd file.
Then, once the files are in the proper directory on the target server, use ALTER TABLE ... IMPORT TABLESPACE to import the new table's tablespace:
Currently, MariaDB does not directly support the transport of tablespaces from partitioned tables. See MDEV-10568 for more information about that. It is still possible to transport partitioned tables if we use a workaround. You can copy the transportable tablespaces of a partitioned table from one server to another by exporting the tablespace file of each partition from the original server, and then importing the tablespace file of each partition into the new server.
You can export a partitioned table by locking the table and copying the .ibd and .cfg files of each partition from the relevant tablespace location for the partition to a backup location. For example, the process would go like this:
First, let's create a test table with some data on the original server:
Then, we need to export the partitioned tablespace from the original server, which follows the same process as exporting non-partitioned tablespaces. That means that we need to use the FLUSH TABLES ... FOR EXPORT statement on the target table:
This forces the server to close the table and provides your connection with a read lock on the table.
Then, if we grep the database directory in the data directory for the newly created t2 table, we can see a number of .ibd and .cfg files for the table:
Then, while our connection still holds the lock on the table, we need to copy the tablespace files and the metadata files to a safe directory:
Then, once we've copied the files, we can release the lock with UNLOCK TABLES:
You can import a partitioned table by creating a placeholder table, discarding the placeholder table's original tablespace, copying the partition's .ibd and .cfg files from the backup location to the relevant tablespace location for the placeholder table, and then telling the server to import the tablespace. At that point, the server can exchange the tablespace for the placeholder table with the one for the partition. For example, the process would go like this:
First, we need to copy the saved tablespace files from the original server to the target server:
Then, we need to import the partitioned tablespaces onto the target server. The import process for partitioned tables is more complicated than the import process for non-partitioned tables. To start with, if it doesn't already exist, then we need to create a partitioned table on the target server that matches the partitioned table on the original server:
Then, using this table as a model, we need to create a placeholder of this table with the same structure that does not use partitioning. This can be done with a CREATE TABLE... AS SELECT statement:
This statement will create a new table called t2_placeholder that has the same schema structure as t2, but it does not use partitioning and it contains no rows.
For Each Partition
From this point forward, the rest of our steps need to happen for each individual partition. For each partition, we need to do the following process:
First, we need to use ALTER TABLE ... DISCARD TABLESPACE to discard the placeholder table's tablespace:
Then, copy the .ibd and .cfg files for the next partition to the relevant directory for the t2_placeholder table on the target MariaDB Server:
File-per-table tablespaces can be imported with just the .ibd file in many cases. If you do not have the tablepace's .cfg file for whatever reason, then it is usually worth trying to import the tablespace with just the .ibd file.
Then, once the files are in the proper directory on the target server, we need to use ALTER TABLE ... IMPORT TABLESPACE to import the new table's tablespace:
The placeholder table now contains data from the p0 partition on the source server.
Then, it's time to transfer the partition from the placeholder to the target table. This can be done with an ALTER TABLE... EXCHANGE PARTITION statement:
The target table now contains the first partition from the source table.
Repeat this procedure for each partition you want to import. For each partition, we need to discard the placeholder table's tablespace, and then import the partitioned table's tablespace into the placeholder table, and then exchange the tablespaces between the placeholder table and the partition of our target table.
When this process is complete for all partitions, the target table will contain the imported data:
Then, we can remove the placeholder table from the database:
added the mysql56_temporal_format system variable, which enables a new MySQL 5.6-compatible storage format for the TIME, DATETIME and TIMESTAMP data types.
If a file-per-tablespace file contains columns that use one or more of these temporal data types and if the tablespace file's original table was created with a certain storage format for these columns, then the tablespace file can only be imported into tables that were also created with the same storage format for these columns as the original table. Otherwise, you will see errors like the following:
See MDEV-15225 for more information.
See the pages for the TIME, DATETIME and TIMESTAMP data types to determine how to update the storage format for temporal columns in tables that were created before or that were created with mysql56_temporal_format=OFF.
InnoDB file-per-table tablespaces can use different row formats. A specific row format can be specified when creating a table either by setting the ROW_FORMAT table option or by the setting the innodb_default_row_format system variable. See Setting a Table's Row Format for more information on how to set an InnoDB table's row format.
If a file-per-tablespace file was created with a certain row format, then the tablespace file can only be imported into tables that were created with the same row format as the original table. Otherwise, you will see errors like the following:
The error message is a bit more descriptive in and later:
Be sure to check a tablespace's row format before moving it from one server to another. Keep in mind that the default row format can change between major versions of MySQL or MariaDB. See Checking a Table's Row Format for information on how to check an InnoDB table's row format.
See MDEV-15049 and MDEV-16851 for more information.
DISCARD on a table with foreign key constraints is only possible after disabling foreign_key_checks:
IMPORT on the other hand does not enforce foreign key constraints. So when importing tablespaces, referential integrity can only be guaranteed to import all tables bound by foreign key constraint at the same time, from an EXPORT of those tables taken with the same transactional state.
MariaDB supports data-at-rest encryption for the InnoDB storage engine. When enabled, the Server encrypts data before writing it to the tablespace and decrypts reads from the tablespace before returning result-sets. This means that a malicious user attempting to exfiltrate sensitive data won't be able to import the tablespace onto a different server as shown above without the encryption key.
For more information on data encryption, see Encrypting Data for InnoDB.
This page is licensed: CC BY-SA / Gnu FDL
An introduction to InnoDB's online DDL capabilities, detailing the ALGORITHM and LOCK clauses for controlling performance and concurrency during schema changes.
InnoDB tables support online DDL, which permits concurrent DML and uses optimizations to avoid unnecessary table copying.
The ALTER TABLE statement supports two clauses that are used to implement online DDL:
ALGORITHM - This clause controls how the DDL operation is performed.
LOCK - This clause controls how much concurrency is allowed while the DDL operation is being performed.
InnoDB supports multiple algorithms for performing DDL operations. This offers a significant performance improvement over previous versions. The supported algorithms are:
DEFAULT - This implies the default behavior for the specific operation.
COPY
INPLACE
The set of alter algorithms can be considered as a hierarchy. The hierarchy is ranked in the following order, with least efficient algorithm at the top, and most efficient algorithm at the bottom:
COPY
INPLACE
NOCOPY
INSTANT
When a user specifies an alter algorithm for a DDL operation, MariaDB does not necessarily use that specific algorithm for the operation. It interprets the choice in the following way:
If the user specifies COPY, then InnoDB uses the COPY algorithm.
If the user specifies any other algorithm, then InnoDB interprets that choice as the least efficient algorithm that the user is willing to accept. This means that if the user specifies INPLACE, then InnoDB will use the most efficient algorithm supported by the specific operation from the set (INPLACE, NOCOPY, INSTANT). Likewise, if the user specifies NOCOPY
There is also a special value that can be specified:
If the user specifies DEFAULT, then InnoDB uses its default choice for the operation. The default choice is to use the most efficient algorithm supported by the operation. The default choice will also be used if no algorithm is specified. Therefore, if you want InnoDB to use the most efficient algorithm supported by an operation, then you usually do not have to explicitly specify any algorithm at all.
InnoDB supports the clause.
The clause can be used to specify the least efficient algorithm that the user is willing to accept. It is supported by the and statements.
For example, if a user wanted to add a column to a table, but only if the operation used an algorithm that is at least as efficient as the INPLACE, then they could execute the following:
The above operation should use the INSTANT algorithm, because the ADD COLUMN operation supports the INSTANT algorithm, and the INSTANT algorithm is more efficient than the INPLACE algorithm.
The system variable can be used to pick the least efficient algorithm that the user is willing to accept.
For example, if a user wanted to add a column to a table, but only if the operation used an algorithm that is at least as efficient as the INPLACE, then they could execute the following:
The above operation would actually use the INSTANT algorithm, because the ADD COLUMN operation supports the INSTANT algorithm, and the INSTANT algorithm is more efficient than the INPLACE algorithm.
<>
The supported algorithms are described in more details below.
The default behavior, which occurs if ALGORITHM=DEFAULT is specified, or if ALGORITHM is not specified at all, usually only makes a copy if the operation doesn't support being done in-place at all. In this case, the most efficient available algorithm will usually be used.
This means that, if an operation supports the INSTANT algorithm, then it will use that algorithm by default. If an operation does not support the INSTANT algorithm, but it does support the NOCOPY algorithm, then it will use that algorithm by default. If an operation does not support the NOCOPY algorithm, but it does support the INPLACE algorithm, then it will use that algorithm by default.
The COPY algorithm refers to the original algorithm.
When the COPY algorithm is used, MariaDB essentially does the following operations:
This algorithm is very inefficient, but it is generic, so it works for all storage engines.
If the COPY algorithm is specified with the clause or with the system variable, then the COPY algorithm are used even if it is not necessary. This can result in a lengthy table copy. If multiple operations are required that each require the table to be rebuilt, then it is best to specify all operations in a single statement, so that the table is only rebuilt once.
If the COPY algorithm is used with an table, then the following statements apply:
The table are rebuilt using the current values of the , , and system variables.
The operation will have to create a temporary table to perform the table copy. This temporary table are in the same directory as the original table, and it's file name are in the format #sql${PID}_${THREAD_ID}_${TMP_TABLE_COUNT}, where ${PID} is the process ID of mysqld, ${THREAD_ID} is the connection ID, and ${TMP_TABLE_COUNT} is the number of temporary tables that the connection has open. Therefore, the may contain files with file names like #sql1234_12_1.ibd
The COPY algorithm can be incredibly slow, because the whole table has to be copied and rebuilt. The INPLACE algorithm was introduced as a way to avoid this by performing operations in-place and avoiding the table copy and rebuild, when possible.
When the INPLACE algorithm is used, the underlying storage engine uses optimizations to perform the operation while avoiding the table copy and rebuild. However, INPLACE is a bit of a misnomer, since some operations may still require the table to be rebuilt for some storage engines. Regardless, several operations can be performed without a full copy of the table for some storage engines.
A more accurate name for the algorithm would have been the ENGINE algorithm, since the decides how to implement the algorithm.
If an operation supports the INPLACE algorithm, then it can be performed using optimizations by the underlying storage engine, but it may rebuilt.
If the INPLACE algorithm is specified with the clause or with the system variable and if the operation does not support the INPLACE algorithm, then an error are raised:
In this case, raising an error is preferable, if the alternative is for the operation to make a copy of the table, and perform unexpectedly slowly.
If the INPLACE algorithm is used with an table, then the following statements apply:
The operation might have to write sort files in the directory defined by the system variable.
The operation might also have to write a temporary log file to track data changes by executed during the operation. The maximum size for this log file is configured by the system variable.
Some operations require the table to be rebuilt, even though the algorithm is inaccurately called "in-place". This includes operations such as adding or dropping columns, adding a primary key, changing a column to , etc.
INPLACE AlgorithmWith respect to the allowed operations, the INPLACE algorithm supports a subset of the operations supported by the COPY algorithm, and it supports a superset of the operations supported by the NOCOPY algorithm.
See for more information.
The NOCOPY algorithm is supported. The INPLACE algorithm can sometimes be surprisingly slow in instances where it has to rebuild the clustered index, because when the clustered index has to be rebuilt, the whole table has to be rebuilt. The NOCOPY algorithm was introduced as a way to avoid this.
If an operation supports the NOCOPY algorithm, then it can be performed without rebuilding the clustered index.
If the NOCOPY algorithm is specified with the clause or with the system variable and if the operation does not support the NOCOPY algorithm, then an error are raised:
In this case, raising an error is preferable, if the alternative is for the operation to rebuild the clustered index, and perform unexpectedly slowly.
NOCOPY AlgorithmWith respect to the allowed operations, the NOCOPY algorithm supports a subset of the operations supported by the INPLACE algorithm, and it supports a superset of the operations supported by the INSTANT algorithm.
See for more information.
The INSTANT algorithm is supported. The INPLACE algorithm can sometimes be surprisingly slow in instances where it has to modify data files. The INSTANT algorithm was introduced as a way to avoid this.
If an operation supports the INSTANT algorithm, then it can be performed without modifying any data files.
If the INSTANT algorithm is specified with the clause or with the system variable and if the operation does not support the INSTANT algorithm, then an error are raised:
In this case, raising an error is preferable, if the alternative is for the operation to modify data files, and perform unexpectedly slowly.
With respect to the allowed operations, the INSTANT algorithm supports a subset of the operations supported by the NOCOPY algorithm.
See for more information.
InnoDB supports multiple locking strategies for performing DDL operations. This offers a significant performance improvement over previous versions. The supported locking strategies are:
DEFAULT - This implies the default behavior for the specific operation.
NONE
SHARED
Regardless of which locking strategy is used to perform a DDL operation, InnoDB will have to exclusively lock the table for a short time at the start and end of the operation's execution. This means that any active transactions that may have accessed the table must be committed or aborted for the operation to continue. This applies to most DDL statements, such as , , , , , etc.
LOCK ClauseThe statement supports the clause.
The clause can be used to specify the locking strategy that the user is willing to accept. It is supported by the and statements.
For example, if a user wanted to add a column to a table, but only if the operation is non-locking, then they could execute the following:
If the clause is not explicitly set, then the operation uses LOCK=DEFAULT.
ALTER ONLINE TABLE is equivalent to LOCK=NONE. Therefore, the statement can be used to ensure that your operation allows all concurrent DML.
The supported algorithms are described in more details below.
To see which locking strategies InnoDB supports for each operation, see the pages that describe which operations are supported for each algorithm:
The default behavior, which occurs if LOCK=DEFAULT is specified, or if LOCK is not specified at all, acquire the least restrictive lock on the table that is supported for the specific operation. This permits the maximum amount of concurrency that is supported for the specific operation.
The NONE locking strategy performs the operation without acquiring any lock on the table. This permits all concurrent DML.
If this locking strategy is not permitted for an operation, then an error is raised.
The SHARED locking strategy performs the operation after acquiring a read lock on the table. This permit read-only concurrent DML.
If this locking strategy is not permitted for an operation, then an error is raised.
The EXCLUSIVE locking strategy performs the operation after acquiring a write lock on the table. This does not permit concurrent DML.
This page is licensed: CC BY-SA / Gnu FDL
Learn about the COMPRESSED row format, which compresses data and index pages using algorithms like zlib to minimize storage footprint at the cost of CPU.
An alternative (and usually superior) way to compress InnoDB tables is by using . See .
The COMPRESSED row format is similar to the COMPACT row format, but tables using the COMPRESSED row format can store even more data on overflow pages than tables using the COMPACT row format. This results in more efficient data storage than tables using the COMPACT row format, especially for tables containing columns using the , , and data types.
The COMPRESSED row format also supports compression of all data and index pages.
Understand the different `innodb_force_recovery` levels, which allow you to start the server in read-only modes to recover data after a crash.
The InnoDB recovery mode is a mode used for recovering from emergency situations. You should ensure you have a backup of your database before making changes in case you need to restore it. The server system variable sets the recovery mode. A mode of 0 is normal use, while the higher the mode, the more stringent the restrictions. Higher modes incorporate all limitations of the lower modes.
The recovery mode should never be set to a value other than zero except in an emergency situation.
Please note that recovery mode does not repair corruption. The corrupted files remain corrupted regardless of recovery mode. The sole purpose of recovery mode is to allow read access to the data, if at all possible.
Generally, it is best to start with a recovery mode of 1, and increase in single increments if needs be. With a recovery mode < 4, only corrupted pages should be lost. With 4, secondary indexes could be corrupted. With 5, results could be inconsistent and secondary indexes could be corrupted (even if they were not with 4). A value of 6 leaves pages in an obsolete state, which might cause more corruption.
Until , mode 0 was the only mode permitting changes to the data. From , write transactions are permitted with mode 3
CREATE TABLE test.t1 (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(50)
) ENGINE=InnoDB
DATA DIRECTORY = "/data/contact";# ls -al /data/contact/test
drwxrwx--- 2 mysql mysql 4096 Dec 8 18:46 .
drwxr-xr-x 3 mysql mysql 4096 Dec 8 18:46 ..
-rw-rw---- 1 mysql mysql 98304 Dec 8 20:41 t1.ibdFLUSH TABLES t1 FOR EXPORT;
# scp /data/contacts/test/t1.ibd target-server.com:/var/lib/mysql/test/
# scp /data/contacts/test/t1.cfg target-server.com:/var/lib/mysql/test/
# scp /data/contacts/test/t1.frm target-server.com:/var/lib/mysql/test/
UNLOCK TABLES;ALTER TABLE t1 IMPORT TABLESPACE;FLUSH TABLES test.t1 FOR EXPORT;# cp /data/contacts/test/t1.ibd /data/saved-tablespaces/
# cp /data/contacts/test/t1.cfg /data/saved-tablespaces/UNLOCK TABLES;CREATE TABLE test.t1 (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(50)
) ENGINE=InnoDB;ALTER TABLE test.t1 DISCARD TABLESPACE;# scp /data/tablespaces/t1.ibd target-server.com:/var/lib/mysql/test/
# scp /data/tablespaces/t1.cfg target-server.com:/var/lib/mysql/test/ALTER TABLE test.t1 IMPORT TABLESPACE;CREATE TABLE test.t2 (
employee_id INT,
name VARCHAR(50)
) ENGINE=InnoDB
PARTITION BY RANGE (employee_id) (
PARTITION p0 VALUES LESS THAN (6),
PARTITION p1 VALUES LESS THAN (11),
PARTITION p2 VALUES LESS THAN (16),
PARTITION p3 VALUES LESS THAN MAXVALUE
);
INSERT INTO test.t2 (name, employee_id) VALUES
('Geoff Montee', 1),
('Chris Calendar', 6),
('Kyle Joiner', 11),
('Will Fong', 16);FLUSH TABLES test.t2 FOR EXPORT;# ls -l /var/lib/mysql/test/ | grep t2
total 428
-rw-rw---- 1 mysql mysql 827 Dec 5 16:08 t2.frm
-rw-rw---- 1 mysql mysql 48 Dec 5 16:08 t2.par
-rw-rw---- 1 mysql mysql 579 Dec 5 18:47 t2#P#p0.cfg
-rw-r----- 1 mysql mysql 98304 Dec 5 16:43 t2#P#p0.ibd
-rw-rw---- 1 mysql mysql 579 Dec 5 18:47 t2#P#p1.cfg
-rw-rw---- 1 mysql mysql 98304 Dec 5 16:08 t2#P#p1.ibd
-rw-rw---- 1 mysql mysql 579 Dec 5 18:47 t2#P#p2.cfg
-rw-rw---- 1 mysql mysql 98304 Dec 5 16:08 t2#P#p2.ibd
-rw-rw---- 1 mysql mysql 579 Dec 5 18:47 t2#P#p3.cfg
-rw-rw---- 1 mysql mysql 98304 Dec 5 16:08 t2#P#p3.ibd$ mkdir /tmp/backup
$ sudo cp /var/lib/mysql/test/t2*.ibd /tmp/backup
$ sudo cp /var/lib/mysql/test/t2*.cfg /tmp/backupUNLOCK TABLES;$ scp /tmp/backup/t2* user@target-host:/tmp/backupCREATE TABLE test.t2 (
employee_id INT,
name VARCHAR(50)
) ENGINE=InnoDB
PARTITION BY RANGE (employee_id) (
PARTITION p0 VALUES LESS THAN (6),
PARTITION p1 VALUES LESS THAN (11),
PARTITION p2 VALUES LESS THAN (16),
PARTITION p3 VALUES LESS THAN MAXVALUE
);CREATE TABLE test.t2_placeholder LIKE test.t2;
ALTER TABLE test.t2_placeholder REMOVE PARTITIONING;ALTER TABLE test.t2_placeholder DISCARD TABLESPACE;# cp /tmp/backup/t2#P#p0.cfg /var/lib/mysql/test/t2_placeholder.cfg
# cp /tmp/backup/t2#P#p0.ibd /var/lib/mysql/test/t2_placeholder.ibd
# chown mysql:mysql /var/lib/mysql/test/t2_placeholder*ALTER TABLE test.t2_placeholder IMPORT TABLESPACE;SELECT * FROM test.t2_placeholder;
+-------------+--------------+
| employee_id | name |
+-------------+--------------+
| 1 | Geoff Montee |
+-------------+--------------+ALTER TABLE test.t2 EXCHANGE PARTITION p0 WITH TABLE test.t2_placeholder;SELECT * FROM test.t2;
+-------------+--------------+
| employee_id | name |
+-------------+--------------+
| 1 | Geoff Montee |
+-------------+--------------+SELECT * FROM test.t2;
+-------------+----------------+
| employee_id | name |
+-------------+----------------+
| 1 | Geoff Montee |
| 6 | Chris Calendar |
| 11 | Kyle Joiner |
| 16 | Will Fong |
+-------------+----------------+DROP TABLE test.t2_placeholder;ALTER TABLE dt_test IMPORT TABLESPACE;
ERROR 1808 (HY000): Schema mismatch (Column dt precise type mismatch.)ALTER TABLE t0 IMPORT TABLESPACE;
ERROR 1808 (HY000): Schema mismatch (Expected FSP_SPACE_FLAGS=0x21, .ibd file contains 0x0.)ALTER TABLE t0 IMPORT TABLESPACE;
ERROR 1808 (HY000): Schema mismatch (Table flags don't match, server table has 0x1 and the meta-data file has 0x0; .cfg file uses ROW_FORMAT=REDUNDANT)SET SESSION foreign_key_checks=0;
ALTER TABLE t0 DISCARD TABLESPACE;NOCOPYINSTANT
NOCOPYINSTANTThe operation inserts one record at a time into each index, which is very inefficient.
InnoDB does not use a sort buffer.
The table copy operation creates a lot fewer InnoDB undo log writes. See MDEV-11415 for more information.
The table copy operation creates a lot of InnoDB redo log writes.
It may have to create a temporary intermediate table for the actual table rebuild operation.
This temporary table are in the same directory as the original table, and it's file name are in the format #sql${PID}_${THREAD_ID}_${TMP_TABLE_COUNT}, where ${PID} is the process ID of mysqld, ${THREAD_ID} is the connection ID, and ${TMP_TABLE_COUNT} is the number of temporary tables that the connection has open. Therefore, the datadir may contain files with file names like #sql1234_12_1.ibd.
When it replaces the original table with the rebuilt table, it may also have to rename the original table using a temporary table name.
The system variable is set to OFF, then the format will actually be #sql-ib${TABLESPACE_ID}-${RAND}, where ${TABLESPACE_ID} is the table's tablespace ID within InnoDB and ${RAND} is a randomly initialized number. Therefore, the may contain files with file names like #sql-ib230291-1363966925.ibd.
The storage needed for the above items can add up to the size of the original table, or more in some cases.
Some operations are instantaneous, if they only require the table's metadata to be changed. This includes operations such as renaming a column, changing a column's DEFAULT value, etc.
EXCLUSIVEThe Compressed row format supports the following block sizes:
1 KB
1
2 KB
2
4 KB
4
8 KB
8
16 KB
16
If the KEY_BLOCK_SIZE table option is not specified, the block size defaults to half of innodb_page_size. With the default 16 KB page size, the block size defaults to 8 KB.
For compression to be effective, the chosen block size should be smaller than the servers value of the innodb_page_size system variable.
The limit for indexing column values depends on the innodb_page_size value:
16k
3072 bytes
8k
1536 bytes
4k
768 bytes
The Compressed row format does not efficiently use the InnoDB buffer pool, so it is not the recommended way to achieve InnoDB table compression. For more information about how to compress InnoDB tables, see Configure InnoDB Page Compression.
An InnoDB table that uses the COMPRESSED row format can be created by setting the ROW_FORMAT table option to COMPRESSED and by setting the KEY_BLOCK_SIZE table option to one of the following values in a CREATE TABLE or ALTER TABLE statement, where the units are in KB.
16k is the default value of the innodb_page_size system variable, so using 16 will usually result in minimal compression unless one of the following is true:
The server is using a non-default innodb_page_size value that is greater than 16k.
The value of the innodb_page_size system variable can be set to 32k and 64k. This is especially useful because the larger page size permits more columns using the VARBINARY, VARCHAR, BLOB and TEXT data types. Regardless, even when the value of the innodb_page_size system variable is set to some value higher than 16k, 16 is still the maximum value for the KEY_BLOCK_SIZE table option for InnoDB tables using the COMPRESSED row format.
The COMPRESSED row format cannot be set as the default row format with the innodb_default_row_format system variable.
The COMPRESSED row format is only supported by the Barracuda file format. In earlier versions, the COMPRESSED row format is only supported if the InnoDB file format is Barracuda. Therefore, the innodb_file_format system variable must be set to Barracuda to use these row formats in those versions.
In earlier versions, the COMPRESSED row format is also only supported if the table is in a file per-table tablespace. Therefore, the innodb_file_per_table system variable must be set to ON to use this row format in those versions.
It is also recommended to set the innodb_strict_mode system variable to ON when using this row format.
InnoDB automatically uses the COMPRESSED row format for a table if the KEY_BLOCK_SIZE table option is set to some value in a CREATE TABLE or ALTER TABLE statement:
If the KEY_BLOCK_SIZE table option is not set to some value, but the ROW_FORMAT table option is set to COMPRESSED in a CREATE TABLE or ALTER TABLE statement, then InnoDB uses a default value of 8 for the KEY_BLOCK_SIZE table option:
The default block size for tables that use the Compressed row format is half of innodb_page_size. With the default 16 KB page size, the block size defaults to 8 KB. A compressed table with the default block size can be created by setting the ROW_FORMAT table option to COMPRESSED:
Connect to the server using MariaDB Client:
Confirm that the default storage engine is InnoDB by checking the default_storage_engine system variable using the SHOW SESSION VARIABLES statement:
Create the table using the CREATE TABLE statement, and specify the Compressed row format using the ROW_FORMAT table option:
Confirm that the table uses the Compressed row format with an 8 KB block size by querying the information_schema.INNODB_SYS_TABLES table:
The default block size for tables that use the Compressed row format is half of innodb_page_size. With the default 16 KB page size, the block size defaults to 8 KB. A compressed table with a non-default block size can be created by setting the KEY_BLOCK_SIZE table option to the desired block size.
Connect to the server using MariaDB Client:
Confirm that the default storage engine is InnoDB by checking the default_storage_engine system variable using the SHOW SESSION VARIABLES statement:
Create the table using the CREATE TABLE statement, and specify the block size using the KEY_BLOCK_SIZE table option, which implies the Compressed row format:
Confirm that the table uses the Compressed row format with an 8 KB block size by querying the information_schema.INNODB_SYS_TABLES table:
The COMPRESSED row format supports compression of all data and index pages.
To avoid compressing and uncompressing pages too many times, InnoDB tries to keep both compressed and uncompressed pages in the buffer pool when there is enough room. This results in a bigger cache. When there is not enough room, an adaptive LRU algorithm is used to decide whether compressed or uncompressed pages should be evicted from the buffer: for CPU-bound workloads, the compressed pages are evicted first; for I/O-bound workloads, the uncompressed pages are evicted first. Of course, when necessary, both the compressed and uncompressed version of the same data can be evicted from the buffer.
Each compressed page has an uncompressed modification log, stored within the page itself. InnoDB writes small changes into it. When the space in the modification log runs out, the page is uncompressed, changes are applied, and the page is recompressed again. This is done to avoid some unnecessary decompression and compression operations.
Sometimes a compression failure might happen, because the data has grown too much to fit the page. When this happens, the page (and the index node) is split into two different pages. This process can be repeated recursively until the data fit the pages. This can be CPU-consuming on some busy servers which perform many write operations.
Before writing a compressed page into a data file, InnoDB writes it into the redo log. This ensures that the redo log can always be used to recover tables after a crash, even if the compression library is updated and some incompatibilities are introduced. But this also means that the redo log will grow faster and might need more space, or the frequency of checkpoints might need to increase.
The following INFORMATION_SCHEMA tables can be used to monitor the performances of InnoDB compressed tables:
The COMPRESSED row format supports index prefixes up to 3072 bytes. In and before, the innodb_large_prefix system variable is used to configure the maximum index prefix length. In these versions, if innodb_large_prefix is set to ON, then the maximum prefix length is 3072 bytes, and if it is set to OFF, then the maximum prefix length is 767 bytes.
All InnoDB row formats can store certain kinds of data in overflow pages. This allows for the maximum row size of an InnoDB table to be larger than the maximum amount of data that can be stored in the row's main data page. See Maximum Row Size for more information about the other factors that can contribute to the maximum row size for InnoDB tables.
In the COMPRESSED row format variable-length columns, such as columns using the VARBINARY, VARCHAR, BLOB and TEXT data types, can be completely stored in overflow pages.
InnoDB only considers using overflow pages if the table's row size is greater than half of innodb_page_size. If the row size is greater than this, then InnoDB chooses variable-length columns to be stored on overflow pages until the row size is less than half of innodb_page_size.
For BLOB and TEXT columns, only values longer than 40 bytes are considered for storage on overflow pages. For VARBINARY and VARCHAR columns, only values longer than 255 bytes are considered for storage on overflow pages. Bytes that are stored to track a value's length do not count towards these limits. These limits are only based on the length of the actual column's data.
These limits differ from the limits for the COMPACT row format, where the limit is 767 bytes for all types.
Fixed-length columns greater than 767 bytes are encoded as variable-length columns, so they can also be stored in overflow pages if the table's row size is greater than half of innodb_page_size. Even though a column using the CHAR data type can hold at most 255 characters, a CHAR column can still exceed 767 bytes in some cases. For example, a char(255) column can exceed 767 bytes if the character set is utf8mb4.
If a column is chosen to be stored on overflow pages, then the entire value of the column is stored on overflow pages, and only a 20-byte pointer to the column's first overflow page is stored on the main page. Each overflow page is the size of innodb_page_size. If a column is too large to be stored on a single overflow page, then it is stored on multiple overflow pages. Each overflow page contains part of the data and a 20-byte pointer to the next overflow page, if a next page exists.
This behavior differs from the behavior of the COMPACT row format, which always stores the column prefix on the main page. This allows tables using the COMPRESSED row format to contain a high number of columns using the VARBINARY, VARCHAR, BLOB and TEXT data types.
MariaDB starting with 10.6
From MariaDB 10.6.0 until MariaDB 10.6.5, tables that are of the COMPRESSED row format are read-only by default. This was intended to be the first step towards removing write support and deprecating the feature.
This plan has been scrapped, and from MariaDB 10.6.6, COMPRESSED tables are no longer read-only by default.
From MariaDB 10.6.0 to MariaDB 10.6.5, set the innodb_read_only_compressed variable to OFF to make the tables writable.
This page is licensed: CC BY-SA / Gnu FDL
To recover the tables, you can execute SELECTs to dump data, and DROP TABLE (when write transactions are permitted) to remove corrupted tables.
The following modes are available:
Recovery mode behaviour differs between versions (server/storage/innobase/include/srv0srv.h).
0
The default mode while InnoDB is running normally. Write transactions are permitted with innodb_force_recovery<=4.
1
(SRV_FORCE_IGNORE_CORRUPT) allows the server to keep running even if corrupt pages are detected. It does so by making redo log based recovery ignore certain errors, such as missing data files or corrupted data pages. Any redo log for affected files or pages are skipped. You can facilitate dumping tables by getting the SELECT * FROM table_name statement to jump over corrupt indexes and pages.
2
(SRV_FORCE_NO_BACKGROUND) stops the master thread from running, preventing a crash that occurs during a purge. No purge are performed, so the undo logs will keep growing.
3
(SRV_FORCE_NO_TRX_UNDO) does not roll back DML transactions after the crash recovery. Does not affect rollback of currently active DML transactions. Will also prevent some undo-generating background tasks from running. These tasks could hit a lock wait due to the recovered incomplete transactions whose rollback is being prevented.
4
(SRV_FORCE_NO_DDL_UNDO) does not roll back transactions after the crash recovery. Does not affect rollback of currently active transactions. Will also prevent some undo-generating background tasks from running. These tasks could hit a lock wait due to the recovered incomplete transactions whose rollback is being prevented.
5
Note also that XtraDB (<= ) by default will crash the server when it detects corrupted data in a single-table tablespace. This behaviour can be changed - see the innodb_corrupt_table_action system variable.
Try to set innodb_force_recovery to 1 and start mariadb. If that fails, try a value of "2". If a value of 2 works, then there is a chance the only corruption you have experienced is within the innodb "undo logs". If that gets mariadb started, you should be able to dump your database with mariadb-dump. You can verify any other issues with any tables by running mariadb-check --all-databases.
If you were able to successfully dump your databases, or had previously known good backups, drop your database(s) from the mariadb command line like "DROP DATABASE yourdatabase". Stop mariadb. Go to /var/lib/mysql (or whereever your mysql data directory is located) and "rm -i ib*". Start mariadb, create the database(s) you dropped ("CREATE DATABASE yourdatabase"), and then import your most recent dumps: "mysql < mydatabasedump.sql"
This page is licensed: CC BY-SA / Gnu FDL
Information about the XtraDB storage engine that was used in old MariaDB versions.
Percona XtraDB was an enhanced version of the InnoDB storage engine , designed to better scale on modern hardware, and it includes a variety of other features useful in high-performance environments.
It is fully backwards compatible, and it identifies itself to MariaDB as
"ENGINE=InnoDB" (just like InnoDB), and so can be used as a drop-in replacement
for standard InnoDB.
Percona XtraDB includes all of InnoDB's robust, reliable -compliant design and advanced MVCC architecture, and builds on that solid foundation with more features, more tunability, more metrics, and more scalability. In particular, it is designed to scale better on many cores, to use memory more efficiently, and to be more convenient and useful. The new features are especially designed to alleviate some of InnoDB's limitations. We choose features and fixes based on customer requests and on our best judgment of real-world needs as a high-performance consulting company.
XtraDB was also available in MariaDB for Windows.
The DYNAMIC row format, default in modern MariaDB versions, optimizes storage for large BLOB/TEXT columns by storing them on separate overflow pages.
DYNAMIC is the default InnoDB row format.
The DYNAMIC row format is similar to the COMPACT row format, but tables using the DYNAMIC row format can store even more data on overflow pages than tables using the COMPACT row format. This results in more efficient data storage than tables using the COMPACT row format, especially for tables containing columns using the , , and data types. While InnoDB tables using the COMPRESSED row format can result in even greater space-efficiency, COMPRESSED requires substantially more memory and CPU to both read and write, so there is a significant performance and concurrency trade-off for that space-efficiency gain. COMPRESSED tables are not recommended for production use in most situations, while DYNAMIC row format scales well in high-performance environments.
CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50)
);
ALTER TABLE tab ADD COLUMN c VARCHAR(50), ALGORITHM=INPLACE;CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab ADD COLUMN c VARCHAR(50);-- Create a temporary table with the new definition
CREATE TEMPORARY TABLE tmp_tab (
...
);
-- Copy the data from the original table
INSERT INTO tmp_tab
SELECT * FROM original_tab;
-- Drop the original table
DROP TABLE original_tab;
-- Rename the temporary table, so that it replaces the original one
RENAME TABLE tmp_tab TO original_tab;SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab MODIFY COLUMN c INT;
ERROR 1846 (0A000): ALGORITHM=INPLACE is not supported. Reason: Cannot change column type INPLACE. Try ALGORITHM=COPYSET SESSION alter_algorithm='NOCOPY';
ALTER TABLE tab MODIFY COLUMN c INT;
ERROR 1846 (0A000): ALGORITHM=NOCOPY is not supported. Reason: Cannot change column type INPLACE. Try ALGORITHM=COPYSET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab MODIFY COLUMN c INT;
ERROR 1846 (0A000): ALGORITHM=INSTANT is not supported. Reason: Cannot change column type INPLACE. Try ALGORITHM=COPYCREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50)
);
ALTER TABLE tab ADD COLUMN c VARCHAR(50), ALGORITHM=INPLACE, LOCK=NONE;SET SESSION innodb_strict_mode=ON;
SET GLOBAL innodb_file_per_table=ON;
SET GLOBAL innodb_file_format='Barracuda';
CREATE TABLE tab (
id INT,
str VARCHAR(50)
) ENGINE=InnoDB KEY_BLOCK_SIZE=4;SET SESSION innodb_strict_mode=ON;
SET GLOBAL innodb_file_per_table=ON;
SET GLOBAL innodb_file_format='Barracuda';
CREATE TABLE tab (
id INT,
str VARCHAR(50)
) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;CREATE TABLE hq_sales.invoices (
invoice_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL,
branch_id INT NOT NULL,
customer_id INT,
invoice_date DATETIME(6),
invoice_total DECIMAL(13, 2),
payment_method ENUM('NONE', 'CASH', 'WIRE_TRANSFER', 'CREDIT_CARD', 'GIFT_CARD'),
PRIMARY KEY(invoice_id)
) ROW_FORMAT = Compressed;$ mariadb --user=rootSHOW SESSION VARIABLES
LIKE 'default_storage_engine';+------------------------+--------+
| Variable_name | Value |
+------------------------+--------+
| default_storage_engine | InnoDB |
+------------------------+--------+CREATE TABLE hq_sales.invoices (
invoice_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL,
branch_id INT NOT NULL,
customer_id INT,
invoice_date DATETIME(6),
invoice_total DECIMAL(13, 2),
payment_method ENUM('NONE', 'CASH', 'WIRE_TRANSFER', 'CREDIT_CARD', 'GIFT_CARD'),
PRIMARY KEY(invoice_id)
) ROW_FORMAT = Compressed;SELECT NAME, ROW_FORMAT, ZIP_PAGE_SIZE
FROM information_schema.INNODB_SYS_TABLES
WHERE NAME='hq_sales/invoices';+-------------------+------------+---------------+
| NAME | ROW_FORMAT | ZIP_PAGE_SIZE |
+-------------------+------------+---------------+
| hq_sales/invoices | Compressed | 8192 |
+-------------------+------------+---------------+CREATE TABLE hq_sales.invoices (
invoice_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL,
branch_id INT NOT NULL,
customer_id INT,
invoice_date DATETIME(6),
invoice_total DECIMAL(13, 2),
payment_method ENUM('NONE', 'CASH', 'WIRE_TRANSFER', 'CREDIT_CARD', 'GIFT_CARD'),
PRIMARY KEY(invoice_id)
) KEY_BLOCK_SIZE = 4;$ mariadb --user=rootSHOW SESSION VARIABLES
LIKE 'default_storage_engine';+------------------------+--------+
| Variable_name | Value |
+------------------------+--------+
| default_storage_engine | InnoDB |
+------------------------+--------+CREATE TABLE hq_sales.invoices (
invoice_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL,
branch_id INT NOT NULL,
customer_id INT,
invoice_date DATETIME(6),
invoice_total DECIMAL(13, 2),
payment_method ENUM('NONE', 'CASH', 'WIRE_TRANSFER', 'CREDIT_CARD', 'GIFT_CARD'),
PRIMARY KEY(invoice_id)
) KEY_BLOCK_SIZE = 4;SELECT NAME, ROW_FORMAT, ZIP_PAGE_SIZE
FROM information_schema.INNODB_SYS_TABLES
WHERE NAME='hq_sales/invoices';+-------------------+------------+---------------+
| NAME | ROW_FORMAT | ZIP_PAGE_SIZE |
+-------------------+------------+---------------+
| hq_sales/invoices | Compressed | 4096 |
+-------------------+------------+---------------+The limit for indexing column values depends on the innodb_page_size value:
16k 32k 16k
3072 bytes
8k
1536 bytes
4k
768 bytes
The default row format is DYNAMIC, as long as the innodb_default_row_format system variable has not been modified. Therefore, in these versions, the easiest way to create an InnoDB table that uses the DYNAMIC row format is by not setting the ROW_FORMAT table option at all in a CREATE TABLE or ALTER TABLE statement.
It is recommended to set the innodb_strict_mode system variable to ON when using this row format.
For example:
InnoDB uses the Dynamic row format for new InnoDB tables by default, because the innodb_default_row_format system variable is dynamic by default.
Let's create an InnoDB table after confirming that the default storage engine is InnoDB and that InnoDB's default row format is Dynamic:
Connect to the server using MariaDB Client:
Confirm that the default storage engine is InnoDB by checking the default_storage_engine system variable using the SHOW SESSION VARIABLES statement:
Confirm that InnoDB's default row format is Dynamic by checking the innodb_default_row_format system variable using the SHOW GLOBAL VARIABLES statement:
If the database does not exist, then create the database for the table using the CREATE DATABASE statement:
Create the table using the CREATE TABLE statement:
Confirm that the table uses the Dynamic row format by querying the information_schema.INNODB_SYS_TABLES table:
An InnoDB table that uses the Dynamic row format can be created using the ROW_FORMAT table option.
Let's create an InnoDB table after confirming that the default storage engine is InnoDB and that InnoDB's default row format is not Dynamic:
Connect to the server using MariaDB Client:
Confirm that the default storage engine is InnoDB by checking the default_storage_engine system variable using the SHOW SESSION VARIABLES statement:
Confirm that InnoDB's default row format is not Dynamic by checking the innodb_default_row_format system variable using the SHOW GLOBAL VARIABLES statement:
If the database does not exist, then create the database for the table using the CREATE DATABASE statement:
Create the table using the CREATE TABLE statement, and specify the Dynamic row format using the ROW_FORMAT table option:
Confirm that the table uses the Dynamic row format by querying the information_schema.INNODB_SYS_TABLES table:
If your database was physically upgraded from some older version of MariaDB Server or MySQL, then some of your tables may not be using the Dynamic row format. If you want to get the benefits of the Dynamic row format, then those tables will need to be converted to use it.
Let's convert some InnoDB tables to the Dynamic row format:
Connect to the server using MariaDB Client:
Search for InnoDB tables that do not use the Dynamic row format by querying the information_schema.INNODB_SYS_TABLES table:
Alter the table using the ALTER TABLE statement, and specify the Dynamic row format using the ROW_FORMAT table option:
Confirm that the table uses the Dynamic row format by querying the information_schema.INNODB_SYS_TABLES table again:
The DYNAMIC row format supports index prefixes up to 3072 bytes. In earlier versions of MariaDB, the innodb_large_prefix system variable is used to configure the maximum index prefix length. In these versions, if innodb_large_prefix is set to ON, then the maximum prefix length is 3072 bytes, and if it is set to OFF, then the maximum prefix length is 767 bytes.
All InnoDB row formats can store certain kinds of data in overflow pages. This allows for the maximum row size of an InnoDB table to be larger than the maximum amount of data that can be stored in the row's main data page. See Maximum Row Size for more information about the other factors that can contribute to the maximum row size for InnoDB tables.
In the DYNAMIC row format variable-length columns, such as columns using the VARBINARY, VARCHAR, BLOB and TEXT data types, can be completely stored in overflow pages.
InnoDB only considers using overflow pages if the table's row size is greater than half of innodb_page_size. If the row size is greater than this, then InnoDB chooses variable-length columns to be stored on overflow pages until the row size is less than half of innodb_page_size.
For BLOB and TEXT columns, only values longer than 40 bytes are considered for storage on overflow pages. For VARBINARY and VARCHAR columns, only values longer than 255 bytes are considered for storage on overflow pages. Bytes that are stored to track a value's length do not count towards these limits. These limits are only based on the length of the actual column's data.
These limits differ from the limits for the COMPACT row format, where the limit is 767 bytes for all types.
Fixed-length columns greater than 767 bytes are encoded as variable-length columns, so they can also be stored in overflow pages if the table's row size is greater than half of innodb_page_size. Even though a column using the CHAR data type can hold at most 255 characters, a CHAR column can still exceed 767 bytes in some cases. For example, a char(255) column can exceed 767 bytes if the character set is utf8mb4.
If a column is chosen to be stored on overflow pages, then the entire value of the column is stored on overflow pages, and only a 20-byte pointer to the column's first overflow page is stored on the main page. Each overflow page is the size of innodb_page_size. If a column is too large to be stored on a single overflow page, then it is stored on multiple overflow pages. Each overflow page contains part of the data and a 20-byte pointer to the next overflow page, if a next page exists.
This behavior differs from the behavior of the COMPACT row format, which always stores the column prefix on the main page. This allows tables using the DYNAMIC row format to contain a high number of columns using the VARBINARY, VARCHAR, BLOB and TEXT data types.
This page is licensed: CC BY-SA / Gnu FDL
SET SESSION innodb_strict_mode=ON;
SET GLOBAL innodb_default_row_format='dynamic';
CREATE TABLE tab (
id INT,
str VARCHAR(50)
) ENGINE=InnoDB;$ mariadb --user=rootSHOW SESSION VARIABLES
LIKE 'default_storage_engine';+------------------------+--------+
| Variable_name | Value |
+------------------------+--------+
| default_storage_engine | InnoDB |
+------------------------+--------+SHOW GLOBAL VARIABLES
LIKE 'innodb_default_row_format';+---------------------------+---------+
| Variable_name | Value |
+---------------------------+---------+
| innodb_default_row_format | dynamic |
+---------------------------+---------+CREATE DATABASE hq_sales;CREATE TABLE hq_sales.invoices (
invoice_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL,
branch_id INT NOT NULL,
customer_id INT,
invoice_date DATETIME(6),
invoice_total DECIMAL(13, 2),
payment_method ENUM('NONE', 'CASH', 'WIRE_TRANSFER', 'CREDIT_CARD', 'GIFT_CARD'),
PRIMARY KEY(invoice_id)
);SELECT NAME, ROW_FORMAT
FROM information_schema.INNODB_SYS_TABLES
WHERE NAME='hq_sales/invoices';+-------------------+------------+
| NAME | ROW_FORMAT |
+-------------------+------------+
| hq_sales/invoices | Dynamic |
+-------------------+------------+$ mariadb --user=rootSHOW SESSION VARIABLES
LIKE 'default_storage_engine';+------------------------+--------+
| Variable_name | Value |
+------------------------+--------+
| default_storage_engine | InnoDB |
+------------------------+--------+SHOW GLOBAL VARIABLES
LIKE 'innodb_default_row_format';+---------------------------+---------+
| Variable_name | Value |
+---------------------------+---------+
| innodb_default_row_format | compact |
+---------------------------+---------+CREATE DATABASE hq_sales;CREATE TABLE hq_sales.invoices (
invoice_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL,
branch_id INT NOT NULL,
customer_id INT,
invoice_date DATETIME(6),
invoice_total DECIMAL(13, 2),
payment_method ENUM('NONE', 'CASH', 'WIRE_TRANSFER', 'CREDIT_CARD', 'GIFT_CARD'),
PRIMARY KEY(invoice_id)
) ROW_FORMAT = DYNAMIC;SELECT NAME, ROW_FORMAT
FROM information_schema.INNODB_SYS_TABLES
WHERE NAME='hq_sales/invoices';+-------------------+------------+
| NAME | ROW_FORMAT |
+-------------------+------------+
| hq_sales/invoices | Dynamic |
+-------------------+------------+$ mariadb --user=rootSELECT NAME, ROW_FORMAT
FROM information_schema.INNODB_SYS_TABLES
WHERE NAME NOT LIKE 'SYS_%'
AND ROW_FORMAT != 'Dynamic';+-------------------+------------+
| NAME | ROW_FORMAT |
+-------------------+------------+
| hq_sales/invoices | Compact |
+-------------------+------------+ALTER TABLE hq_sales.invoices
ROW_FORMAT = DYNAMIC;SELECT NAME, ROW_FORMAT
FROM information_schema.INNODB_SYS_TABLES
WHERE NAME='hq_sales/invoices';+-------------------+------------+
| NAME | ROW_FORMAT |
+-------------------+------------+
| hq_sales/invoices | Dynamic |
+-------------------+------------+6
(SRV_FORCE_NO_LOG_REDO) does not perform redo log roll-forward as part of recovery. Running queries that require indexes are likely to fail with this mode active. However, if a table dump still causes a crash, you can try using a SELECT * FROM tab ORDER BY primary_key DESC to dump all the data portion after the corrupted part.
6
(SRV_FORCE_NO_LOG_REDO) does not perform redo log roll-forward as part of recovery. Running queries that require indexes are likely to fail with this mode active. However, if a table dump still causes a crash, you can try using a SELECT * FROM tab ORDER BY primary_key DESC to dump all the data portion after the corrupted part.
(SRV_FORCE_NO_UNDO_LOG_SCAN) treats incomplete transactions as committed, and does not look at the undo logs when starting. Any DDL log for InnoDB tables are essentially ignored by InnoDB, but the server will start up
6
(SRV_FORCE_NO_LOG_REDO) does not perform redo log roll-forward as part of recovery. Running queries that require indexes are likely to fail with this mode active. However, if a table dump still causes a crash, you can try using a SELECT * FROM tab ORDER BY primary_key DESC to dump all the data portion after the corrupted part.
0
The default mode while InnoDB is running normally. Write transactions are permitted with innodb_force_recovery<=4.
1
(SRV_FORCE_IGNORE_CORRUPT) allows the server to keep running even if corrupt pages are detected. It does so by making redo log based recovery ignore certain errors, such as missing data files or corrupted data pages. Any redo log for affected files or pages are skipped. You can facilitate dumping tables by getting the SELECT * FROM table_name statement to jump over corrupt indexes and pages.
2
(SRV_FORCE_NO_BACKGROUND) stops the master thread from running, preventing a crash that occurs during a purge. No purge are performed, so the undo logs will keep growing.
3
(SRV_FORCE_NO_TRX_UNDO) does not roll back transactions after the crash recovery. Does not affect rollback of currently active transactions. Will also prevent some undo-generating background tasks from running. These tasks could hit a lock wait due to the recovered incomplete transactions whose rollback is being prevented.
4
(SRV_FORCE_NO_IBUF_MERGE) The same as 3.
5
0
The default mode while InnoDB is running normally. Until , it was the only mode permitting changes to the data. From , write transactions are permitted with innodb_force_recovery<=3.
1
(SRV_FORCE_IGNORE_CORRUPT) allows the server to keep running even if corrupt pages are detected. It does so by making redo log based recovery ignore certain errors, such as missing data files or corrupted data pages. Any redo log for affected files or pages are skipped. You can facilitate dumping tables by getting the SELECT * FROM table_name statement to jump over corrupt indexes and pages.
2
(SRV_FORCE_NO_BACKGROUND) stops the master thread from running, preventing a crash that occurs during a purge. No purge are performed, so the undo logs will keep growing.
3
(SRV_FORCE_NO_TRX_UNDO) does not roll back transactions after the crash recovery. Does not affect rollback of currently active transactions. Starting with , will also prevent some undo-generating background tasks from running. These tasks could hit a lock wait due to the recovered incomplete transactions whose rollback is being prevented.
4
(SRV_FORCE_NO_IBUF_MERGE) does not calculate tables statistics and prevents insert buffer merges.
5
(SRV_FORCE_NO_UNDO_LOG_SCAN) treats incomplete transactions as committed, and does not look at the when starting.
(SRV_FORCE_NO_UNDO_LOG_SCAN) treats incomplete transactions as committed, and does not look at the when starting.
XtraDB from Percona Server 5.6.49-89.0 in
XtraDB from Percona Server 5.6.46-86.2 in
XtraDB from Percona Server 5.6.43-84.3 in
XtraDB from Percona Server 5.6.41-84.1 in
XtraDB from [] in
XtraDB from []in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from [] in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from Percona Server 5.6.42-84.2 in
XtraDB from Percona Server 5.6.41-84.1 in
XtraDB from Percona Server 5.6.39-83.1 in
XtraDB from Percona Server 5.6.38-83.0[4]in
XtraDB from []in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from [] in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from Percona Server 5.5.61-38.13 in
XtraDB from Percona Server 5.5.59-38.11 in
XtraDB from Percona Server 5.5.58-38.10 in
XtraDB from Percona Server 5.5.55-38.9 in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
XtraDB from in
and 5.3 include the latest XtraDB version from at the time they were released.
version 5.1.59-13 in
version 5.1.54-12.5 in
version 5.1.52-11.6 in and
version 5.1.49-12 in
version in
version 1.0.6-10 in
version 1.0.6-9 in ,, and .
version 1.0.4-8 in
version 1.0.3-8 in
version 1.0.3-6 in
More information can be found in the Percona documentation.
This page is licensed: CC BY-SA / Gnu FDL
This feature enables transparent page-level compression for tables using algorithms like LZ4 or Zlib, reducing storage requirements.
InnoDB page compression provides a way to compress InnoDB tables.
InnoDB page compression can be used on any storage device and any file system.
InnoDB page compression is most efficient on file systems that support sparse files. See for more information.
InnoDB page compression is most beneficial on solid state drives (SSDs) and other flash storage. See for more information.
InnoDB page compression performs best when your storage device and file system support atomic writes, since that allows the to be disabled. See for more information.
COMPRESSED Row FormatInnoDB page compression is a modern way to compress your InnoDB tables. It is similar to InnoDB's row format, but it has many advantages. Some of the differences are:
With InnoDB page compression, compressed pages are immediately decompressed after being read from the tablespace file, and only uncompressed pages are stored in the buffer pool. In contrast, with InnoDB's row format, compressed pages are decompressed immediately after they are read from the tablespace file, and both the uncompressed and compressed pages are stored in the buffer pool. This means that the row format uses more space in the buffer pool than InnoDB page compression does.
With InnoDB page compression, pages are compressed just before being written to the tablespace file. In contrast, with InnoDB's row format, pages are re-compressed immediately after any changes, and the compressed pages are stored in the buffer pool alongside the uncompressed pages. These changes are then occasionally flushed to disk. This means that the row format re-compresses data more frequently than InnoDB page compression does.
With InnoDB page compression, multiple compression algorithms are supported. In contrast, with InnoDB's
In general, InnoDB page compression is superior to the row format.
See .
There is not currently a table option to set different InnoDB page compression algorithms for individual tables.
However, the server-wide InnoDB page compression algorithm can be configured by setting the system variable.
When this system variable is changed, the InnoDB page compression algorithm does not change for existing pages that were already compressed with a different InnoDB page compression algorithm. InnoDB is able to handle this situation without issues, because every page in an InnoDB tablespace contains metadata about the InnoDB page compression algorithm in the page header. This means that InnoDB supports having uncompressed pages and pages compressed with different InnoDB page compression algorithms in the same InnoDB tablespace at the same time.
This system variable can be set to one of the following values:
However, on many distributions, the standard MariaDB builds do not support all InnoDB page compression algorithms by default. From , algorithms can be .
This system variable can be changed dynamically with :
This system variable can also be set in a server in an prior to starting up the server:
On many distributions, the standard MariaDB builds do not support all InnoDB page compression algorithms by default. Therefore, if you want to use a specific InnoDB page compression algorithm, then you should check whether your MariaDB build supports it.
The compression algorithm is always supported. From , algorithms can be .
A MariaDB build's support for other InnoDB page compression algorithms can be checked by querying the following status variables with :
For example:
On many distributions, the standard MariaDB builds do not support all InnoDB page compression algorithms by default. From , algorithms can be , but in earlier versions, if you want to use certain InnoDB page compression algorithms, then you may need to do the following:
Download the package for the desired compression library from the above links.
Install the package for the desired compression library.
Compile MariaDB from the source distribution.
The general steps for compiling MariaDB are:
Download and unpack the source code distribution:
Configure the build using :
Check to confirm that it has found the desired compression library on your system.
Compile the build:
Either install the build:
Or make a package to install:
See for more information.
InnoDB page compression is not enabled by default. However, InnoDB page compression can be enabled for just individual InnoDB tables or it can be enabled for all new InnoDB tables by default.
InnoDB page compression is also only supported if the InnoDB table is in a tablespace. Therefore, the system variable must be set to ON to use InnoDB page compression.
InnoDB page compression is only supported if the InnoDB table uses the Barracuda .Therefore, in and before, the system variable must be set to Barracuda to use InnoDB page compression.
InnoDB page compression is also only supported if the InnoDB table's is or .
In and later, InnoDB page compression can be enabled for all new InnoDB tables by default by setting the system variable to ON.
This system variable can be set to one of the following values:
This system variable can be changed dynamically with :
This system variable's session value can be changed dynamically with :
This system variable can also be set in a server in an prior to starting up the server:
InnoDB page compression can be enabled for individual tables by setting the table option to 1:
Some InnoDB page compression algorithms support a compression level option, which configures how the InnoDB page compression algorithm will balance speed and compression.
The compression level's supported values range from 1 to 9. The range goes from the fastest to the most compact, which means that 1 is the fastest and 9 is the most compact.
Only the following InnoDB page compression algorithms currently support compression levels:
If an InnoDB page compression algorithm does not support compression levels, then it ignores any provided compression level value.
The default compression level can be configured by setting the system variable.
This system variable's default value is 6.
This system variable can be changed dynamically with :
This system variable can also be set in a server in an prior to starting up the server:
The compression level for individual tables can also be configured by setting the table option for the table:
InnoDB page compression can encounter compression failures.
InnoDB page compression's failure threshold can be configured. If InnoDB encounters more compression failures than the failure threshold, then it pads pages with zeroed out bytes before attempting to compress them as a way to reduce failures. If the failure rate stays above the failure threshold, then InnoDB pads pages with more zeroed out bytes in 128 byte increments.
InnoDB page compression's maximum padding can also be configured.
The failure threshold can be configured by setting the system variable.
This system variable's supported values range from 0 to 100.
This system variable's default value is 5.
This system variable can be changed dynamically with :
This system variable can also be set in a server in an prior to starting up the server:
The maximum padding can be configured by setting the system variable.
This system variable's supported values range from 0 to 75.
This system variable's default value is 50.
This system variable can be changed dynamically with :
This system variable can also be set in a server in an prior to starting up the server:
When InnoDB page compression is used, InnoDB may still write the compressed page to the tablespace file with the original size of the uncompressed page, which would be equivalent to the value of the system variable. This is done by design, because when InnoDB's I/O code needs to read the page from disk, it can only read the full page size. However, this is obviously not optimal.
On file systems that support sparse files, this problem is solved by writing the tablespace file as a sparse file using the punch hole technique. With the punch hole technique, InnoDB will only write the actual compressed page size to the tablespace file, aligned to sector size. The rest of the page is trimmed.
This punch hole technique allows InnoDB to read the compressed page from disk as the full page size, even though the compressed page really takes up less space on the file system.
There are some potential disadvantages to using sparse files:
Some utilities may require special options in order to handle sparse files in an efficient manner.
Most existing file systems are slow to sparse files. As a consequence, if a tablespace file is a sparse file, then dropping the table can be very slow.
On Linux, the following file systems support sparse files:
ext3
ext4
xfs
btrfs
On Linux, file systems need to support the system call with the FALLOC_FL_PUNCH_HOLE and FALLOC_FL_KEEP_SIZE flags:
Some Linux utilities may require special options in order to work with sparse files efficiently:
The utility will report the non-sparse size of the tablespace file when executed with default behavior, but will report the actual amount of storage allocated for the tablespace file.
The utility is pretty good at auto-detecting sparse files, but it also provides the and options, if the auto-detection is not desired.
The utility will archive sparse files with their non-sparse size when executed with default behavior, but will auto-detect sparse files, and archive them with their sparse size.
On Windows, the following file systems support sparse files:
NTFS
On Windows, file systems need to support the function with the and control codes:
In and later, InnoDB uses the punch hole technique to create sparse files used automatically when the underlying file system supports sparse files.
In and before, InnoDB can be configured to use the punch hole technique to create sparse files by configuring the and system variables. These system variables can be set in a server in an prior to starting up the server:
InnoDB page compression was designed to be optimized on solid state drives (SSDs) and other flash storage.
InnoDB page compression was originally developed by collaborating with . As a consequence, it was originally designed to work best on using . has since been acquired by , and they have decided not to continue supporting .
However, InnoDB page compression is still likely to be most optimized on solid state drives (SSDs) and other flash storage.
InnoDB page compression works without any issues on hard disk drives (HDDs). However, since its compression relies on the use of sparse files, the data may be somewhat fragmented on disk. This fragmentation may hurt performance on HDDs, since they handle random reads and writes much more slowly than flash storage.
With InnoDB page compression, pages are compressed when they are flushed to disk. Therefore, it can be helpful to optimize the configuration of InnoDB's page flushing. See for more information.
InnoDB page compression can be monitored by querying the following status variables with :
With InnoDB page compression, a page is only compressed when it is flushed to disk. This means that if you are monitoring InnoDB page compression via these status variables, then the status variables values will only get incremented when the dirty pages are flushed to disk, which does not necessarily happen immediately:
supports InnoDB page compression.
does not support InnoDB page compression.
InnoDB page compression was developed by collaborating with . Special thanks especially to Dhananjoy Das and Torben Mathiasen.
This page is licensed: CC BY-SA / Gnu FDL
An overview of the four InnoDB row formats (REDUNDANT, COMPACT, DYNAMIC, COMPRESSED), comparing their storage efficiency and feature support.
The InnoDB storage engine supports four different row formats:
The system variable can be used to set the default row format for InnoDB tables. The possible values are:
redundant
compact
dynamic
This system variable's default value is dynamic, which means that the default row format is DYNAMIC.
This system variable cannot be set to compressed, which means that the default row format cannot be COMPRESSED.
For example, the following statements would create a table with the DYNAMIC row format:
One way to specify an InnoDB table's row format is by setting the table option to the relevant row format in a or statement:
The statement can be used to see the row format used by a table:
The table can also be queried to see the row format used by a table:
A table's tablespace is tagged with the lowest InnoDB file format that supports the table's row format. So, even if the Barracuda file format is enabled, tables that use the COMPACT or REDUNDANT row formats are tagged with the Antelope file format in the table.
The REDUNDANT row format is the original non-compacted row format.
The REDUNDANT row format was the only available row format before MySQL 5.0.3. In that release, this row format was retroactively named the REDUNDANT row format. In the same release, the COMPACT row format was introduced as the new default row format.
See for more information.
Default row format in earlier versions COMPACT.
The COMPACT row format is similar to the REDUNDANT row format, but it stores data in a more compact manner that requires about 20% less storage.
See for more information.
DYNAMIC is the default row format.
The DYNAMIC row format is similar to the COMPACT row format, but tables using the DYNAMIC row format can store even more data on overflow pages than tables using the COMPACT row format. This results in more efficient data storage than tables using the COMPACT row format, especially for tables containing columns using the , , and data types. However, InnoDB tables using the COMPRESSED row format are more efficient.
See for more information.
An alternative way to compress InnoDB tables is by using .
The COMPRESSED row format is similar to the COMPACT row format, but tables using the COMPRESSED row format can store even more data on overflow pages than tables using the COMPACT row format. This results in more efficient data storage than tables using the COMPACT row format, especially for tables containing columns using the , , and data types.
The COMPRESSED row format also supports compression of all data and index pages.
See for more information.
Several factors help determine the maximum row size of an InnoDB table.
First, MariaDB enforces a 65,535 byte limit on a table's maximum row size. The total size of a table's and columns do not count towards this limit. Only the pointers for a table's and columns count towards this limit. MariaDB enforces this limit for all storage engines, so this limit also applies to InnoDB tables. Therefore, this limit is the absolute maximum row size for an InnoDB table.
If you try to create a table that exceeds MariaDB's global limit on a table's maximum row size, then you will see an error like this:
However, InnoDB also has its own limits on the maximum row size, so an InnoDB table's maximum row size could be smaller than MariaDB's global limit.
Second, the maximum amount of data that an InnoDB table can store in a row's main data page depends on the value of the system variable. At most, the data that a single row can consume on the row's main data page is half of the value of the system variable. With the default value of 16k, that would mean that a single row can consume at most around 8 KB on the row's main data page. However, the limit on the row's main data page is not the absolute limit on the row's size.
Third, all InnoDB row formats can store certain kinds of data in overflow pages, so the maximum row size of an InnoDB table can be larger than the maximum amount of data that can be stored in the row's main data page.
Some row formats can store more data in overflow pages than others. For example, the DYNAMIC and COMPRESSED row formats can store the most data in overflow pages. To see how to determine the how the various InnoDB row formats can use overflow pages, see the following sections:
If a table's definition can allow rows that the table's InnoDB row format can't actually store, then InnoDB will raise errors or warnings in certain scenarios.
If the table were using the REDUNDANT or COMPACT row formats, then the error or warning would be the following:
And if the table were using the DYNAMIC or COMPRESSED row formats, then the error or warning would be the following:
These messages are raised in the following cases:
If is enabled and if a statement is executed that touches the table, such as or , then InnoDB will raise an error with this message
If is disabled and if a statement is executed that touches the table, such as or [ALTER TABLE](../../../sql-statements-and-structure/sql-statements/data-definition/alter/alter-table.md), then InnoDB will raise a warning with this message.
Regardless of whether is enabled, if a statement is executed that attempts to write a row that the table's InnoDB row format can't store, then InnoDB will raise an error with this message.
For information on how to solve the problem, see .
In earlier versions, MariaDB doesn't properly calculate the row sizes while executing DDL. In these versions, unsafe tables can be created, even if is enabled. The calculations were fixed by .
As a side effect, some tables that could be created or altered in previous versions may get rejected with the following error in these releases and any later releases.
And users could also see the following message as an error or warning in the :
InnoDB used the wrong calculations to determine row sizes for quite a long time, so a lot of users may unknowingly have unsafe tables that the InnoDB row format can't actually store.
InnoDB does not currently have an easy way to check which existing tables have this problem. See for more information.
For information on how to solve the problem, see .
This page is licensed: CC BY-SA / Gnu FDL
Yes
No
No
Efficiently utilizes buffer pool
Yes
No
Yes
Yes
Supported Page Sizes
• 64k • 32k • 16k • 8k • 4k
• 16k • 8k • 4k
• 64k • 32k • 16k • 8k • 4k
• 64k • 32k • 16k • 8k • 4k
Maximum size of indexed column values
• 3072 bytes (innodb_page_size >= 16k) • 1536 bytes (innodb_page_size == 8k) • 768 bytes (innodb_page_size == 4k)
• 3072 bytes (innodb_page_size >= 16k) • 1536 bytes (innodb_page_size == 8k) • 768 bytes (innodb_page_size == 4k)
767 bytes
767 bytes
Supports ADD/DROP column with INSTANT Algorithm
Yes
No
Yes
Yes
Feature
Default
Yes
No
No
No
Recommended
Yes
No
No
No
Efficiently stores large columns
Yes
SET SESSION innodb_strict_mode=ON;
SET GLOBAL innodb_default_row_format='dynamic';
CREATE TABLE tab (
id INT,
str VARCHAR(50)
) ENGINE=InnoDB;SET SESSION innodb_strict_mode=ON;
SET GLOBAL innodb_file_per_table=ON;
SET GLOBAL innodb_file_format='Barracuda';
CREATE TABLE tab (
id INT,
str VARCHAR(50)
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;SHOW TABLE STATUS FROM db1 WHERE Name='tab'\G
*************************** 1. row ***************************
Name: tab
Engine: InnoDB
Version: 10
Row_format: Dynamic
Rows: 0
Avg_row_length: 0
Data_length: 16384
Max_data_length: 0
Index_length: 0
Data_free: 0
Auto_increment: NULL
Create_time: 2019-04-18 20:24:04
Update_time: NULL
Check_time: NULL
Collation: latin1_swedish_ci
Checksum: NULL
Create_options: row_format=DYNAMIC
Comment:SELECT * FROM information_schema.INNODB_SYS_TABLES WHERE name='db1/tab'\G
*************************** 1. row ***************************
TABLE_ID: 42
NAME: db1/tab
FLAG: 33
N_COLS: 4
SPACE: 27
FILE_FORMAT: Barracuda
ROW_FORMAT: Dynamic
ZIP_PAGE_SIZE: 0
SPACE_TYPE: SingleERROR 1118 (42000): Row size too large. The maximum row size for the used table type,
not counting BLOBs, is 65535. This includes storage overhead, check the manual. You
have to change some columns to TEXT or BLOBsERROR 1118 (42000): Row size too large (> 8126). Changing some columns to
TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED
may help. In current row format, BLOB prefix of 768 bytes is stored inline.ERROR 1118 (42000): Row size too large (> 8126). Changing some columns to
TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.ERROR 1118 (42000): Row size too large (> 8126). Changing some columns to
TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.[Warning] InnoDB: Cannot add field col in table db1.tab because after adding it, the row size is 8478 which is greater than maximum allowed size (8126) for a record on index leaf page.snappy
Pages are compressed using the algorithm.
nvmfs
Number of 16384 sectors trimmed
Number of 32768 sectors trimmed
Number of pages compressed
Number of trim operations
Number of trim operations saved
Number of pages decompressed
Number of compression errors
none
Pages are not compressed. This is the default value in and before, and and before.
zlib
Pages are compressed using the bundled zlib compression algorithm. This is the default value in and later, and and later.
lz4
Pages are compressed using the lz4 compression algorithm.
lzo
Pages are compressed using the lzo compression algorithm.
lzma
Pages are compressed using the lzma compression algorithm.
bzip2
Pages are compressed using the bzip2 compression algorithm.
Whether InnoDB supports the lz4 compression algorithm.
Whether InnoDB supports the lzo compression algorithm.
Whether InnoDB supports the lzma compression algorithm.
Whether InnoDB supports the bzip2 compression algorithm.
Whether InnoDB supports the snappy compression algorithm.
OFF
New InnoDB tables do not use InnoDB page compression. This is the default value.
ON
New InnoDB tables use InnoDB page compression.
Bytes saved by compression
Number of 512 sectors trimmed
Number of 1024 sectors trimmed
Number of 2048 sectors trimmed
Number of 4096 sectors trimmed
Number of 8192 sectors trimmed
Understand the NOCOPY algorithm, which avoids rebuilding the clustered index for certain operations like adding secondary indexes, significantly reducing I/O.
When the clause is set to NOCOPY, the supported operations are a superset of the operations that are supported when the clause is set to INSTANT.
Therefore, when the clause is set to NOCOPY, some operations are supported by inheritance. See the following additional pages for more information about these supported operations:
SET GLOBAL innodb_compression_algorithm='lzma';[mariadb]
...
innodb_compression_algorithm=lzmaSHOW GLOBAL STATUS WHERE Variable_name IN (
'Innodb_have_lz4',
'Innodb_have_lzo',
'Innodb_have_lzma',
'Innodb_have_bzip2',
'Innodb_have_snappy'
);
+--------------------+-------+
| Variable_name | Value |
+--------------------+-------+
| Innodb_have_lz4 | OFF |
| Innodb_have_lzo | OFF |
| Innodb_have_lzma | ON |
| Innodb_have_bzip2 | OFF |
| Innodb_have_snappy | OFF |
+--------------------+-------+wget https://downloads.mariadb.com/MariaDB/mariadb-10.4.8/source/mariadb-10.4.8.tar.gz
tar -xvzf mariadb-10.4.8.tar.gz
cd mariadb-10.4.8/cmake .makemake installmake packageSET GLOBAL innodb_compression_default=ON;SET GLOBAL innodb_file_per_table=ON;
SET GLOBAL innodb_file_format='Barracuda';
SET GLOBAL innodb_default_row_format='dynamic';
SET GLOBAL innodb_compression_algorithm='lzma';
SET SESSION innodb_compression_default=ON;
CREATE TABLE users (
user_id INT NOT NULL,
b VARCHAR(200),
PRIMARY KEY(user_id)
)
ENGINE=InnoDB;[mariadb]
...
innodb_compression_default=ONSET GLOBAL innodb_file_per_table=ON;
SET GLOBAL innodb_file_format='Barracuda';
SET GLOBAL innodb_default_row_format='dynamic';
SET GLOBAL innodb_compression_algorithm='lzma';
CREATE TABLE users (
user_id INT NOT NULL,
b VARCHAR(200),
PRIMARY KEY(user_id)
)
ENGINE=InnoDB
PAGE_COMPRESSED=1;SET GLOBAL innodb_compression_level=9;[mariadb]
...
innodb_compression_level=9SET GLOBAL innodb_file_per_table=ON;
SET GLOBAL innodb_file_format='Barracuda';
SET GLOBAL innodb_default_row_format='dynamic';
SET GLOBAL innodb_compression_algorithm='lzma';
CREATE TABLE users (
user_id INT NOT NULL,
b VARCHAR(200),
PRIMARY KEY(user_id)
)
ENGINE=InnoDB
PAGE_COMPRESSED=1
PAGE_COMPRESSION_LEVEL=9;SET GLOBAL innodb_compression_failure_threshold_pct=10;[mariadb]
...
innodb_compression_failure_threshold_pct=10SET GLOBAL innodb_compression_pad_pct_max=75;[mariadb]
...
innodb_compression_pad_pct_max=75fallocate(file_handle, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, file_offset, remainder_len);DeviceIoControl(file_handle, FSCTL_SET_SPARSE, inbuf, inbuf_size,
outbuf, outbuf_size, NULL, &overlapped)
...
DeviceIoControl(file_handle, FSCTL_SET_ZERO_DATA, inbuf, inbuf_size,
outbuf, outbuf_size, NULL, &overlapped)[mariadb]
...
innodb_use_trim=ON
innodb_use_fallocate=ONCREATE TABLE `tab` (
`id` INT(11) NOT NULL,
`str` VARCHAR(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
INSERT INTO tab VALUES (1, 'str1');
SHOW GLOBAL STATUS LIKE 'Innodb_num_pages_page_compressed';
+----------------------------------+-------+
| Variable_name | Value |
+----------------------------------+-------+
| Innodb_num_pages_page_compressed | 0 |
+----------------------------------+-------+
SET GLOBAL innodb_file_per_table=ON;
SET GLOBAL innodb_file_format='Barracuda';
SET GLOBAL innodb_default_row_format='dynamic';
SET GLOBAL innodb_compression_algorithm='lzma';
ALTER TABLE tab PAGE_COMPRESSED=1;
SHOW GLOBAL STATUS LIKE 'Innodb_num_pages_page_compressed';
+----------------------------------+-------+
| Variable_name | Value |
+----------------------------------+-------+
| Innodb_num_pages_page_compressed | 0 |
+----------------------------------+-------+
SELECT SLEEP(10);
+-----------+
| SLEEP(10) |
+-----------+
| 0 |
+-----------+
SHOW GLOBAL STATUS LIKE 'Innodb_num_pages_page_compressed';
+----------------------------------+-------+
| Variable_name | Value |
+----------------------------------+-------+
| Innodb_num_pages_page_compressed | 3 |
+----------------------------------+-------+In and later, InnoDB supports adding columns to a table with ALGORITHM set to NOCOPY in the cases where the operation supports having the ALGORITHM clause set to INSTANT.
See InnoDB Online DDL Operations with ALGORITHM=INSTANT: ALTER TABLE ... ADD COLUMN for more information.
This applies to ALTER TABLE ... ADD COLUMN for InnoDB tables.
In and later, InnoDB supports dropping columns from a table with ALGORITHM set to NOCOPY in the cases where the operation supports having the ALGORITHM clause set to INSTANT.
See InnoDB Online DDL Operations with ALGORITHM=INSTANT: ALTER TABLE ... DROP COLUMN for more information.
This applies to ALTER TABLE ... DROP COLUMN for InnoDB tables.
This applies to ALTER TABLE ... MODIFY COLUMN for InnoDB tables.
In and later, InnoDB supports reordering columns within a table with ALGORITHM set to NOCOPY in the cases where the operation supports having the ALGORITHM clause set to INSTANT.
See InnoDB Online DDL Operations with ALGORITHM=INSTANT: Reordering Columns for more information.
InnoDB does not support modifying a column's data type with ALGORITHM set to NOCOPY in most cases. There are a few exceptions in the cases where the operation supports having the ALGORITHM clause set to INSTANT.
See InnoDB Online DDL Operations with ALGORITHM=INSTANT: Changing the Data Type of a Column for more information.
In and later, InnoDB supports modifying a column to allow NULL values with ALGORITHM set to NOCOPY in the cases where the operation supports having the ALGORITHM clause set to INSTANT.
See InnoDB Online DDL Operations with ALGORITHM=INSTANT: Changing a Column to NULL for more information.
For example:
InnoDB supports adding a new ENUM option to a column with ALGORITHM set to NOCOPY in the cases where the operation supports having the ALGORITHM clause set to INSTANT.
See InnoDB Online DDL Operations with ALGORITHM=INSTANT: Adding a New ENUM Option for more information.
InnoDB supports adding a new SET option to a column with ALGORITHM set to NOCOPY in the cases where the operation supports having the ALGORITHM clause set to INSTANT.
See InnoDB Online DDL Operations with ALGORITHM=INSTANT: Adding a New SET Option for more information.
In and later, InnoDB supports removing system versioning from a column with ALGORITHM set to NOCOPY in the cases where the operation supports having the ALGORITHM clause set to INSTANT.
See InnoDB Online DDL Operations with ALGORITHM=INSTANT: Removing System Versioning from a Column for more information.
This applies to ALTER TABLE ... ALTER COLUMN for InnoDB tables.
InnoDB supports modifying a column's DEFAULT value with ALGORITHM set to NOCOPY in the cases where the operation supports having the ALGORITHM clause set to INSTANT.
See InnoDB Online DDL Operations with ALGORITHM=INSTANT: Setting a Column's Default Value for more information.
InnoDB supports removing a column's DEFAULT value with ALGORITHM set to NOCOPY in the cases where the operation supports having the ALGORITHM clause set to INSTANT.
See InnoDB Online DDL Operations with ALGORITHM=INSTANT: Removing a Column's Default Value for more information.
InnoDB supports renaming a column with ALGORITHM set to NOCOPY in the cases where the operation supports having the ALGORITHM clause set to INSTANT.
See InnoDB Online DDL Operations with ALGORITHM=INSTANT: ALTER TABLE ... CHANGE COLUMN for more information.
This applies to ALTER TABLE ... CHANGE COLUMN for InnoDB tables.
InnoDB does not support adding a primary key to a table with ALGORITHM set to NOCOPY.
For example:
This applies to ALTER TABLE ... ADD PRIMARY KEY for InnoDB tables.
InnoDB does not support dropping a primary key with ALGORITHM set to NOCOPY.
For example:
This applies to ALTER TABLE ... DROP PRIMARY KEY for InnoDB tables.
This applies to ALTER TABLE ... ADD INDEX and CREATE INDEX for InnoDB tables.
InnoDB supports adding a plain index to a table with ALGORITHM set to NOCOPY.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the LOCK clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example, this succeeds:
And this succeeds:
However, there are some limitations, such as:
Adding a FULLTEXT index to a table that does not have a user-defined FTS_DOC_ID column will require the table to be rebuilt once. When the table is rebuilt, the system adds a hidden FTS_DOC_ID column. This initial operation will have to be performed with ALGORITHM set to INPLACE.From that point forward, adding additional FULLTEXT indexes to the same table will not require the table to be rebuilt, and ALGORITHM can be set to NOCOPY.
This operation supports a read-only locking strategy. This strategy can be explicitly chosen by setting the LOCK clause to SHARED. When this strategy is used, read-only concurrent DML is permitted.
For example, this succeeds, but the first operation requires the table to be rebuilt ALGORITHM set to INPLACE, so that the hidden FTS_DOC_ID column can be added:
And this succeeds in the same way as above:
But this second command fails, because only one FULLTEXT index can be added at a time:
This operation supports a read-only locking strategy. This strategy can be explicitly chosen by setting the LOCK clause to SHARED. When this strategy is used, read-only concurrent DML is permitted.
For example, this succeeds:
And this succeeds in the same way as above:
InnoDB supports dropping indexes from a table with ALGORITHM set to NOCOPY in the cases where the operation supports having the ALGORITHM clause set to INSTANT.
See InnoDB Online DDL Operations with ALGORITHM=INSTANT: ALTER TABLE ... DROP INDEX and DROP INDEX for more information.
This applies to ALTER TABLE ... DROP INDEX and DROP INDEX for InnoDB tables.
InnoDB does supports adding foreign key constraints to a table with ALGORITHM set to NOCOPY. In order to add a new foreign key constraint to a table with ALGORITHM set to NOCOPY, the foreign_key_checks system variable needs to be set to OFF. If it is set to ON, then ALGORITHM=COPY is required.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the LOCK clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example, this fails:
But this succeeds:
This applies to ALTER TABLE ... ADD FOREIGN KEY for InnoDB tables.
InnoDB supports dropping foreign key constraints from a table with ALGORITHM set to NOCOPY in the cases where the operation supports having the ALGORITHM clause set to INSTANT.
See InnoDB Online DDL Operations with ALGORITHM=INSTANT: ALTER TABLE ... DROP FOREIGN KEY for more information.
This applies to ALTER TABLE ... DROP FOREIGN KEY for InnoDB tables.
InnoDB supports changing a table's AUTO_INCREMENT value with ALGORITHM set to NOCOPY in the cases where the operation supports having the ALGORITHM clause set to INSTANT.
See InnoDB Online DDL Operations with ALGORITHM=INSTANT: ALTER TABLE ... AUTO_INCREMENT=... for more information.
This applies to ALTER TABLE ... AUTO_INCREMENT=... for InnoDB tables.
InnoDB does not support changing a table's row format with ALGORITHM set to NOCOPY.
For example:
This applies to ALTER TABLE ... ROW_FORMAT=... for InnoDB tables.
InnoDB does not support changing a table's KEY_BLOCK_SIZE with ALGORITHM set to NOCOPY.
For example:
This applies to KEY_BLOCK_SIZE=... for InnoDB tables.
In and later, InnoDB supports setting a table's PAGE_COMPRESSED value to 1 with ALGORITHM set to NOCOPY in the cases where the operation supports having the ALGORITHM clause set to INSTANT.
InnoDB does not support changing a table's PAGE_COMPRESSED value from 1 to 0 with ALGORITHM set to NOCOPY.
In these versions, InnoDB also supports changing a table's PAGE_COMPRESSION_LEVEL value with ALGORITHM set to NOCOPY in the cases where the operation supports having the ALGORITHM clause is set to INSTANT.
See InnoDB Online DDL Operations with ALGORITHM=INSTANT: ALTER TABLE ... PAGE_COMPRESSED=1 and ALTER TABLE ... PAGE_COMPRESSION_LEVEL=... for more information.
This applies to ALTER TABLE ... PAGE_COMPRESSED=... and ALTER TABLE ... PAGE_COMPRESSION_LEVEL=... for InnoDB tables.
InnoDB does not support dropping system versioning from a table with ALGORITHM set to NOCOPY.
For example:
This applies to ALTER TABLE ... DROP SYSTEM VERSIONING for InnoDB tables.
In and later, InnoDB supports dropping a CHECK constraint from a table with ALGORITHM set to NOCOPY in the cases where the operation supports having the ALGORITHM clause set to INSTANT.
See InnoDB Online DDL Operations with ALGORITHM=INSTANT: ALTER TABLE ... DROP CONSTRAINT for more information.
This applies to ALTER TABLE ... DROP CONSTRAINT for InnoDB tables.
InnoDB does not support forcing a table rebuild with ALGORITHM set to NOCOPY.
For example:
This applies to ALTER TABLE ... FORCE for InnoDB tables.
InnoDB does not support forcing a table rebuild with ALGORITHM set to NOCOPY.
For example:
This applies to ALTER TABLE ... ENGINE=InnoDB for InnoDB tables.
InnoDB does not support optimizing a table with ALGORITHM set to NOCOPY.
For example:
This applies to OPTIMIZE TABLE for InnoDB tables.
InnoDB supports renaming a table with ALGORITHM set to NOCOPY in the cases where the operation supports having the ALGORITHM clause set to INSTANT.
See InnoDB Online DDL Operations with ALGORITHM=INSTANT: ALTER TABLE ... RENAME TO and RENAME TABLE ... for more information.
This applies to ALTER TABLE ... RENAME TO and RENAME TABLE for InnoDB tables.
Generated columns do not currently support online DDL for all of the same operations that are supported for "real" columns.
See Generated (Virtual and Persistent/Stored) Columns: Statement Support for more information on the limitations.
This page is licensed: CC BY-SA / Gnu FDL
CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
) ROW_FORMAT=REDUNDANT;
SET SESSION alter_algorithm='NOCOPY';
ALTER TABLE tab MODIFY COLUMN c VARCHAR(50) NOT NULL;
ERROR 1845 (0A000): ALGORITHM=NOCOPY is not supported for this operation. Try ALGORITHM=INPLACECREATE OR REPLACE TABLE tab (
a INT,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION sql_mode='STRICT_TRANS_TABLES';
SET SESSION alter_algorithm='NOCOPY';
ALTER TABLE tab ADD PRIMARY KEY (a);
ERROR 1845 (0A000): ALGORITHM=NOCOPY is not supported for this operation. Try ALGORITHM=INPLACECREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='NOCOPY';
ALTER TABLE tab DROP PRIMARY KEY;
ERROR 1846 (0A000): ALGORITHM=NOCOPY is not supported. Reason: Dropping a primary key is not allowed without also adding a new primary key. Try ALGORITHM=COPYCREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='NOCOPY';
ALTER TABLE tab ADD INDEX b_index (b);
Query OK, 0 rows affected (0.009 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='NOCOPY';
CREATE INDEX b_index ON tab (b);
Query OK, 0 rows affected (0.009 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab ADD FULLTEXT INDEX b_index (b);
Query OK, 0 rows affected (0.043 sec)
SET SESSION alter_algorithm='NOCOPY';
ALTER TABLE tab ADD FULLTEXT INDEX c_index (c);
Query OK, 0 rows affected (0.017 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
CREATE FULLTEXT INDEX b_index ON tab (b);
Query OK, 0 rows affected (0.048 sec)
SET SESSION alter_algorithm='NOCOPY';
CREATE FULLTEXT INDEX c_index ON tab (c);
Query OK, 0 rows affected (0.016 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50),
d VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab ADD FULLTEXT INDEX b_index (b);
Query OK, 0 rows affected (0.041 sec)
SET SESSION alter_algorithm='NOCOPY';
ALTER TABLE tab ADD FULLTEXT INDEX c_index (c), ADD FULLTEXT INDEX d_index (d);
ERROR 1846 (0A000): ALGORITHM=NOCOPY is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPYCREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c GEOMETRY NOT NULL
);
SET SESSION alter_algorithm='NOCOPY';
ALTER TABLE tab ADD SPATIAL INDEX c_index (c);
Query OK, 0 rows affected (0.005 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c GEOMETRY NOT NULL
);
SET SESSION alter_algorithm='NOCOPY';
CREATE SPATIAL INDEX c_index ON tab (c);
Query OK, 0 rows affected (0.005 sec)CREATE OR REPLACE TABLE tab1 (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50),
d INT
);
CREATE OR REPLACE TABLE tab2 (
a INT PRIMARY KEY,
b VARCHAR(50)
);
SET SESSION alter_algorithm='NOCOPY';
ALTER TABLE tab1 ADD FOREIGN KEY tab2_fk (d) REFERENCES tab2 (a);
ERROR 1846 (0A000): ALGORITHM=NOCOPY is not supported. Reason: Adding foreign keys needs foreign_key_checks=OFF. Try ALGORITHM=COPYCREATE OR REPLACE TABLE tab1 (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50),
d INT
);
CREATE OR REPLACE TABLE tab2 (
a INT PRIMARY KEY,
b VARCHAR(50)
);
SET SESSION foreign_key_checks=OFF;
SET SESSION alter_algorithm='NOCOPY';
ALTER TABLE tab1 ADD FOREIGN KEY tab2_fk (d) REFERENCES tab2 (a);
Query OK, 0 rows affected (0.011 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
) ROW_FORMAT=DYNAMIC;
SET SESSION alter_algorithm='NOCOPY';
ALTER TABLE tab ROW_FORMAT=COMPRESSED;
ERROR 1846 (0A000): ALGORITHM=NOCOPY is not supported. Reason: Changing table options requires the table to be rebuilt. Try ALGORITHM=INPLACECREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
) ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE=4;
SET SESSION alter_algorithm='NOCOPY';
ALTER TABLE tab KEY_BLOCK_SIZE=2;
ERROR 1846 (0A000): ALGORITHM=NOCOPY is not supported. Reason: Changing table options requires the table to be rebuilt. Try ALGORITHM=INPLACECREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
) WITH SYSTEM VERSIONING;
SET SESSION alter_algorithm='NOCOPY';
ALTER TABLE tab DROP SYSTEM VERSIONING;
ERROR 1845 (0A000): ALGORITHM=NOCOPY is not supported for this operation. Try ALGORITHM=INPLACECREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='NOCOPY';
ALTER TABLE tab FORCE;
ERROR 1845 (0A000): ALGORITHM=NOCOPY is not supported for this operation. Try ALGORITHM=INPLACECREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='NOCOPY';
ALTER TABLE tab ENGINE=InnoDB;
ERROR 1845 (0A000): ALGORITHM=NOCOPY is not supported for this operation. Try ALGORITHM=INPLACECREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SHOW GLOBAL VARIABLES WHERE Variable_name IN('innodb_defragment', 'innodb_optimize_fulltext_only');
+-------------------------------+-------+
| Variable_name | Value |
+-------------------------------+-------+
| innodb_defragment | OFF |
| innodb_optimize_fulltext_only | OFF |
+-------------------------------+-------+
2 rows in set (0.001 sec)
SET SESSION alter_algorithm='NOCOPY';
OPTIMIZE TABLE tab;
+---------+----------+----------+-----------------------------------------------------------------------------+
| Table | Op | Msg_type | Msg_text |
+---------+----------+----------+-----------------------------------------------------------------------------+
| db1.tab | optimize | note | Table does not support optimize, doing recreate + analyze instead |
| db1.tab | optimize | error | ALGORITHM=NOCOPY is not supported for this operation. Try ALGORITHM=INPLACE |
| db1.tab | optimize | status | Operation failed |
+---------+----------+----------+-----------------------------------------------------------------------------+
3 rows in set, 1 warning (0.002 sec)Discover the INSTANT algorithm, which modifies table metadata without rebuilding the table, enabling extremely fast schema changes like adding columns.
ALTER TABLE ... ADD COLUMNIn and later, InnoDB supports adding columns to a table with set to INSTANT if the new column is the last column in the table. See for more information. If the table has a hidden FTS_DOC_ID column is present, then this is not supported.
In and later, InnoDB supports adding columns to a table with set to INSTANT, regardless of where in the column list the new column is added.
When this operation is performed with set to INSTANT, the tablespace file will have a non-canonical storage format. See for more information.
With the exception of adding an column, this operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example, this succeeds:
And this succeeds in and later:
This applies to for tables.
See for more information.
ALTER TABLE ... DROP COLUMNIn and later, InnoDB supports dropping columns from a table with set to INSTANT. See for more information.
When this operation is performed with set to INSTANT, the tablespace file will have a non-canonical storage format. See for more information.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example:
This applies to for tables.
ALTER TABLE ... MODIFY COLUMNThis applies to for tables.
In and later, InnoDB supports reordering columns within a table with set to INSTANT. See for more information.
When this operation is performed with set to INSTANT, the tablespace file will have a non-canonical storage format. See for more information.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example:
InnoDB does not support modifying a column's data type with set to INSTANT in most cases. There are some exceptions:
InnoDB supports increasing the length of VARCHAR columns with set to INSTANT, unless it would require changing the number of bytes requires to represent the column's length. A VARCHAR column that is between 0 and 255 bytes in size requires 1 byte to represent its length, while a VARCHAR column that is 256 bytes or longer requires 2 bytes to represent its length. This means that the length of a column cannot be increased with set to INSTANT if the original length was less than 256 bytes, and the new length is 256 bytes or more.
In and later, InnoDB supports increasing the length of VARCHAR
The supported operations in this category support the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example, this fails:
But this succeeds because the original length of the column is less than 256 bytes, and the new length is still less than 256 bytes:
But this fails because the original length of the column is between 128 bytes and 255 bytes, and the new length is greater than 256 bytes:
But this succeeds in and later because the table has ROW_FORMAT=REDUNDANT:
And this succeeds in and later because the table has ROW_FORMAT=DYNAMIC and the column's original length is 127 bytes or less:
And this succeeds in and later because the table has ROW_FORMAT=COMPRESSED and the column's original length is 127 bytes or less:
But this fails even in and later because the table has ROW_FORMAT=DYNAMIC and the column's original length is between 128 bytes and 255 bytes:
In and later, InnoDB supports modifying a column to allow values with set to INSTANT if the table option is set to . See for more information.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example:
InnoDB does not support modifying a column to not allow values with set to INSTANT.
For example:
ENUM OptionInnoDB supports adding a new option to a column with set to INSTANT. In order to add a new option with set to INSTANT, the following requirements must be met:
It must be added to the end of the list.
The storage requirements must not change.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example, this succeeds:
But this fails:
SET OptionInnoDB supports adding a new option to a column with set to INSTANT. In order to add a new option with set to INSTANT, the following requirements must be met:
It must be added to the end of the list.
The storage requirements must not change.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example, this succeeds:
But this fails:
In and later, InnoDB supports removing from a column with set to INSTANT. In order for this to work, the system variable must be set to KEEP. See for more information.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example:
ALTER TABLE ... ALTER COLUMNThis applies to for tables.
InnoDB supports modifying a column's value with set to INSTANT.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example:
InnoDB supports removing a column's value with set to INSTANT.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
ALTER TABLE ... CHANGE COLUMNInnoDB supports renaming a column with set to INSTANT, unless the column's data type or attributes changed in addition to the name.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example, this succeeds:
But this fails:
This applies to for tables.
ALTER TABLE ... ADD PRIMARY KEYInnoDB does not support adding a primary key to a table with set to INSTANT.
For example:
This applies to for tables.
ALTER TABLE ... DROP PRIMARY KEYInnoDB does not support dropping a primary key with set to INSTANT.
For example:
This applies to for tables.
ALTER TABLE ... ADD INDEX and CREATE INDEXThis applies to and for tables.
InnoDB does not support adding a plain index to a table with set to INSTANT.
For example, this fails:
And this fails:
InnoDB does not support adding a index to a table with set to INSTANT.
For example, this fails:
And this fails:
InnoDB does not support adding a index to a table with set to INSTANT.
For example, this fails:
And this fails:
ALTER TABLE ... ADD FOREIGN KEYInnoDB does not support adding foreign key constraints to a table with set to INSTANT.
For example:
This applies to for tables.
ALTER TABLE ... DROP FOREIGN KEYInnoDB supports dropping foreign key constraints from a table with set to INSTANT.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example:
This applies to for tables.
ALTER TABLE ... AUTO_INCREMENT=...InnoDB supports changing a table's value with set to INSTANT.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example:
This applies to for tables.
ALTER TABLE ... ROW_FORMAT=...InnoDB does not support changing a table's with set to INSTANT.
For example:
This applies to for tables.
ALTER TABLE ... KEY_BLOCK_SIZE=...InnoDB does not support changing a table's with set to INSTANT.
For example:
This applies to for tables.
ALTER TABLE ... PAGE_COMPRESSED=1 and ALTER TABLE ... PAGE_COMPRESSION_LEVEL=...In and later, InnoDB supports setting a table's value to 1 with set to INSTANT. InnoDB does not support changing a table's value from 1 to 0 with set to INSTANT.
In these versions, InnoDB also supports changing a table's value with set to INSTANT.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
See for more information.
For example, this succeeds:
And this succeeds:
But this fails:
This applies to and for tables.
ALTER TABLE ... DROP SYSTEM VERSIONINGInnoDB does not support dropping from a table with set to INSTANT.
For example:
This applies to for tables.
ALTER TABLE ... DROP CONSTRAINTIn and later, InnoDB supports dropping a constraint from a table with set to INSTANT. See for more information.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example:
This applies to for tables.
ALTER TABLE ... FORCEInnoDB does not support forcing a table rebuild with set to INSTANT.
For example:
This applies to for tables.
ALTER TABLE ... ENGINE=InnoDBInnoDB does not support forcing a table rebuild with set to INSTANT.
For example:
This applies to for tables.
OPTIMIZE TABLE ...InnoDB does not support optimizing a table with set to INSTANT.
For example:
This applies to for tables.
ALTER TABLE ... RENAME TO and RENAME TABLE ...InnoDB supports renaming a table with set to INSTANT.
This operation supports the exclusive locking strategy. This strategy can be explicitly chosen by setting the clause to EXCLUSIVE. When this strategy is used, concurrent DML is not permitted.
For example, this succeeds:
And this succeeds:
This applies to and for tables.
do not currently support online DDL for all of the same operations that are supported for "real" columns.
See for more information on the limitations.
Some operations cause a table's tablespace file to use a non-canonical storage format when the INSTANT algorithm is used. The affected operations include:
These operations require the following non-canonical changes to the storage format:
A hidden metadata record at the start of the clustered index is used to store each column's value. This makes it possible to add new columns that have default values without rebuilding the table.
A in the hidden metadata record is used to store column mappings. This makes it possible to drop or reorder columns without rebuilding the table. This also makes it possible to add columns to any position or drop columns from any position in the table without rebuilding the table.
If a column is dropped, old records will contain garbage in that column's former position, and new records are written with values, empty strings, or dummy values.
This non-canonical storage format has the potential to incur some performance or storage overhead for all subsequent DML operations. If you notice some issues like this and you want to normalize a table's storage format to avoid this problem, then you can do so by forcing a table rebuild by executing with set to INPLACE:
However, keep in mind that there are certain scenarios where you may not be able to rebuild the table with set to INPLACE. See for more information on those cases. If you hit one of those scenarios, but you still want to rebuild the table, then you would have to do so with set to COPY.
There are some known bugs that could lead to issues when an InnoDB DDL operation is performed using the algorithm. This algorithm will usually be chosen by default if the operation supports the algorithm.
The effect of many of these bugs is that the table seems to forget that its tablespace file is in the .
If you are concerned that a table may be affected by one of these bugs, then your best option would be to normalize the table structure. This can be done by rebuilding the table:
If you are concerned about these bugs, and you want to perform an operation that supports the algorithm, but you want to avoid using that algorithm, then you can set the algorithm to and add the FORCE keyword to the statement:
: This bug could cause a table to become corrupt if a column was added instantly. It is fixed in and .
: This bug could cause a table to become corrupt if a column was dropped instantly. It is fixed in .
: This bug could cause a table to become corrupt during page reorganization if a column was added instantly. It is fixed in and .
This page is licensed: CC BY-SA / Gnu FDL
INSTANT with no restrictions if the In and later, InnoDB also supports increasing the length of VARCHAR columns with ALGORITHM set to INSTANT in a more limited manner if the ROW_FORMAT table option is set to COMPACT, DYNAMIC, or COMPRESSED. In this scenario, the following limitations apply:
The length can be increased with ALGORITHM set to INSTANT if the original length of the column is 127 bytes or less, and the new length of the column is 256 bytes or more.
The length can be increased with set to INSTANT if the original length of the column is 255 bytes or less, and the new length of the column is still 255 bytes or less.
The length can be increased with set to INSTANT if the original length of the column is 256 bytes or more, and the new length of the column is still 256 bytes or more.
The length can not be increased with set to INSTANT if the original length was between 128 bytes and 255 bytes, and the new length is 256 bytes or more.
See for more information.
MDEV-20090: This bug could cause a table to become corrupt if columns were added, dropped, or reordered instantly. It is fixed in .
MDEV-18519: This bug could cause a table to become corrupt if a column was added instantly. It is fixed in MariaDB 10.6.9, , and .
MDEV-18519: This bug could cause a table to become corrupt if a column was added instantly. This isn't and won't be fixed in versions less than MariaDB 10.6.
CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50)
);
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab ADD COLUMN c VARCHAR(50);
Query OK, 0 rows affected (0.004 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50)
);
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab ADD COLUMN c VARCHAR(50) AFTER a;
Query OK, 0 rows affected (0.004 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab DROP COLUMN c;
Query OK, 0 rows affected (0.004 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab MODIFY COLUMN c VARCHAR(50) AFTER a;
Query OK, 0 rows affected (0.004 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab MODIFY COLUMN c INT;
ERROR 1846 (0A000): ALGORITHM=INSTANT is not supported. Reason: Cannot change column type INPLACE. Try ALGORITHM=COPYCREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
) CHARACTER SET=latin1;
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab MODIFY COLUMN c VARCHAR(100);
Query OK, 0 rows affected (0.005 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(255)
) CHARACTER SET=latin1;
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab MODIFY COLUMN c VARCHAR(256);
ERROR 1846 (0A000): ALGORITHM=INSTANT is not supported. Reason: Cannot change column type INPLACE. Try ALGORITHM=COPYCREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(200)
) ROW_FORMAT=REDUNDANT;
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab MODIFY COLUMN c VARCHAR(300);
Query OK, 0 rows affected (0.004 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(127)
) ROW_FORMAT=DYNAMIC
CHARACTER SET=latin1;
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab MODIFY COLUMN c VARCHAR(300);
Query OK, 0 rows affected (0.003 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(127)
) ROW_FORMAT=COMPRESSED
CHARACTER SET=latin1;
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab MODIFY COLUMN c VARCHAR(300);
Query OK, 0 rows affected (0.003 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(128)
) ROW_FORMAT=DYNAMIC
CHARACTER SET=latin1;
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab MODIFY COLUMN c VARCHAR(300);
ERROR 1846 (0A000): ALGORITHM=INSTANT is not supported. Reason: Cannot change column type INPLACE. Try ALGORITHM=COPYCREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50) NOT NULL
) ROW_FORMAT=REDUNDANT;
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab MODIFY COLUMN c VARCHAR(50) NULL;
Query OK, 0 rows affected (0.004 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
) ROW_FORMAT=REDUNDANT;
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab MODIFY COLUMN c VARCHAR(50) NOT NULL;
ERROR 1845 (0A000): ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACECREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c ENUM('red', 'green')
);
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab MODIFY COLUMN c ENUM('red', 'green', 'blue');
Query OK, 0 rows affected (0.002 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c ENUM('red', 'green')
);
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab MODIFY COLUMN c ENUM('red', 'blue', 'green');
ERROR 1846 (0A000): ALGORITHM=INSTANT is not supported. Reason: Cannot change column type INPLACE. Try ALGORITHM=COPYCREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c SET('red', 'green')
);
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab MODIFY COLUMN c SET('red', 'green', 'blue');
Query OK, 0 rows affected (0.002 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c SET('red', 'green')
);
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab MODIFY COLUMN c SET('red', 'blue', 'green');
ERROR 1846 (0A000): ALGORITHM=INSTANT is not supported. Reason: Cannot change column type INPLACE. Try ALGORITHM=COPYCREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50) WITH SYSTEM VERSIONING
);
SET SESSION system_versioning_alter_history='KEEP';
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab MODIFY COLUMN c VARCHAR(50) WITHOUT SYSTEM VERSIONING;
Query OK, 0 rows affected (0.004 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab ALTER COLUMN c SET DEFAULT 'NO value explicitly provided.';
Query OK, 0 rows affected (0.003 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50) DEFAULT 'NO value explicitly provided.'
);
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab ALTER COLUMN c DROP DEFAULT;
Query OK, 0 rows affected (0.002 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab CHANGE COLUMN c str VARCHAR(50);
Query OK, 0 rows affected (0.004 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab CHANGE COLUMN c num INT;
ERROR 1846 (0A000): ALGORITHM=INSTANT is not supported. Reason: Cannot change column type INPLACE. Try ALGORITHM=COPYCREATE OR REPLACE TABLE tab (
a INT,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION sql_mode='STRICT_TRANS_TABLES';
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab ADD PRIMARY KEY (a);
ERROR 1845 (0A000): ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACECREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab DROP PRIMARY KEY;
ERROR 1846 (0A000): ALGORITHM=INSTANT is not supported. Reason: Dropping a primary key is not allowed without also adding a new primary key. Try ALGORITHM=COPYCREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab ADD INDEX b_index (b);
ERROR 1846 (0A000): ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPYCREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INSTANT';
CREATE INDEX b_index ON tab (b);
ERROR 1846 (0A000): ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPYCREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab ADD FULLTEXT INDEX b_index (b);
Query OK, 0 rows affected (0.042 sec)
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab ADD FULLTEXT INDEX c_index (c);
ERROR 1846 (0A000): ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPYCREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
CREATE FULLTEXT INDEX b_index ON tab (b);
Query OK, 0 rows affected (0.040 sec)
SET SESSION alter_algorithm='INSTANT';
CREATE FULLTEXT INDEX c_index ON tab (c);
ERROR 1846 (0A000): ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPYCREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c GEOMETRY NOT NULL
);
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab ADD SPATIAL INDEX c_index (c);
ERROR 1846 (0A000): ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPYCREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c GEOMETRY NOT NULL
);
SET SESSION alter_algorithm='INSTANT';
CREATE SPATIAL INDEX c_index ON tab (c);
ERROR 1846 (0A000): ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPYCREATE OR REPLACE TABLE tab1 (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50),
d INT
);
CREATE OR REPLACE TABLE tab2 (
a INT PRIMARY KEY,
b VARCHAR(50)
);
SET SESSION foreign_key_checks=OFF;
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab1 ADD FOREIGN KEY tab2_fk (d) REFERENCES tab2 (a);
ERROR 1846 (0A000): ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPYCREATE OR REPLACE TABLE tab2 (
a INT PRIMARY KEY,
b VARCHAR(50)
);
CREATE OR REPLACE TABLE tab1 (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50),
d INT,
FOREIGN KEY tab2_fk (d) REFERENCES tab2 (a)
);
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab1 DROP FOREIGN KEY tab2_fk;
Query OK, 0 rows affected (0.004 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab AUTO_INCREMENT=100;
Query OK, 0 rows affected (0.002 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
) ROW_FORMAT=DYNAMIC;
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab ROW_FORMAT=COMPRESSED;
ERROR 1846 (0A000): ALGORITHM=INSTANT is not supported. Reason: Changing table options requires the table to be rebuilt. Try ALGORITHM=INPLACECREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
) ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE=4;
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab KEY_BLOCK_SIZE=2;
ERROR 1846 (0A000): ALGORITHM=INSTANT is not supported. Reason: Changing table options requires the table to be rebuilt. Try ALGORITHM=INPLACECREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab PAGE_COMPRESSED=1;
Query OK, 0 rows affected (0.004 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
) PAGE_COMPRESSED=1
PAGE_COMPRESSION_LEVEL=5;
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab PAGE_COMPRESSION_LEVEL=4;
Query OK, 0 rows affected (0.004 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
) PAGE_COMPRESSED=1;
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab PAGE_COMPRESSED=0;
ERROR 1846 (0A000): ALGORITHM=INSTANT is not supported. Reason: Changing table options requires the table to be rebuilt. Try ALGORITHM=INPLACECREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
) WITH SYSTEM VERSIONING;
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab DROP SYSTEM VERSIONING;
ERROR 1845 (0A000): ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACECREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50),
CONSTRAINT b_not_empty CHECK (b != '')
);
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab DROP CONSTRAINT b_not_empty;
Query OK, 0 rows affected (0.002 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab FORCE;
ERROR 1845 (0A000): ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACECREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab ENGINE=InnoDB;
ERROR 1845 (0A000): ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACECREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SHOW GLOBAL VARIABLES WHERE Variable_name IN('innodb_defragment', 'innodb_optimize_fulltext_only');
+-------------------------------+-------+
| Variable_name | Value |
+-------------------------------+-------+
| innodb_defragment | OFF |
| innodb_optimize_fulltext_only | OFF |
+-------------------------------+-------+
2 rows in set (0.001 sec)
SET SESSION alter_algorithm='INSTANT';
OPTIMIZE TABLE tab;
+---------+----------+----------+------------------------------------------------------------------------------+
| Table | Op | Msg_type | Msg_text |
+---------+----------+----------+------------------------------------------------------------------------------+
| db1.tab | optimize | note | Table does not support optimize, doing recreate + analyze instead |
| db1.tab | optimize | error | ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE |
| db1.tab | optimize | status | Operation failed |
+---------+----------+----------+------------------------------------------------------------------------------+
3 rows in set, 1 warning (0.002 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INSTANT';
ALTER TABLE tab RENAME TO old_tab;
Query OK, 0 rows affected (0.008 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INSTANT';
RENAME TABLE tab TO old_tab;
Query OK, 0 rows affected (0.008 sec)SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab FORCE;
Query OK, 0 rows affected (0.008 sec)SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab FORCE;
Query OK, 0 rows affected (0.008 sec)SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab ADD COLUMN c VARCHAR(50), FORCE;Learn about operations supported by the INPLACE algorithm, which rebuilds the table but allows concurrent DML, offering a balance between performance and availability.
When the ALGORITHM clause is set to INPLACE, the supported operations are a superset of the operations that are supported when the ALGORITHM clause is set to NOCOPY. Similarly, when the ALGORITHM clause is set to NOCOPY, the supported operations are a superset of the operations that are supported when the ALGORITHM clause is set to INSTANT.
Therefore, when the clause is set to INPLACE, some operations are supported by inheritance. See the following additional pages for more information about these supported operations:
ALTER TABLE ... ADD COLUMNInnoDB supports adding columns to a table with set to INPLACE.
The table is rebuilt, which means that all of the data is reorganized substantially, and the indexes are rebuilt. As a result, the operation is quite expensive.
With the exception of adding an column, this operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example:
This applies to for tables.
ALTER TABLE ... DROP COLUMNInnoDB supports dropping columns from a table with set to INPLACE.
The table is rebuilt, which means that all of the data is reorganized substantially, and the indexes are rebuilt. As a result, the operation is quite expensive.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example:
This applies to for tables.
ALTER TABLE ... MODIFY COLUMNThis applies to for tables.
InnoDB supports reordering columns within a table with set to INPLACE.
The table is rebuilt, which means that all of the data is reorganized substantially, and the indexes are rebuilt. As a result, the operation is quite expensive.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example:
InnoDB does not support modifying a column's data type with set to INPLACE in most cases. There are some exceptions:
In and later, InnoDB supports increasing the length of VARCHAR columns with set to INPLACE, unless it would require changing the number of bytes requires to represent the column's length. A VARCHAR column that is between 0 and 255 bytes in size requires 1 byte to represent its length, while a VARCHAR column that is 256 bytes or longer requires 2 bytes to represent its length. This means that the length of a column cannot be increased with set to INPLACE if the original length was less than 256 bytes, and the new length is 256 bytes or more.
In and later, InnoDB supports increasing the length of VARCHAR
See for more information.
For example, this fails:
But this succeeds in and later, because the original length of the column is less than 256 bytes, and the new length is still less than 256 bytes:
But this fails in and later, because the original length of the column is less than 256 bytes, and the new length is greater than 256 bytes:
InnoDB supports modifying a column to allow values with set to INPLACE.
The table is rebuilt, which means that all of the data is reorganized substantially, and the indexes are rebuilt. As a result, the operation is quite expensive.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example:
InnoDB supports modifying a column to not allow values with set to INPLACE. It is required for to be enabled in . The operation will fail if the column contains any NULL values. Changes that would interfere with referential integrity are also not permitted.
The table is rebuilt, which means that all of the data is reorganized substantially, and the indexes are rebuilt. As a result, the operation is quite expensive.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example:
ENUM OptionInnoDB supports adding a new option to a column with set to INPLACE. In order to add a new option with set to INPLACE, the following requirements must be met:
It must be added to the end of the list.
The storage requirements must not change.
This operation only changes the table's metadata, so the table does not have to be rebuilt..
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example, this succeeds:
But this fails:
SET OptionInnoDB supports adding a new option to a column with set to INPLACE. In order to add a new option with set to INPLACE, the following requirements must be met:
It must be added to the end of the list.
The storage requirements must not change.
This operation only changes the table's metadata, so the table does not have to be rebuilt..
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example, this succeeds:
But this fails:
In and later, InnoDB supports removing from a column with set to INPLACE. In order for this to work, the system variable must be set to KEEP. See for more information.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example:
ALTER TABLE ... ALTER COLUMNThis applies to for tables.
InnoDB supports modifying a column's value with set to INPLACE.
This operation only changes the table's metadata, so the table does not have to be rebuilt.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example:
InnoDB supports removing a column's value with set to INPLACE.
This operation only changes the table's metadata, so the table does not have to be rebuilt.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example:
ALTER TABLE ... CHANGE COLUMNInnoDB supports renaming a column with set to INPLACE, unless the column's data type or attributes changed in addition to the name.
This operation only changes the table's metadata, so the table does not have to be rebuilt.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example, this succeeds:
But this fails:
This applies to for tables.
ALTER TABLE ... ADD PRIMARY KEYInnoDB supports adding a primary key to a table with set to INPLACE.
If the new primary key column is not defined as , then it is highly recommended for to be enabled in . Otherwise, NULL values are silently converted to the default value for the given data type, which is probably not the desired behavior in this scenario.
The table is rebuilt, which means that all of the data is reorganized substantially, and the indexes are rebuilt. As a result, the operation is quite expensive.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example, this succeeds:
But this fails:
And this fails:
This applies to for tables.
ALTER TABLE ... DROP PRIMARY KEYInnoDB does not support dropping a primary key with set to INPLACE in most cases.
If you try to do so, then you will see an error. InnoDB only supports this operation with set to COPY. Concurrent DML is not permitted.
However, there is an exception. If you are dropping a primary key, and adding a new one at the same time, then that operation can be performed with set to INPLACE. This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example, this fails:
But this succeeds:
This applies to for tables.
ALTER TABLE ... ADD INDEX and CREATE INDEXThis applies to and for tables.
InnoDB supports adding a plain index to a table with set to INPLACE. The table is not rebuilt.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example, this succeeds:
And this succeeds:
InnoDB supports adding a index to a table with set to INPLACE. The table is not rebuilt in some cases.
However, there are some limitations, such as:
Adding a index to a table that does not have a user-defined FTS_DOC_ID column will require the table to be rebuilt once. When the table is rebuilt, the system adds a hidden FTS_DOC_ID column. From that point forward, adding additional indexes to the same table will not require the table to be rebuilt when is set to INPLACE.
Only one index may be added at a time when is set to INPLACE.
This operation supports a read-only locking strategy. This strategy can be explicitly chosen by setting the clause to SHARED. When this strategy is used, read-only concurrent DML is permitted.
For example, this succeeds, but requires the table to be rebuilt, so that the hidden FTS_DOC_ID column can be added:
And this succeeds in the same way as above:
And this succeeds, and the second command does not require the table to be rebuilt:
But this second command fails, because only one index can be added at a time:
And this third command fails, because a table cannot be rebuilt when it has more than one index:
InnoDB supports adding a index to a table with set to INPLACE.
However, there are some limitations, such as:
If a table has a index, then it cannot be rebuilt by any operations when the clause is set to NONE.
This operation supports a read-only locking strategy. This strategy can be explicitly chosen by setting the clause to SHARED. When this strategy is used, read-only concurrent DML is permitted.
For example, this succeeds:
And this succeeds in the same way as above:
ALTER TABLE ... DROP INDEX and DROP INDEXInnoDB supports dropping indexes from a table with set to INPLACE.
This operation only changes the table's metadata, so the table does not have to be rebuilt.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example, this succeeds:
And this succeeds:
This applies to and for tables.
ALTER TABLE ... ADD FOREIGN KEYInnoDB supports adding foreign key constraints to a table with set to INPLACE. In order to add a new foreign key constraint to a table with set to INPLACE, the system variable needs to be set to OFF. If it is set to ON, then ALGORITHM=COPY is required.
This operation only changes the table's metadata, so the table does not have to be rebuilt.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example, this fails:
But this succeeds:
This applies to for tables.
ALTER TABLE ... DROP FOREIGN KEYInnoDB supports dropping foreign key constraints from a table with set to INPLACE.
This operation only changes the table's metadata, so the table does not have to be rebuilt.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example:
This applies to for tables.
ALTER TABLE ... AUTO_INCREMENT=...InnoDB supports changing a table's value with set to INPLACE. This operation should finish instantly. The table is not rebuilt.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example:
This applies to for tables.
ALTER TABLE ... ROW_FORMAT=...InnoDB supports changing a table's with set to INPLACE.
The table is rebuilt, which means that all of the data is reorganized substantially, and the indexes are rebuilt. As a result, the operation is quite expensive.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example:
This applies to for tables.
ALTER TABLE ... KEY_BLOCK_SIZE=...InnoDB supports changing a table's with set to INPLACE.
The table is rebuilt, which means that all of the data is reorganized substantially, and the indexes are rebuilt. As a result, the operation is quite expensive.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example:
This applies to for tables.
ALTER TABLE ... PAGE_COMPRESSED=... and ALTER TABLE ... PAGE_COMPRESSION_LEVEL=...In and later, InnoDB supports setting a table's value to 1 with set to INPLACE. InnoDB also supports changing a table's value from 1 to 0 with set to INPLACE.
In these versions, InnoDB also supports changing a table's value with set to INPLACE.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
See for more information.
For example, this succeeds:
And this succeeds:
And this succeeds:
This applies to and for tables.
ALTER TABLE ... DROP SYSTEM VERSIONINGInnoDB supports dropping from a table with set to INPLACE.
This operation supports the read-only locking strategy. This strategy can be explicitly chosen by setting the clause to SHARED. When this strategy is used, read-only concurrent DML is permitted.
For example:
This applies to for tables.
ALTER TABLE ... DROP CONSTRAINTIn and later, InnoDB supports dropping a constraint from a table with set to INPLACE. See for more information.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example:
This applies to for tables.
ALTER TABLE ... FORCEInnoDB supports forcing a table rebuild with set to INPLACE.
The table is rebuilt, which means that all of the data is reorganized substantially, and the indexes are rebuilt. As a result, the operation is quite expensive.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example:
This applies to for tables.
ALTER TABLE ... ENGINE=InnoDBInnoDB supports forcing a table rebuild with set to INPLACE.
The table is rebuilt, which means that all of the data is reorganized substantially, and the indexes are rebuilt. As a result, the operation is quite expensive.
This operation supports the non-locking strategy. This strategy can be explicitly chosen by setting the clause to NONE. When this strategy is used, all concurrent DML is permitted.
For example:
This applies to for tables.
OPTIMIZE TABLE ...InnoDB supports optimizing a table with set to INPLACE.
If the system variable is set to OFF, and if the system variable is also set to OFF, then OPTIMIZE TABLE are equivalent to ALTER TABLE … FORCE.
The table is rebuilt, which means that all of the data is reorganized substantially, and the indexes are rebuilt. As a result, the operation is quite expensive.
If either of the previously mentioned system variables is set to ON, then OPTIMIZE TABLE will optimize some data without rebuilding the table. However, the file size will not be reduced.
For example, this succeeds:
And this succeeds, but the table is not rebuilt:
This applies to for tables.
ALTER TABLE ... RENAME TO and RENAME TABLE ...InnoDB supports renaming a table with set to INPLACE.
This operation only changes the table's metadata, so the table does not have to be rebuilt.
This operation supports the exclusive locking strategy. This strategy can be explicitly chosen by setting the clause to EXCLUSIVE. When this strategy is used, concurrent DML is not permitted.
For example, this succeeds:
And this succeeds:
This applies to and for tables.
If a table has more than one index, then it cannot be rebuilt by any operations when is set to INPLACE.
If a table has a index, then it cannot be rebuilt by any operations when the clause is set to NONE.
If a table has a index, then it cannot be rebuilt by any operations when the clause is set to NONE.
do not currently support online DDL for all of the same operations that are supported for "real" columns.
See for more information on the limitations.
This page is licensed: CC BY-SA / Gnu FDL
INPLACE in the cases where the operation supports having the INSTANT.INPLACE.If a table has a FULLTEXT index, then it cannot be rebuilt by any ALTER TABLE operations when the LOCK clause is set to NONE.
Diagnose and fix 'Row size too large' errors in InnoDB, usually caused by exceeding the maximum row size, by changing row formats to DYNAMIC or adjusting column data types.
With InnoDB, users can see the following message as an error or warning:
And they can also see the following message as an error or warning in the :
These messages indicate that the table's definition allows rows that the table's InnoDB row format can't actually store.
These messages are raised in the following cases:
If is enabled and if a statement is executed that touches the table, such as or , then InnoDB will raise an error with this message
CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab ADD COLUMN c VARCHAR(50);
Query OK, 0 rows affected (0.006 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab DROP COLUMN c;
Query OK, 0 rows affected (0.021 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab MODIFY COLUMN c VARCHAR(50) AFTER a;
Query OK, 0 rows affected (0.022 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab MODIFY COLUMN c INT;
ERROR 1846 (0A000): ALGORITHM=INPLACE is not supported. Reason: Cannot change column type INPLACE. Try ALGORITHM=COPYCREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
) CHARACTER SET=latin1;
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab MODIFY COLUMN c VARCHAR(100);
Query OK, 0 rows affected (0.005 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(255)
) CHARACTER SET=latin1;
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab MODIFY COLUMN c VARCHAR(256);
ERROR 1846 (0A000): ALGORITHM=INPLACE is not supported. Reason: Cannot change column type INPLACE. Try ALGORITHM=COPYCREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50) NOT NULL
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab MODIFY COLUMN c VARCHAR(50) NULL;
Query OK, 0 rows affected (0.021 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab MODIFY COLUMN c VARCHAR(50) NOT NULL;
Query OK, 0 rows affected (0.021 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c ENUM('red', 'green')
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab MODIFY COLUMN c ENUM('red', 'green', 'blue');
Query OK, 0 rows affected (0.004 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c ENUM('red', 'green')
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab MODIFY COLUMN c ENUM('red', 'blue', 'green');
ERROR 1846 (0A000): ALGORITHM=INPLACE is not supported. Reason: Cannot change column type INPLACE. Try ALGORITHM=COPYCREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c SET('red', 'green')
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab MODIFY COLUMN c SET('red', 'green', 'blue');
Query OK, 0 rows affected (0.004 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c SET('red', 'green')
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab MODIFY COLUMN c SET('red', 'blue', 'green');
ERROR 1846 (0A000): ALGORITHM=INPLACE is not supported. Reason: Cannot change column type INPLACE. Try ALGORITHM=COPYCREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50) WITH SYSTEM VERSIONING
);
SET SESSION system_versioning_alter_history='KEEP';
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab MODIFY COLUMN c VARCHAR(50) WITHOUT SYSTEM VERSIONING;
Query OK, 0 rows affected (0.005 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab ALTER COLUMN c SET DEFAULT 'NO value explicitly provided.';
Query OK, 0 rows affected (0.005 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50) DEFAULT 'NO value explicitly provided.'
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab ALTER COLUMN c DROP DEFAULT;
Query OK, 0 rows affected (0.005 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab CHANGE COLUMN c str VARCHAR(50);
Query OK, 0 rows affected (0.006 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab CHANGE COLUMN c num INT;
ERROR 1846 (0A000): ALGORITHM=INPLACE is not supported. Reason: Cannot change column type INPLACE. Try ALGORITHM=COPYCREATE OR REPLACE TABLE tab (
a INT,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION sql_mode='STRICT_TRANS_TABLES';
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab ADD PRIMARY KEY (a);
Query OK, 0 rows affected (0.021 sec)CREATE OR REPLACE TABLE tab (
a INT,
b VARCHAR(50),
c VARCHAR(50)
);
INSERT INTO tab VALUES (NULL, NULL, NULL);
SET SESSION sql_mode='STRICT_TRANS_TABLES';
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab ADD PRIMARY KEY (a);
ERROR 1265 (01000): Data truncated for column 'a' at row 1CREATE OR REPLACE TABLE tab (
a INT,
b VARCHAR(50),
c VARCHAR(50)
);
INSERT INTO tab VALUES (1, NULL, NULL);
INSERT INTO tab VALUES (1, NULL, NULL);
SET SESSION sql_mode='STRICT_TRANS_TABLES';
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab ADD PRIMARY KEY (a);
ERROR 1062 (23000): Duplicate entry '1' for key 'PRIMARY'CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab DROP PRIMARY KEY;
ERROR 1846 (0A000): ALGORITHM=INPLACE is not supported. Reason: Dropping a primary key is not allowed without also adding a new primary key. Try ALGORITHM=COPYCREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION sql_mode='STRICT_TRANS_TABLES';
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab DROP PRIMARY KEY, ADD PRIMARY KEY (b);
Query OK, 0 rows affected (0.020 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab ADD INDEX b_index (b);
Query OK, 0 rows affected (0.010 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
CREATE INDEX b_index ON tab (b);
Query OK, 0 rows affected (0.011 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab ADD FULLTEXT INDEX b_index (b);
Query OK, 0 rows affected (0.055 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
CREATE FULLTEXT INDEX b_index ON tab (b);
Query OK, 0 rows affected (0.041 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab ADD FULLTEXT INDEX b_index (b);
Query OK, 0 rows affected (0.043 sec)
ALTER TABLE tab ADD FULLTEXT INDEX c_index (c);
Query OK, 0 rows affected (0.017 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50),
d VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab ADD FULLTEXT INDEX b_index (b);
Query OK, 0 rows affected (0.041 sec)
ALTER TABLE tab ADD FULLTEXT INDEX c_index (c), ADD FULLTEXT INDEX d_index (d);
ERROR 1846 (0A000): ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPYCREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab ADD FULLTEXT INDEX b_index (b);
Query OK, 0 rows affected (0.040 sec)
ALTER TABLE tab ADD FULLTEXT INDEX c_index (c);
Query OK, 0 rows affected (0.015 sec)
ALTER TABLE tab FORCE;
ERROR 1846 (0A000): ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPYCREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c GEOMETRY NOT NULL
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab ADD SPATIAL INDEX c_index (c);
Query OK, 0 rows affected (0.006 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c GEOMETRY NOT NULL
);
SET SESSION alter_algorithm='INPLACE';
CREATE SPATIAL INDEX c_index ON tab (c);
Query OK, 0 rows affected (0.006 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50),
INDEX b_index (b)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab DROP INDEX b_index;CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50),
INDEX b_index (b)
);
SET SESSION alter_algorithm='INPLACE';
DROP INDEX b_index ON tab;CREATE OR REPLACE TABLE tab1 (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50),
d INT
);
CREATE OR REPLACE TABLE tab2 (
a INT PRIMARY KEY,
b VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab1 ADD FOREIGN KEY tab2_fk (d) REFERENCES tab2 (a);
ERROR 1846 (0A000): ALGORITHM=INPLACE is not supported. Reason: Adding foreign keys needs foreign_key_checks=OFF. Try ALGORITHM=COPYCREATE OR REPLACE TABLE tab1 (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50),
d INT
);
CREATE OR REPLACE TABLE tab2 (
a INT PRIMARY KEY,
b VARCHAR(50)
);
SET SESSION foreign_key_checks=OFF;
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab1 ADD FOREIGN KEY tab2_fk (d) REFERENCES tab2 (a);
Query OK, 0 rows affected (0.011 sec)CREATE OR REPLACE TABLE tab2 (
a INT PRIMARY KEY,
b VARCHAR(50)
);
CREATE OR REPLACE TABLE tab1 (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50),
d INT,
FOREIGN KEY tab2_fk (d) REFERENCES tab2 (a)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab1 DROP FOREIGN KEY tab2_fk;
Query OK, 0 rows affected (0.005 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab AUTO_INCREMENT=100;
Query OK, 0 rows affected (0.004 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
) ROW_FORMAT=DYNAMIC;
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab ROW_FORMAT=COMPRESSED;
Query OK, 0 rows affected (0.025 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
) ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE=4;
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab KEY_BLOCK_SIZE=2;
Query OK, 0 rows affected (0.021 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab PAGE_COMPRESSED=1;
Query OK, 0 rows affected (0.006 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
) PAGE_COMPRESSED=1;
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab PAGE_COMPRESSED=0;
Query OK, 0 rows affected (0.020 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
) PAGE_COMPRESSED=1
PAGE_COMPRESSION_LEVEL=5;
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab PAGE_COMPRESSION_LEVEL=4;
Query OK, 0 rows affected (0.006 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
) WITH SYSTEM VERSIONING;
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab DROP SYSTEM VERSIONING;CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50),
CONSTRAINT b_not_empty CHECK (b != '')
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab DROP CONSTRAINT b_not_empty;
Query OK, 0 rows affected (0.004 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab FORCE;
Query OK, 0 rows affected (0.022 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab ENGINE=InnoDB;
Query OK, 0 rows affected (0.022 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SHOW GLOBAL VARIABLES WHERE Variable_name IN('innodb_defragment', 'innodb_optimize_fulltext_only');
+-------------------------------+-------+
| Variable_name | Value |
+-------------------------------+-------+
| innodb_defragment | OFF |
| innodb_optimize_fulltext_only | OFF |
+-------------------------------+-------+
SET SESSION alter_algorithm='INPLACE';
OPTIMIZE TABLE tab;
+---------+----------+----------+-------------------------------------------------------------------+
| Table | Op | Msg_type | Msg_text |
+---------+----------+----------+-------------------------------------------------------------------+
| db1.tab | optimize | note | Table does not support optimize, doing recreate + analyze instead |
| db1.tab | optimize | status | OK |
+---------+----------+----------+-------------------------------------------------------------------+
2 rows in set (0.026 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET GLOBAL innodb_defragment=ON;
SHOW GLOBAL VARIABLES WHERE Variable_name IN('innodb_defragment', 'innodb_optimize_fulltext_only');
+-------------------------------+-------+
| Variable_name | Value |
+-------------------------------+-------+
| innodb_defragment | ON |
| innodb_optimize_fulltext_only | OFF |
+-------------------------------+-------+
SET SESSION alter_algorithm='INPLACE';
OPTIMIZE TABLE tab;
+---------+----------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+---------+----------+----------+----------+
| db1.tab | optimize | status | OK |
+---------+----------+----------+----------+
1 row in set (0.004 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
ALTER TABLE tab RENAME TO old_tab;
Query OK, 0 rows affected (0.011 sec)CREATE OR REPLACE TABLE tab (
a INT PRIMARY KEY,
b VARCHAR(50),
c VARCHAR(50)
);
SET SESSION alter_algorithm='INPLACE';
RENAME TABLE tab TO old_tab;Regardless of whether InnoDB strict mode is enabled, if a DML statement is executed that attempts to write a row that the table's InnoDB row format can't store, then InnoDB will raise an error with this message.
Here is an example of the problem:
The root cause is that InnoDB has a maximum row size that is roughly equivalent to half of the value of the innodb_page_size system variable. See InnoDB Row Formats Overview: Maximum Row Size for more information.
InnoDB's row formats work around this limit by storing certain kinds of variable-length columns on overflow pages. However, different row formats can store different types of data on overflow pages. Some row formats can store more data in overflow pages than others. For example, the DYNAMIC and COMPRESSED row formats can store the most data in overflow pages. To learn how the various InnoDB row formats use overflow pages, see the following pages:
InnoDB does not currently have an easy way to check all existing tables to determine which tables have this problem. See MDEV-20400 for more information.
One method to check a single existing table for this problem is to enable InnoDB strict mode, and then try to create a duplicate of the table with CREATE TABLE ... LIKE. If the table has this problem, then the operation will fail:
The following shell script will read through a MariaDB server to identify every table that has a row size definition that is too large for its row format and the server's page size. It runs on most common distributions of Linux.
To run the script, copy the code below to a shell-script named rowsize.sh, make it executable with the command chmod 755 ./rowsize.sh, and invoke it with the following parameters:
When the script runs, it displays the name of the temporary database it creates, so that if the script is interrupted before cleaning up, the database can be easily identified and removed manually.
As the script runs it will output one line reporting the database and tablename for each table it finds that has the oversize row problem. If it finds none, it will print the following message: "No tables with rows size too big found."
In either case, the script prints one final line to announce when it's done: ./rowsize.sh done.
There are several potential solutions available to solve this problem.
If the table is using either the REDUNDANT or the COMPACT row format, then one potential solution to this problem is to convert the table to use the DYNAMIC row format instead.
If your tables were originally created on an older version of MariaDB or MySQL, then your table may be using one of InnoDB's older row formats:
The DYNAMIC row format can store more data on overflow pages than these older row formats, so this row format may actually be able to store the table's data safely. See InnoDB DYNAMIC Row Format: Overflow Pages with the DYNAMIC Row Format for more information.
Therefore, a potential solution to the Row size too large error is to convert the table to use the DYNAMIC row format:
You can use the INNODB_SYS_TABLES table in the information_schema database to find all tables that use the REDUNDANT or the COMPACT row formats. This is helpful if you would like to convert all of your tables that you still use the older row formats to the DYNAMIC row format. For example, the following query can find those tables, while excluding InnoDB's internal system tables:
In and later, the DYNAMIC row format is the default row format. If your tables were originally created on one of these newer versions, then they may already be using this row format. In that case, you may need to try the next solution.
If the table is already using the DYNAMIC row format, then another potential solution to this problem is to change the table schema, so that the row format can store more columns on overflow pages.
In order for InnoDB to store some variable-length columns on overflow pages, the length of those columns may need to be increased.
Therefore, a counter-intuitive solution to the Row size too large error in a lot of cases is actually to increase the length of some variable-length columns, so that InnoDB's row format can store them on overflow pages.
Some possible ways to change the table schema are listed below.
For BLOB and TEXT columns, the DYNAMIC row format can store these columns on overflow pages. See InnoDB DYNAMIC Row Format: Overflow Pages with the DYNAMIC Row Format for more information.
Therefore, a potential solution to the Row size too large error is to convert some columns to the BLOB or TEXT data types.
For VARBINARY columns, the DYNAMIC row format can only store these columns on overflow pages if the maximum length of the column is 256 bytes or longer. See InnoDB DYNAMIC Row Format: Overflow Pages with the DYNAMIC Row Format for more information.
Therefore, a potential solution to the Row size too large error is to ensure that all VARBINARY columns are at least as long as varbinary(256).
For VARCHAR columns, the DYNAMIC row format can only store these columns on overflow pages if the maximum length of the column is 256 bytes or longer. See InnoDB DYNAMIC Row Format: Overflow Pages with the DYNAMIC Row Format for more information.
The original table schema shown earlier on this page causes the Row size too large error, because all of the table's VARCHAR columns are smaller than 256 bytes, which means that they have to be stored on the row's main data page.
Therefore, a potential solution to the Row size too large error is to ensure that all VARCHAR columns are at least as long as 256 bytes. The number of characters required to reach the 256 byte limit depends on the character set used by the column.
For example, when using InnoDB's DYNAMIC row format and a default character set of latin1 (which requires up to 1 byte per character), the 256 byte limit means that a VARCHAR column will only be stored on overflow pages if it is at least as large as a varchar(256):
And when using InnoDB's DYNAMIC row format and a default character set of utf8 (which requires up to 3 bytes per character), the 256 byte limit means that a VARCHAR column will only be stored on overflow pages if it is at least as large as a varchar(86):
And when using InnoDB's DYNAMIC row format and a default character set of utf8mb4 (which requires up to 4 bytes per character), the 256 byte limit means that a VARCHAR column will only be stored on overflow pages if it is at least as large as a varchar(64):
There are a few ways to work around this problem.
If you would like a solution for the problem instead of just working around it, then see the solutions mentioned in the previous section.
A safe workaround is to refactor the single wide table, so that its columns are spread among multiple tables.
This workaround can even work if your table is so wide that the previous solutions have failed to solve them problem for your table.
A safe workaround is to refactor some of the columns into a JSON document.
The JSON document can be queried and manipulated using MariaDB's JSON functions.
The JSON document can be stored in a column that uses one of the following data types:
MEDIUMTEXT: The maximum size of a MEDIUMTEXT column is 16 MB.
This workaround can even work if your table is so wide that the previous solutions have failed to solve them problem for your table.
An unsafe workaround is to disable InnoDB strict mode. InnoDB strict mode can be disabled by setting the innodb_strict_mode system variable to OFF.
For example, even though the following table schema is too large for most InnoDB row formats to store, it can still be created when InnoDB strict mode is disabled:
But as mentioned above, if InnoDB strict mode is disabled and if a DDL statement is executed, then InnoDB will still raise a warning with this message. The SHOW WARNINGS statement can be used to view the warning:
As mentioned above, even though InnoDB is allowing the table to be created, there is still an opportunity for errors. Regardless of whether InnoDB strict mode is enabled, if a DML statement is executed that attempts to write a row that the table's InnoDB row format can't store, then InnoDB will raise an error with this message. This creates a somewhat unsafe situation, because it means that the application has the chance to encounter an additional error while executing DML.
This page is licensed: CC BY-SA / Gnu FDL
ERROR 1118 (42000): Row size too large (> 8126). Changing some columns to
TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored
inline.[Warning] InnoDB: Cannot add field col in table db1.tab because after adding it,
the row size is 8478 which is greater than maximum allowed size (8126) for a
record on index leaf page.SET GLOBAL innodb_default_row_format='dynamic';
SET SESSION innodb_strict_mode=ON;
CREATE OR REPLACE TABLE tab (
col1 VARCHAR(40) NOT NULL,
col2 VARCHAR(40) NOT NULL,
col3 VARCHAR(40) NOT NULL,
col4 VARCHAR(40) NOT NULL,
col5 VARCHAR(40) NOT NULL,
col6 VARCHAR(40) NOT NULL,
col7 VARCHAR(40) NOT NULL,
col8 VARCHAR(40) NOT NULL,
col9 VARCHAR(40) NOT NULL,
col10 VARCHAR(40) NOT NULL,
col11 VARCHAR(40) NOT NULL,
col12 VARCHAR(40) NOT NULL,
col13 VARCHAR(40) NOT NULL,
col14 VARCHAR(40) NOT NULL,
col15 VARCHAR(40) NOT NULL,
col16 VARCHAR(40) NOT NULL,
col17 VARCHAR(40) NOT NULL,
col18 VARCHAR(40) NOT NULL,
col19 VARCHAR(40) NOT NULL,
col20 VARCHAR(40) NOT NULL,
col21 VARCHAR(40) NOT NULL,
col22 VARCHAR(40) NOT NULL,
col23 VARCHAR(40) NOT NULL,
col24 VARCHAR(40) NOT NULL,
col25 VARCHAR(40) NOT NULL,
col26 VARCHAR(40) NOT NULL,
col27 VARCHAR(40) NOT NULL,
col28 VARCHAR(40) NOT NULL,
col29 VARCHAR(40) NOT NULL,
col30 VARCHAR(40) NOT NULL,
col31 VARCHAR(40) NOT NULL,
col32 VARCHAR(40) NOT NULL,
col33 VARCHAR(40) NOT NULL,
col34 VARCHAR(40) NOT NULL,
col35 VARCHAR(40) NOT NULL,
col36 VARCHAR(40) NOT NULL,
col37 VARCHAR(40) NOT NULL,
col38 VARCHAR(40) NOT NULL,
col39 VARCHAR(40) NOT NULL,
col40 VARCHAR(40) NOT NULL,
col41 VARCHAR(40) NOT NULL,
col42 VARCHAR(40) NOT NULL,
col43 VARCHAR(40) NOT NULL,
col44 VARCHAR(40) NOT NULL,
col45 VARCHAR(40) NOT NULL,
col46 VARCHAR(40) NOT NULL,
col47 VARCHAR(40) NOT NULL,
col48 VARCHAR(40) NOT NULL,
col49 VARCHAR(40) NOT NULL,
col50 VARCHAR(40) NOT NULL,
col51 VARCHAR(40) NOT NULL,
col52 VARCHAR(40) NOT NULL,
col53 VARCHAR(40) NOT NULL,
col54 VARCHAR(40) NOT NULL,
col55 VARCHAR(40) NOT NULL,
col56 VARCHAR(40) NOT NULL,
col57 VARCHAR(40) NOT NULL,
col58 VARCHAR(40) NOT NULL,
col59 VARCHAR(40) NOT NULL,
col60 VARCHAR(40) NOT NULL,
col61 VARCHAR(40) NOT NULL,
col62 VARCHAR(40) NOT NULL,
col63 VARCHAR(40) NOT NULL,
col64 VARCHAR(40) NOT NULL,
col65 VARCHAR(40) NOT NULL,
col66 VARCHAR(40) NOT NULL,
col67 VARCHAR(40) NOT NULL,
col68 VARCHAR(40) NOT NULL,
col69 VARCHAR(40) NOT NULL,
col70 VARCHAR(40) NOT NULL,
col71 VARCHAR(40) NOT NULL,
col72 VARCHAR(40) NOT NULL,
col73 VARCHAR(40) NOT NULL,
col74 VARCHAR(40) NOT NULL,
col75 VARCHAR(40) NOT NULL,
col76 VARCHAR(40) NOT NULL,
col77 VARCHAR(40) NOT NULL,
col78 VARCHAR(40) NOT NULL,
col79 VARCHAR(40) NOT NULL,
col80 VARCHAR(40) NOT NULL,
col81 VARCHAR(40) NOT NULL,
col82 VARCHAR(40) NOT NULL,
col83 VARCHAR(40) NOT NULL,
col84 VARCHAR(40) NOT NULL,
col85 VARCHAR(40) NOT NULL,
col86 VARCHAR(40) NOT NULL,
col87 VARCHAR(40) NOT NULL,
col88 VARCHAR(40) NOT NULL,
col89 VARCHAR(40) NOT NULL,
col90 VARCHAR(40) NOT NULL,
col91 VARCHAR(40) NOT NULL,
col92 VARCHAR(40) NOT NULL,
col93 VARCHAR(40) NOT NULL,
col94 VARCHAR(40) NOT NULL,
col95 VARCHAR(40) NOT NULL,
col96 VARCHAR(40) NOT NULL,
col97 VARCHAR(40) NOT NULL,
col98 VARCHAR(40) NOT NULL,
col99 VARCHAR(40) NOT NULL,
col100 VARCHAR(40) NOT NULL,
col101 VARCHAR(40) NOT NULL,
col102 VARCHAR(40) NOT NULL,
col103 VARCHAR(40) NOT NULL,
col104 VARCHAR(40) NOT NULL,
col105 VARCHAR(40) NOT NULL,
col106 VARCHAR(40) NOT NULL,
col107 VARCHAR(40) NOT NULL,
col108 VARCHAR(40) NOT NULL,
col109 VARCHAR(40) NOT NULL,
col110 VARCHAR(40) NOT NULL,
col111 VARCHAR(40) NOT NULL,
col112 VARCHAR(40) NOT NULL,
col113 VARCHAR(40) NOT NULL,
col114 VARCHAR(40) NOT NULL,
col115 VARCHAR(40) NOT NULL,
col116 VARCHAR(40) NOT NULL,
col117 VARCHAR(40) NOT NULL,
col118 VARCHAR(40) NOT NULL,
col119 VARCHAR(40) NOT NULL,
col120 VARCHAR(40) NOT NULL,
col121 VARCHAR(40) NOT NULL,
col122 VARCHAR(40) NOT NULL,
col123 VARCHAR(40) NOT NULL,
col124 VARCHAR(40) NOT NULL,
col125 VARCHAR(40) NOT NULL,
col126 VARCHAR(40) NOT NULL,
col127 VARCHAR(40) NOT NULL,
col128 VARCHAR(40) NOT NULL,
col129 VARCHAR(40) NOT NULL,
col130 VARCHAR(40) NOT NULL,
col131 VARCHAR(40) NOT NULL,
col132 VARCHAR(40) NOT NULL,
col133 VARCHAR(40) NOT NULL,
col134 VARCHAR(40) NOT NULL,
col135 VARCHAR(40) NOT NULL,
col136 VARCHAR(40) NOT NULL,
col137 VARCHAR(40) NOT NULL,
col138 VARCHAR(40) NOT NULL,
col139 VARCHAR(40) NOT NULL,
col140 VARCHAR(40) NOT NULL,
col141 VARCHAR(40) NOT NULL,
col142 VARCHAR(40) NOT NULL,
col143 VARCHAR(40) NOT NULL,
col144 VARCHAR(40) NOT NULL,
col145 VARCHAR(40) NOT NULL,
col146 VARCHAR(40) NOT NULL,
col147 VARCHAR(40) NOT NULL,
col148 VARCHAR(40) NOT NULL,
col149 VARCHAR(40) NOT NULL,
col150 VARCHAR(40) NOT NULL,
col151 VARCHAR(40) NOT NULL,
col152 VARCHAR(40) NOT NULL,
col153 VARCHAR(40) NOT NULL,
col154 VARCHAR(40) NOT NULL,
col155 VARCHAR(40) NOT NULL,
col156 VARCHAR(40) NOT NULL,
col157 VARCHAR(40) NOT NULL,
col158 VARCHAR(40) NOT NULL,
col159 VARCHAR(40) NOT NULL,
col160 VARCHAR(40) NOT NULL,
col161 VARCHAR(40) NOT NULL,
col162 VARCHAR(40) NOT NULL,
col163 VARCHAR(40) NOT NULL,
col164 VARCHAR(40) NOT NULL,
col165 VARCHAR(40) NOT NULL,
col166 VARCHAR(40) NOT NULL,
col167 VARCHAR(40) NOT NULL,
col168 VARCHAR(40) NOT NULL,
col169 VARCHAR(40) NOT NULL,
col170 VARCHAR(40) NOT NULL,
col171 VARCHAR(40) NOT NULL,
col172 VARCHAR(40) NOT NULL,
col173 VARCHAR(40) NOT NULL,
col174 VARCHAR(40) NOT NULL,
col175 VARCHAR(40) NOT NULL,
col176 VARCHAR(40) NOT NULL,
col177 VARCHAR(40) NOT NULL,
col178 VARCHAR(40) NOT NULL,
col179 VARCHAR(40) NOT NULL,
col180 VARCHAR(40) NOT NULL,
col181 VARCHAR(40) NOT NULL,
col182 VARCHAR(40) NOT NULL,
col183 VARCHAR(40) NOT NULL,
col184 VARCHAR(40) NOT NULL,
col185 VARCHAR(40) NOT NULL,
col186 VARCHAR(40) NOT NULL,
col187 VARCHAR(40) NOT NULL,
col188 VARCHAR(40) NOT NULL,
col189 VARCHAR(40) NOT NULL,
col190 VARCHAR(40) NOT NULL,
col191 VARCHAR(40) NOT NULL,
col192 VARCHAR(40) NOT NULL,
col193 VARCHAR(40) NOT NULL,
col194 VARCHAR(40) NOT NULL,
col195 VARCHAR(40) NOT NULL,
col196 VARCHAR(40) NOT NULL,
col197 VARCHAR(40) NOT NULL,
col198 VARCHAR(40) NOT NULL,
PRIMARY KEY (col1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
ERROR 1118 (42000): Row size too large (> 8126). Changing some columns to
TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.SET SESSION innodb_strict_mode=ON;
CREATE TABLE tab_dup LIKE tab;
ERROR 1118 (42000): Row size too large (> 8126). Changing some columns to
TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline../rowsize.sh host user password#!/bin/bash
[ -z "$3" ] && echo "Usage: $0 host user password" >&2 && exit 1
dt="tmp_$RANDOM$RANDOM"
mysql -h $1 -u $2 -p$3 -ABNe "create database $dt;"
[ $? -ne 0 ] && echo "Error: $0 terminating" >&2 exit 1
echo
echo "Created temporary database ${dt} on host $1"
echo
c=0
for d in $(mysql -h $1 -u $2 -p$3 -ABNe "show databases;" | egrep -iv "information_schema|mysql|performance_schema|$dt")
do
for t in $(mysql -h $1 -u $2 -p$3 -ABNe "show tables;" $d)
do
tc=$(mysql -h $1 -u $2 -p$3 -ABNe "show create table $t\\G" $d | egrep -iv "^\*|^$t")
echo $tc | grep -iq "ROW_FORMAT"
if [ $? -ne 0 ]
then
tf=$(mysql -h $1 -u $2 -p$3 -ABNe "select row_format from information_schema.innodb_sys_tables where name = '${d}/${t}';")
tc="$tc ROW_FORMAT=$tf"
fi
ef="/tmp/e$RANDOM$RANDOM"
mysql -h $1 -u $2 -p$3 -ABNe "set innodb_strict_mode=1; set foreign_key_checks=0; ${tc};" $dt >/dev/null 2>$ef
[ $? -ne 0 ] && cat $ef | grep -q "Row size too large" && echo "${d}.${t}" && let c++ || mysql -h $1 -u $2 -p$3 -ABNe "drop table if exists ${t};" $dt
rm -f $ef
done
done
mysql -h $1 -u $2 -p$3 -ABNe "set innodb_strict_mode=1; drop database $dt;"
[ $c -eq 0 ] && echo "No tables with rows size too large found." || echo && echo "$c tables found with row size too large."
echo
echo "$0 done."ALTER TABLE tab ROW_FORMAT=DYNAMIC;SELECT NAME, ROW_FORMAT
FROM information_schema.INNODB_SYS_TABLES
WHERE ROW_FORMAT IN('Redundant', 'Compact')
AND NAME NOT IN('SYS_DATAFILES', 'SYS_FOREIGN', 'SYS_FOREIGN_COLS', 'SYS_TABLESPACES', 'SYS_VIRTUAL', 'SYS_ZIP_DICT', 'SYS_ZIP_DICT_COLS');SET GLOBAL innodb_default_row_format='dynamic';
SET SESSION innodb_strict_mode=ON;
CREATE OR REPLACE TABLE tab (
col1 VARCHAR(256) NOT NULL,
col2 VARCHAR(256) NOT NULL,
col3 VARCHAR(256) NOT NULL,
col4 VARCHAR(256) NOT NULL,
col5 VARCHAR(256) NOT NULL,
col6 VARCHAR(256) NOT NULL,
col7 VARCHAR(256) NOT NULL,
col8 VARCHAR(256) NOT NULL,
col9 VARCHAR(256) NOT NULL,
col10 VARCHAR(256) NOT NULL,
col11 VARCHAR(256) NOT NULL,
col12 VARCHAR(256) NOT NULL,
col13 VARCHAR(256) NOT NULL,
col14 VARCHAR(256) NOT NULL,
col15 VARCHAR(256) NOT NULL,
col16 VARCHAR(256) NOT NULL,
col17 VARCHAR(256) NOT NULL,
col18 VARCHAR(256) NOT NULL,
col19 VARCHAR(256) NOT NULL,
col20 VARCHAR(256) NOT NULL,
col21 VARCHAR(256) NOT NULL,
col22 VARCHAR(256) NOT NULL,
col23 VARCHAR(256) NOT NULL,
col24 VARCHAR(256) NOT NULL,
col25 VARCHAR(256) NOT NULL,
col26 VARCHAR(256) NOT NULL,
col27 VARCHAR(256) NOT NULL,
col28 VARCHAR(256) NOT NULL,
col29 VARCHAR(256) NOT NULL,
col30 VARCHAR(256) NOT NULL,
col31 VARCHAR(256) NOT NULL,
col32 VARCHAR(256) NOT NULL,
col33 VARCHAR(256) NOT NULL,
col34 VARCHAR(256) NOT NULL,
col35 VARCHAR(256) NOT NULL,
col36 VARCHAR(256) NOT NULL,
col37 VARCHAR(256) NOT NULL,
col38 VARCHAR(256) NOT NULL,
col39 VARCHAR(256) NOT NULL,
col40 VARCHAR(256) NOT NULL,
col41 VARCHAR(256) NOT NULL,
col42 VARCHAR(256) NOT NULL,
col43 VARCHAR(256) NOT NULL,
col44 VARCHAR(256) NOT NULL,
col45 VARCHAR(256) NOT NULL,
col46 VARCHAR(256) NOT NULL,
col47 VARCHAR(256) NOT NULL,
col48 VARCHAR(256) NOT NULL,
col49 VARCHAR(256) NOT NULL,
col50 VARCHAR(256) NOT NULL,
col51 VARCHAR(256) NOT NULL,
col52 VARCHAR(256) NOT NULL,
col53 VARCHAR(256) NOT NULL,
col54 VARCHAR(256) NOT NULL,
col55 VARCHAR(256) NOT NULL,
col56 VARCHAR(256) NOT NULL,
col57 VARCHAR(256) NOT NULL,
col58 VARCHAR(256) NOT NULL,
col59 VARCHAR(256) NOT NULL,
col60 VARCHAR(256) NOT NULL,
col61 VARCHAR(256) NOT NULL,
col62 VARCHAR(256) NOT NULL,
col63 VARCHAR(256) NOT NULL,
col64 VARCHAR(256) NOT NULL,
col65 VARCHAR(256) NOT NULL,
col66 VARCHAR(256) NOT NULL,
col67 VARCHAR(256) NOT NULL,
col68 VARCHAR(256) NOT NULL,
col69 VARCHAR(256) NOT NULL,
col70 VARCHAR(256) NOT NULL,
col71 VARCHAR(256) NOT NULL,
col72 VARCHAR(256) NOT NULL,
col73 VARCHAR(256) NOT NULL,
col74 VARCHAR(256) NOT NULL,
col75 VARCHAR(256) NOT NULL,
col76 VARCHAR(256) NOT NULL,
col77 VARCHAR(256) NOT NULL,
col78 VARCHAR(256) NOT NULL,
col79 VARCHAR(256) NOT NULL,
col80 VARCHAR(256) NOT NULL,
col81 VARCHAR(256) NOT NULL,
col82 VARCHAR(256) NOT NULL,
col83 VARCHAR(256) NOT NULL,
col84 VARCHAR(256) NOT NULL,
col85 VARCHAR(256) NOT NULL,
col86 VARCHAR(256) NOT NULL,
col87 VARCHAR(256) NOT NULL,
col88 VARCHAR(256) NOT NULL,
col89 VARCHAR(256) NOT NULL,
col90 VARCHAR(256) NOT NULL,
col91 VARCHAR(256) NOT NULL,
col92 VARCHAR(256) NOT NULL,
col93 VARCHAR(256) NOT NULL,
col94 VARCHAR(256) NOT NULL,
col95 VARCHAR(256) NOT NULL,
col96 VARCHAR(256) NOT NULL,
col97 VARCHAR(256) NOT NULL,
col98 VARCHAR(256) NOT NULL,
col99 VARCHAR(256) NOT NULL,
col100 VARCHAR(256) NOT NULL,
col101 VARCHAR(256) NOT NULL,
col102 VARCHAR(256) NOT NULL,
col103 VARCHAR(256) NOT NULL,
col104 VARCHAR(256) NOT NULL,
col105 VARCHAR(256) NOT NULL,
col106 VARCHAR(256) NOT NULL,
col107 VARCHAR(256) NOT NULL,
col108 VARCHAR(256) NOT NULL,
col109 VARCHAR(256) NOT NULL,
col110 VARCHAR(256) NOT NULL,
col111 VARCHAR(256) NOT NULL,
col112 VARCHAR(256) NOT NULL,
col113 VARCHAR(256) NOT NULL,
col114 VARCHAR(256) NOT NULL,
col115 VARCHAR(256) NOT NULL,
col116 VARCHAR(256) NOT NULL,
col117 VARCHAR(256) NOT NULL,
col118 VARCHAR(256) NOT NULL,
col119 VARCHAR(256) NOT NULL,
col120 VARCHAR(256) NOT NULL,
col121 VARCHAR(256) NOT NULL,
col122 VARCHAR(256) NOT NULL,
col123 VARCHAR(256) NOT NULL,
col124 VARCHAR(256) NOT NULL,
col125 VARCHAR(256) NOT NULL,
col126 VARCHAR(256) NOT NULL,
col127 VARCHAR(256) NOT NULL,
col128 VARCHAR(256) NOT NULL,
col129 VARCHAR(256) NOT NULL,
col130 VARCHAR(256) NOT NULL,
col131 VARCHAR(256) NOT NULL,
col132 VARCHAR(256) NOT NULL,
col133 VARCHAR(256) NOT NULL,
col134 VARCHAR(256) NOT NULL,
col135 VARCHAR(256) NOT NULL,
col136 VARCHAR(256) NOT NULL,
col137 VARCHAR(256) NOT NULL,
col138 VARCHAR(256) NOT NULL,
col139 VARCHAR(256) NOT NULL,
col140 VARCHAR(256) NOT NULL,
col141 VARCHAR(256) NOT NULL,
col142 VARCHAR(256) NOT NULL,
col143 VARCHAR(256) NOT NULL,
col144 VARCHAR(256) NOT NULL,
col145 VARCHAR(256) NOT NULL,
col146 VARCHAR(256) NOT NULL,
col147 VARCHAR(256) NOT NULL,
col148 VARCHAR(256) NOT NULL,
col149 VARCHAR(256) NOT NULL,
col150 VARCHAR(256) NOT NULL,
col151 VARCHAR(256) NOT NULL,
col152 VARCHAR(256) NOT NULL,
col153 VARCHAR(256) NOT NULL,
col154 VARCHAR(256) NOT NULL,
col155 VARCHAR(256) NOT NULL,
col156 VARCHAR(256) NOT NULL,
col157 VARCHAR(256) NOT NULL,
col158 VARCHAR(256) NOT NULL,
col159 VARCHAR(256) NOT NULL,
col160 VARCHAR(256) NOT NULL,
col161 VARCHAR(256) NOT NULL,
col162 VARCHAR(256) NOT NULL,
col163 VARCHAR(256) NOT NULL,
col164 VARCHAR(256) NOT NULL,
col165 VARCHAR(256) NOT NULL,
col166 VARCHAR(256) NOT NULL,
col167 VARCHAR(256) NOT NULL,
col168 VARCHAR(256) NOT NULL,
col169 VARCHAR(256) NOT NULL,
col170 VARCHAR(256) NOT NULL,
col171 VARCHAR(256) NOT NULL,
col172 VARCHAR(256) NOT NULL,
col173 VARCHAR(256) NOT NULL,
col174 VARCHAR(256) NOT NULL,
col175 VARCHAR(256) NOT NULL,
col176 VARCHAR(256) NOT NULL,
col177 VARCHAR(256) NOT NULL,
col178 VARCHAR(256) NOT NULL,
col179 VARCHAR(256) NOT NULL,
col180 VARCHAR(256) NOT NULL,
col181 VARCHAR(256) NOT NULL,
col182 VARCHAR(256) NOT NULL,
col183 VARCHAR(256) NOT NULL,
col184 VARCHAR(256) NOT NULL,
col185 VARCHAR(256) NOT NULL,
col186 VARCHAR(256) NOT NULL,
col187 VARCHAR(256) NOT NULL,
col188 VARCHAR(256) NOT NULL,
col189 VARCHAR(256) NOT NULL,
col190 VARCHAR(256) NOT NULL,
col191 VARCHAR(256) NOT NULL,
col192 VARCHAR(256) NOT NULL,
col193 VARCHAR(256) NOT NULL,
col194 VARCHAR(256) NOT NULL,
col195 VARCHAR(256) NOT NULL,
col196 VARCHAR(256) NOT NULL,
col197 VARCHAR(256) NOT NULL,
col198 VARCHAR(256) NOT NULL,
PRIMARY KEY (col1)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;SET GLOBAL innodb_default_row_format='dynamic';
SET SESSION innodb_strict_mode=ON;
CREATE OR REPLACE TABLE tab (
col1 VARCHAR(86) NOT NULL,
col2 VARCHAR(86) NOT NULL,
col3 VARCHAR(86) NOT NULL,
col4 VARCHAR(86) NOT NULL,
col5 VARCHAR(86) NOT NULL,
col6 VARCHAR(86) NOT NULL,
col7 VARCHAR(86) NOT NULL,
col8 VARCHAR(86) NOT NULL,
col9 VARCHAR(86) NOT NULL,
col10 VARCHAR(86) NOT NULL,
col11 VARCHAR(86) NOT NULL,
col12 VARCHAR(86) NOT NULL,
col13 VARCHAR(86) NOT NULL,
col14 VARCHAR(86) NOT NULL,
col15 VARCHAR(86) NOT NULL,
col16 VARCHAR(86) NOT NULL,
col17 VARCHAR(86) NOT NULL,
col18 VARCHAR(86) NOT NULL,
col19 VARCHAR(86) NOT NULL,
col20 VARCHAR(86) NOT NULL,
col21 VARCHAR(86) NOT NULL,
col22 VARCHAR(86) NOT NULL,
col23 VARCHAR(86) NOT NULL,
col24 VARCHAR(86) NOT NULL,
col25 VARCHAR(86) NOT NULL,
col26 VARCHAR(86) NOT NULL,
col27 VARCHAR(86) NOT NULL,
col28 VARCHAR(86) NOT NULL,
col29 VARCHAR(86) NOT NULL,
col30 VARCHAR(86) NOT NULL,
col31 VARCHAR(86) NOT NULL,
col32 VARCHAR(86) NOT NULL,
col33 VARCHAR(86) NOT NULL,
col34 VARCHAR(86) NOT NULL,
col35 VARCHAR(86) NOT NULL,
col36 VARCHAR(86) NOT NULL,
col37 VARCHAR(86) NOT NULL,
col38 VARCHAR(86) NOT NULL,
col39 VARCHAR(86) NOT NULL,
col40 VARCHAR(86) NOT NULL,
col41 VARCHAR(86) NOT NULL,
col42 VARCHAR(86) NOT NULL,
col43 VARCHAR(86) NOT NULL,
col44 VARCHAR(86) NOT NULL,
col45 VARCHAR(86) NOT NULL,
col46 VARCHAR(86) NOT NULL,
col47 VARCHAR(86) NOT NULL,
col48 VARCHAR(86) NOT NULL,
col49 VARCHAR(86) NOT NULL,
col50 VARCHAR(86) NOT NULL,
col51 VARCHAR(86) NOT NULL,
col52 VARCHAR(86) NOT NULL,
col53 VARCHAR(86) NOT NULL,
col54 VARCHAR(86) NOT NULL,
col55 VARCHAR(86) NOT NULL,
col56 VARCHAR(86) NOT NULL,
col57 VARCHAR(86) NOT NULL,
col58 VARCHAR(86) NOT NULL,
col59 VARCHAR(86) NOT NULL,
col60 VARCHAR(86) NOT NULL,
col61 VARCHAR(86) NOT NULL,
col62 VARCHAR(86) NOT NULL,
col63 VARCHAR(86) NOT NULL,
col64 VARCHAR(86) NOT NULL,
col65 VARCHAR(86) NOT NULL,
col66 VARCHAR(86) NOT NULL,
col67 VARCHAR(86) NOT NULL,
col68 VARCHAR(86) NOT NULL,
col69 VARCHAR(86) NOT NULL,
col70 VARCHAR(86) NOT NULL,
col71 VARCHAR(86) NOT NULL,
col72 VARCHAR(86) NOT NULL,
col73 VARCHAR(86) NOT NULL,
col74 VARCHAR(86) NOT NULL,
col75 VARCHAR(86) NOT NULL,
col76 VARCHAR(86) NOT NULL,
col77 VARCHAR(86) NOT NULL,
col78 VARCHAR(86) NOT NULL,
col79 VARCHAR(86) NOT NULL,
col80 VARCHAR(86) NOT NULL,
col81 VARCHAR(86) NOT NULL,
col82 VARCHAR(86) NOT NULL,
col83 VARCHAR(86) NOT NULL,
col84 VARCHAR(86) NOT NULL,
col85 VARCHAR(86) NOT NULL,
col86 VARCHAR(86) NOT NULL,
col87 VARCHAR(86) NOT NULL,
col88 VARCHAR(86) NOT NULL,
col89 VARCHAR(86) NOT NULL,
col90 VARCHAR(86) NOT NULL,
col91 VARCHAR(86) NOT NULL,
col92 VARCHAR(86) NOT NULL,
col93 VARCHAR(86) NOT NULL,
col94 VARCHAR(86) NOT NULL,
col95 VARCHAR(86) NOT NULL,
col96 VARCHAR(86) NOT NULL,
col97 VARCHAR(86) NOT NULL,
col98 VARCHAR(86) NOT NULL,
col99 VARCHAR(86) NOT NULL,
col100 VARCHAR(86) NOT NULL,
col101 VARCHAR(86) NOT NULL,
col102 VARCHAR(86) NOT NULL,
col103 VARCHAR(86) NOT NULL,
col104 VARCHAR(86) NOT NULL,
col105 VARCHAR(86) NOT NULL,
col106 VARCHAR(86) NOT NULL,
col107 VARCHAR(86) NOT NULL,
col108 VARCHAR(86) NOT NULL,
col109 VARCHAR(86) NOT NULL,
col110 VARCHAR(86) NOT NULL,
col111 VARCHAR(86) NOT NULL,
col112 VARCHAR(86) NOT NULL,
col113 VARCHAR(86) NOT NULL,
col114 VARCHAR(86) NOT NULL,
col115 VARCHAR(86) NOT NULL,
col116 VARCHAR(86) NOT NULL,
col117 VARCHAR(86) NOT NULL,
col118 VARCHAR(86) NOT NULL,
col119 VARCHAR(86) NOT NULL,
col120 VARCHAR(86) NOT NULL,
col121 VARCHAR(86) NOT NULL,
col122 VARCHAR(86) NOT NULL,
col123 VARCHAR(86) NOT NULL,
col124 VARCHAR(86) NOT NULL,
col125 VARCHAR(86) NOT NULL,
col126 VARCHAR(86) NOT NULL,
col127 VARCHAR(86) NOT NULL,
col128 VARCHAR(86) NOT NULL,
col129 VARCHAR(86) NOT NULL,
col130 VARCHAR(86) NOT NULL,
col131 VARCHAR(86) NOT NULL,
col132 VARCHAR(86) NOT NULL,
col133 VARCHAR(86) NOT NULL,
col134 VARCHAR(86) NOT NULL,
col135 VARCHAR(86) NOT NULL,
col136 VARCHAR(86) NOT NULL,
col137 VARCHAR(86) NOT NULL,
col138 VARCHAR(86) NOT NULL,
col139 VARCHAR(86) NOT NULL,
col140 VARCHAR(86) NOT NULL,
col141 VARCHAR(86) NOT NULL,
col142 VARCHAR(86) NOT NULL,
col143 VARCHAR(86) NOT NULL,
col144 VARCHAR(86) NOT NULL,
col145 VARCHAR(86) NOT NULL,
col146 VARCHAR(86) NOT NULL,
col147 VARCHAR(86) NOT NULL,
col148 VARCHAR(86) NOT NULL,
col149 VARCHAR(86) NOT NULL,
col150 VARCHAR(86) NOT NULL,
col151 VARCHAR(86) NOT NULL,
col152 VARCHAR(86) NOT NULL,
col153 VARCHAR(86) NOT NULL,
col154 VARCHAR(86) NOT NULL,
col155 VARCHAR(86) NOT NULL,
col156 VARCHAR(86) NOT NULL,
col157 VARCHAR(86) NOT NULL,
col158 VARCHAR(86) NOT NULL,
col159 VARCHAR(86) NOT NULL,
col160 VARCHAR(86) NOT NULL,
col161 VARCHAR(86) NOT NULL,
col162 VARCHAR(86) NOT NULL,
col163 VARCHAR(86) NOT NULL,
col164 VARCHAR(86) NOT NULL,
col165 VARCHAR(86) NOT NULL,
col166 VARCHAR(86) NOT NULL,
col167 VARCHAR(86) NOT NULL,
col168 VARCHAR(86) NOT NULL,
col169 VARCHAR(86) NOT NULL,
col170 VARCHAR(86) NOT NULL,
col171 VARCHAR(86) NOT NULL,
col172 VARCHAR(86) NOT NULL,
col173 VARCHAR(86) NOT NULL,
col174 VARCHAR(86) NOT NULL,
col175 VARCHAR(86) NOT NULL,
col176 VARCHAR(86) NOT NULL,
col177 VARCHAR(86) NOT NULL,
col178 VARCHAR(86) NOT NULL,
col179 VARCHAR(86) NOT NULL,
col180 VARCHAR(86) NOT NULL,
col181 VARCHAR(86) NOT NULL,
col182 VARCHAR(86) NOT NULL,
col183 VARCHAR(86) NOT NULL,
col184 VARCHAR(86) NOT NULL,
col185 VARCHAR(86) NOT NULL,
col186 VARCHAR(86) NOT NULL,
col187 VARCHAR(86) NOT NULL,
col188 VARCHAR(86) NOT NULL,
col189 VARCHAR(86) NOT NULL,
col190 VARCHAR(86) NOT NULL,
col191 VARCHAR(86) NOT NULL,
col192 VARCHAR(86) NOT NULL,
col193 VARCHAR(86) NOT NULL,
col194 VARCHAR(86) NOT NULL,
col195 VARCHAR(86) NOT NULL,
col196 VARCHAR(86) NOT NULL,
col197 VARCHAR(86) NOT NULL,
col198 VARCHAR(86) NOT NULL,
PRIMARY KEY (col1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;SET GLOBAL innodb_default_row_format='dynamic';
SET SESSION innodb_strict_mode=ON;
CREATE OR REPLACE TABLE tab (
col1 VARCHAR(64) NOT NULL,
col2 VARCHAR(64) NOT NULL,
col3 VARCHAR(64) NOT NULL,
col4 VARCHAR(64) NOT NULL,
col5 VARCHAR(64) NOT NULL,
col6 VARCHAR(64) NOT NULL,
col7 VARCHAR(64) NOT NULL,
col8 VARCHAR(64) NOT NULL,
col9 VARCHAR(64) NOT NULL,
col10 VARCHAR(64) NOT NULL,
col11 VARCHAR(64) NOT NULL,
col12 VARCHAR(64) NOT NULL,
col13 VARCHAR(64) NOT NULL,
col14 VARCHAR(64) NOT NULL,
col15 VARCHAR(64) NOT NULL,
col16 VARCHAR(64) NOT NULL,
col17 VARCHAR(64) NOT NULL,
col18 VARCHAR(64) NOT NULL,
col19 VARCHAR(64) NOT NULL,
col20 VARCHAR(64) NOT NULL,
col21 VARCHAR(64) NOT NULL,
col22 VARCHAR(64) NOT NULL,
col23 VARCHAR(64) NOT NULL,
col24 VARCHAR(64) NOT NULL,
col25 VARCHAR(64) NOT NULL,
col26 VARCHAR(64) NOT NULL,
col27 VARCHAR(64) NOT NULL,
col28 VARCHAR(64) NOT NULL,
col29 VARCHAR(64) NOT NULL,
col30 VARCHAR(64) NOT NULL,
col31 VARCHAR(64) NOT NULL,
col32 VARCHAR(64) NOT NULL,
col33 VARCHAR(64) NOT NULL,
col34 VARCHAR(64) NOT NULL,
col35 VARCHAR(64) NOT NULL,
col36 VARCHAR(64) NOT NULL,
col37 VARCHAR(64) NOT NULL,
col38 VARCHAR(64) NOT NULL,
col39 VARCHAR(64) NOT NULL,
col40 VARCHAR(64) NOT NULL,
col41 VARCHAR(64) NOT NULL,
col42 VARCHAR(64) NOT NULL,
col43 VARCHAR(64) NOT NULL,
col44 VARCHAR(64) NOT NULL,
col45 VARCHAR(64) NOT NULL,
col46 VARCHAR(64) NOT NULL,
col47 VARCHAR(64) NOT NULL,
col48 VARCHAR(64) NOT NULL,
col49 VARCHAR(64) NOT NULL,
col50 VARCHAR(64) NOT NULL,
col51 VARCHAR(64) NOT NULL,
col52 VARCHAR(64) NOT NULL,
col53 VARCHAR(64) NOT NULL,
col54 VARCHAR(64) NOT NULL,
col55 VARCHAR(64) NOT NULL,
col56 VARCHAR(64) NOT NULL,
col57 VARCHAR(64) NOT NULL,
col58 VARCHAR(64) NOT NULL,
col59 VARCHAR(64) NOT NULL,
col60 VARCHAR(64) NOT NULL,
col61 VARCHAR(64) NOT NULL,
col62 VARCHAR(64) NOT NULL,
col63 VARCHAR(64) NOT NULL,
col64 VARCHAR(64) NOT NULL,
col65 VARCHAR(64) NOT NULL,
col66 VARCHAR(64) NOT NULL,
col67 VARCHAR(64) NOT NULL,
col68 VARCHAR(64) NOT NULL,
col69 VARCHAR(64) NOT NULL,
col70 VARCHAR(64) NOT NULL,
col71 VARCHAR(64) NOT NULL,
col72 VARCHAR(64) NOT NULL,
col73 VARCHAR(64) NOT NULL,
col74 VARCHAR(64) NOT NULL,
col75 VARCHAR(64) NOT NULL,
col76 VARCHAR(64) NOT NULL,
col77 VARCHAR(64) NOT NULL,
col78 VARCHAR(64) NOT NULL,
col79 VARCHAR(64) NOT NULL,
col80 VARCHAR(64) NOT NULL,
col81 VARCHAR(64) NOT NULL,
col82 VARCHAR(64) NOT NULL,
col83 VARCHAR(64) NOT NULL,
col84 VARCHAR(64) NOT NULL,
col85 VARCHAR(64) NOT NULL,
col86 VARCHAR(64) NOT NULL,
col87 VARCHAR(64) NOT NULL,
col88 VARCHAR(64) NOT NULL,
col89 VARCHAR(64) NOT NULL,
col90 VARCHAR(64) NOT NULL,
col91 VARCHAR(64) NOT NULL,
col92 VARCHAR(64) NOT NULL,
col93 VARCHAR(64) NOT NULL,
col94 VARCHAR(64) NOT NULL,
col95 VARCHAR(64) NOT NULL,
col96 VARCHAR(64) NOT NULL,
col97 VARCHAR(64) NOT NULL,
col98 VARCHAR(64) NOT NULL,
col99 VARCHAR(64) NOT NULL,
col100 VARCHAR(64) NOT NULL,
col101 VARCHAR(64) NOT NULL,
col102 VARCHAR(64) NOT NULL,
col103 VARCHAR(64) NOT NULL,
col104 VARCHAR(64) NOT NULL,
col105 VARCHAR(64) NOT NULL,
col106 VARCHAR(64) NOT NULL,
col107 VARCHAR(64) NOT NULL,
col108 VARCHAR(64) NOT NULL,
col109 VARCHAR(64) NOT NULL,
col110 VARCHAR(64) NOT NULL,
col111 VARCHAR(64) NOT NULL,
col112 VARCHAR(64) NOT NULL,
col113 VARCHAR(64) NOT NULL,
col114 VARCHAR(64) NOT NULL,
col115 VARCHAR(64) NOT NULL,
col116 VARCHAR(64) NOT NULL,
col117 VARCHAR(64) NOT NULL,
col118 VARCHAR(64) NOT NULL,
col119 VARCHAR(64) NOT NULL,
col120 VARCHAR(64) NOT NULL,
col121 VARCHAR(64) NOT NULL,
col122 VARCHAR(64) NOT NULL,
col123 VARCHAR(64) NOT NULL,
col124 VARCHAR(64) NOT NULL,
col125 VARCHAR(64) NOT NULL,
col126 VARCHAR(64) NOT NULL,
col127 VARCHAR(64) NOT NULL,
col128 VARCHAR(64) NOT NULL,
col129 VARCHAR(64) NOT NULL,
col130 VARCHAR(64) NOT NULL,
col131 VARCHAR(64) NOT NULL,
col132 VARCHAR(64) NOT NULL,
col133 VARCHAR(64) NOT NULL,
col134 VARCHAR(64) NOT NULL,
col135 VARCHAR(64) NOT NULL,
col136 VARCHAR(64) NOT NULL,
col137 VARCHAR(64) NOT NULL,
col138 VARCHAR(64) NOT NULL,
col139 VARCHAR(64) NOT NULL,
col140 VARCHAR(64) NOT NULL,
col141 VARCHAR(64) NOT NULL,
col142 VARCHAR(64) NOT NULL,
col143 VARCHAR(64) NOT NULL,
col144 VARCHAR(64) NOT NULL,
col145 VARCHAR(64) NOT NULL,
col146 VARCHAR(64) NOT NULL,
col147 VARCHAR(64) NOT NULL,
col148 VARCHAR(64) NOT NULL,
col149 VARCHAR(64) NOT NULL,
col150 VARCHAR(64) NOT NULL,
col151 VARCHAR(64) NOT NULL,
col152 VARCHAR(64) NOT NULL,
col153 VARCHAR(64) NOT NULL,
col154 VARCHAR(64) NOT NULL,
col155 VARCHAR(64) NOT NULL,
col156 VARCHAR(64) NOT NULL,
col157 VARCHAR(64) NOT NULL,
col158 VARCHAR(64) NOT NULL,
col159 VARCHAR(64) NOT NULL,
col160 VARCHAR(64) NOT NULL,
col161 VARCHAR(64) NOT NULL,
col162 VARCHAR(64) NOT NULL,
col163 VARCHAR(64) NOT NULL,
col164 VARCHAR(64) NOT NULL,
col165 VARCHAR(64) NOT NULL,
col166 VARCHAR(64) NOT NULL,
col167 VARCHAR(64) NOT NULL,
col168 VARCHAR(64) NOT NULL,
col169 VARCHAR(64) NOT NULL,
col170 VARCHAR(64) NOT NULL,
col171 VARCHAR(64) NOT NULL,
col172 VARCHAR(64) NOT NULL,
col173 VARCHAR(64) NOT NULL,
col174 VARCHAR(64) NOT NULL,
col175 VARCHAR(64) NOT NULL,
col176 VARCHAR(64) NOT NULL,
col177 VARCHAR(64) NOT NULL,
col178 VARCHAR(64) NOT NULL,
col179 VARCHAR(64) NOT NULL,
col180 VARCHAR(64) NOT NULL,
col181 VARCHAR(64) NOT NULL,
col182 VARCHAR(64) NOT NULL,
col183 VARCHAR(64) NOT NULL,
col184 VARCHAR(64) NOT NULL,
col185 VARCHAR(64) NOT NULL,
col186 VARCHAR(64) NOT NULL,
col187 VARCHAR(64) NOT NULL,
col188 VARCHAR(64) NOT NULL,
col189 VARCHAR(64) NOT NULL,
col190 VARCHAR(64) NOT NULL,
col191 VARCHAR(64) NOT NULL,
col192 VARCHAR(64) NOT NULL,
col193 VARCHAR(64) NOT NULL,
col194 VARCHAR(64) NOT NULL,
col195 VARCHAR(64) NOT NULL,
col196 VARCHAR(64) NOT NULL,
col197 VARCHAR(64) NOT NULL,
col198 VARCHAR(64) NOT NULL,
PRIMARY KEY (col1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;SET GLOBAL innodb_default_row_format='dynamic';
SET SESSION innodb_strict_mode=OFF;
CREATE OR REPLACE TABLE tab (
col1 VARCHAR(40) NOT NULL,
col2 VARCHAR(40) NOT NULL,
col3 VARCHAR(40) NOT NULL,
col4 VARCHAR(40) NOT NULL,
col5 VARCHAR(40) NOT NULL,
col6 VARCHAR(40) NOT NULL,
col7 VARCHAR(40) NOT NULL,
col8 VARCHAR(40) NOT NULL,
col9 VARCHAR(40) NOT NULL,
col10 VARCHAR(40) NOT NULL,
col11 VARCHAR(40) NOT NULL,
col12 VARCHAR(40) NOT NULL,
col13 VARCHAR(40) NOT NULL,
col14 VARCHAR(40) NOT NULL,
col15 VARCHAR(40) NOT NULL,
col16 VARCHAR(40) NOT NULL,
col17 VARCHAR(40) NOT NULL,
col18 VARCHAR(40) NOT NULL,
col19 VARCHAR(40) NOT NULL,
col20 VARCHAR(40) NOT NULL,
col21 VARCHAR(40) NOT NULL,
col22 VARCHAR(40) NOT NULL,
col23 VARCHAR(40) NOT NULL,
col24 VARCHAR(40) NOT NULL,
col25 VARCHAR(40) NOT NULL,
col26 VARCHAR(40) NOT NULL,
col27 VARCHAR(40) NOT NULL,
col28 VARCHAR(40) NOT NULL,
col29 VARCHAR(40) NOT NULL,
col30 VARCHAR(40) NOT NULL,
col31 VARCHAR(40) NOT NULL,
col32 VARCHAR(40) NOT NULL,
col33 VARCHAR(40) NOT NULL,
col34 VARCHAR(40) NOT NULL,
col35 VARCHAR(40) NOT NULL,
col36 VARCHAR(40) NOT NULL,
col37 VARCHAR(40) NOT NULL,
col38 VARCHAR(40) NOT NULL,
col39 VARCHAR(40) NOT NULL,
col40 VARCHAR(40) NOT NULL,
col41 VARCHAR(40) NOT NULL,
col42 VARCHAR(40) NOT NULL,
col43 VARCHAR(40) NOT NULL,
col44 VARCHAR(40) NOT NULL,
col45 VARCHAR(40) NOT NULL,
col46 VARCHAR(40) NOT NULL,
col47 VARCHAR(40) NOT NULL,
col48 VARCHAR(40) NOT NULL,
col49 VARCHAR(40) NOT NULL,
col50 VARCHAR(40) NOT NULL,
col51 VARCHAR(40) NOT NULL,
col52 VARCHAR(40) NOT NULL,
col53 VARCHAR(40) NOT NULL,
col54 VARCHAR(40) NOT NULL,
col55 VARCHAR(40) NOT NULL,
col56 VARCHAR(40) NOT NULL,
col57 VARCHAR(40) NOT NULL,
col58 VARCHAR(40) NOT NULL,
col59 VARCHAR(40) NOT NULL,
col60 VARCHAR(40) NOT NULL,
col61 VARCHAR(40) NOT NULL,
col62 VARCHAR(40) NOT NULL,
col63 VARCHAR(40) NOT NULL,
col64 VARCHAR(40) NOT NULL,
col65 VARCHAR(40) NOT NULL,
col66 VARCHAR(40) NOT NULL,
col67 VARCHAR(40) NOT NULL,
col68 VARCHAR(40) NOT NULL,
col69 VARCHAR(40) NOT NULL,
col70 VARCHAR(40) NOT NULL,
col71 VARCHAR(40) NOT NULL,
col72 VARCHAR(40) NOT NULL,
col73 VARCHAR(40) NOT NULL,
col74 VARCHAR(40) NOT NULL,
col75 VARCHAR(40) NOT NULL,
col76 VARCHAR(40) NOT NULL,
col77 VARCHAR(40) NOT NULL,
col78 VARCHAR(40) NOT NULL,
col79 VARCHAR(40) NOT NULL,
col80 VARCHAR(40) NOT NULL,
col81 VARCHAR(40) NOT NULL,
col82 VARCHAR(40) NOT NULL,
col83 VARCHAR(40) NOT NULL,
col84 VARCHAR(40) NOT NULL,
col85 VARCHAR(40) NOT NULL,
col86 VARCHAR(40) NOT NULL,
col87 VARCHAR(40) NOT NULL,
col88 VARCHAR(40) NOT NULL,
col89 VARCHAR(40) NOT NULL,
col90 VARCHAR(40) NOT NULL,
col91 VARCHAR(40) NOT NULL,
col92 VARCHAR(40) NOT NULL,
col93 VARCHAR(40) NOT NULL,
col94 VARCHAR(40) NOT NULL,
col95 VARCHAR(40) NOT NULL,
col96 VARCHAR(40) NOT NULL,
col97 VARCHAR(40) NOT NULL,
col98 VARCHAR(40) NOT NULL,
col99 VARCHAR(40) NOT NULL,
col100 VARCHAR(40) NOT NULL,
col101 VARCHAR(40) NOT NULL,
col102 VARCHAR(40) NOT NULL,
col103 VARCHAR(40) NOT NULL,
col104 VARCHAR(40) NOT NULL,
col105 VARCHAR(40) NOT NULL,
col106 VARCHAR(40) NOT NULL,
col107 VARCHAR(40) NOT NULL,
col108 VARCHAR(40) NOT NULL,
col109 VARCHAR(40) NOT NULL,
col110 VARCHAR(40) NOT NULL,
col111 VARCHAR(40) NOT NULL,
col112 VARCHAR(40) NOT NULL,
col113 VARCHAR(40) NOT NULL,
col114 VARCHAR(40) NOT NULL,
col115 VARCHAR(40) NOT NULL,
col116 VARCHAR(40) NOT NULL,
col117 VARCHAR(40) NOT NULL,
col118 VARCHAR(40) NOT NULL,
col119 VARCHAR(40) NOT NULL,
col120 VARCHAR(40) NOT NULL,
col121 VARCHAR(40) NOT NULL,
col122 VARCHAR(40) NOT NULL,
col123 VARCHAR(40) NOT NULL,
col124 VARCHAR(40) NOT NULL,
col125 VARCHAR(40) NOT NULL,
col126 VARCHAR(40) NOT NULL,
col127 VARCHAR(40) NOT NULL,
col128 VARCHAR(40) NOT NULL,
col129 VARCHAR(40) NOT NULL,
col130 VARCHAR(40) NOT NULL,
col131 VARCHAR(40) NOT NULL,
col132 VARCHAR(40) NOT NULL,
col133 VARCHAR(40) NOT NULL,
col134 VARCHAR(40) NOT NULL,
col135 VARCHAR(40) NOT NULL,
col136 VARCHAR(40) NOT NULL,
col137 VARCHAR(40) NOT NULL,
col138 VARCHAR(40) NOT NULL,
col139 VARCHAR(40) NOT NULL,
col140 VARCHAR(40) NOT NULL,
col141 VARCHAR(40) NOT NULL,
col142 VARCHAR(40) NOT NULL,
col143 VARCHAR(40) NOT NULL,
col144 VARCHAR(40) NOT NULL,
col145 VARCHAR(40) NOT NULL,
col146 VARCHAR(40) NOT NULL,
col147 VARCHAR(40) NOT NULL,
col148 VARCHAR(40) NOT NULL,
col149 VARCHAR(40) NOT NULL,
col150 VARCHAR(40) NOT NULL,
col151 VARCHAR(40) NOT NULL,
col152 VARCHAR(40) NOT NULL,
col153 VARCHAR(40) NOT NULL,
col154 VARCHAR(40) NOT NULL,
col155 VARCHAR(40) NOT NULL,
col156 VARCHAR(40) NOT NULL,
col157 VARCHAR(40) NOT NULL,
col158 VARCHAR(40) NOT NULL,
col159 VARCHAR(40) NOT NULL,
col160 VARCHAR(40) NOT NULL,
col161 VARCHAR(40) NOT NULL,
col162 VARCHAR(40) NOT NULL,
col163 VARCHAR(40) NOT NULL,
col164 VARCHAR(40) NOT NULL,
col165 VARCHAR(40) NOT NULL,
col166 VARCHAR(40) NOT NULL,
col167 VARCHAR(40) NOT NULL,
col168 VARCHAR(40) NOT NULL,
col169 VARCHAR(40) NOT NULL,
col170 VARCHAR(40) NOT NULL,
col171 VARCHAR(40) NOT NULL,
col172 VARCHAR(40) NOT NULL,
col173 VARCHAR(40) NOT NULL,
col174 VARCHAR(40) NOT NULL,
col175 VARCHAR(40) NOT NULL,
col176 VARCHAR(40) NOT NULL,
col177 VARCHAR(40) NOT NULL,
col178 VARCHAR(40) NOT NULL,
col179 VARCHAR(40) NOT NULL,
col180 VARCHAR(40) NOT NULL,
col181 VARCHAR(40) NOT NULL,
col182 VARCHAR(40) NOT NULL,
col183 VARCHAR(40) NOT NULL,
col184 VARCHAR(40) NOT NULL,
col185 VARCHAR(40) NOT NULL,
col186 VARCHAR(40) NOT NULL,
col187 VARCHAR(40) NOT NULL,
col188 VARCHAR(40) NOT NULL,
col189 VARCHAR(40) NOT NULL,
col190 VARCHAR(40) NOT NULL,
col191 VARCHAR(40) NOT NULL,
col192 VARCHAR(40) NOT NULL,
col193 VARCHAR(40) NOT NULL,
col194 VARCHAR(40) NOT NULL,
col195 VARCHAR(40) NOT NULL,
col196 VARCHAR(40) NOT NULL,
col197 VARCHAR(40) NOT NULL,
col198 VARCHAR(40) NOT NULL,
PRIMARY KEY (col1)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;SHOW WARNINGS;
+---------+------+----------------------------------------------------------------------------------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+----------------------------------------------------------------------------------------------------------------------------------------------+
| Warning | 139 | Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline. |
+---------+------+----------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.000 sec)This page lists the system variables available for configuring InnoDB's behavior, performance, buffers, and logs.
This page documents system variables related to the InnoDB storage engine. For options that are not system variables, see InnoDB Options.
See Server System Variables for a complete list of system variables and instructions on setting them.
Also see the Full list of MariaDB options, system and status variables.
have_innodbDescription: If the server supports , are set to YES, otherwise are set to NO. Removed in , use the table or instead.
Scope: Global
Dynamic: No
Removed:
ignore_builtin_innodbDescription: Setting this to 1 results in the built-in InnoDB storage engine being ignored. In some versions of MariaDB, XtraDB is the default and is always present, so this variable is ignored and setting it results in a warning. From to , when InnoDB was the default instead of XtraDB, this variable needed to be set. Usually used in conjunction with the option to use the InnoDB plugin.
Command line: --ignore-builtin-innodb
Scope: Global
innodb_adaptive_checkpointDescription: Replaced with . Controls adaptive checkpointing. InnoDB's fuzzy checkpointing can cause stalls, as many dirty blocks are flushed at once as the checkpoint age nears the maximum. Adaptive checkpointing aims for more consistent flushing, approximately modified age / maximum checkpoint age. Can result in larger transaction log files
reflex Similar to flushing but flushes blocks constantly and contiguously based on the oldest modified age. If the age exceeds 1/2 of the maximum age capacity, flushing are weak contiguous. If the age exceeds 3/4, flushing are strong. Strength can be adjusted by the variable .
innodb_adaptive_flushingDescription: If set to 1, the default, the server will dynamically adjust the flush rate of dirty pages in the . This assists to reduce brief bursts of I/O activity. If set to 0, adaptive flushing will only take place when the limit specified by is reached.
Command line: --innodb-adaptive-flushing={0|1}
Scope: Global
innodb_adaptive_flushing_lwmDescription: Adaptive flushing is enabled when this low water mark percentage of the capacity is reached. Takes effect even if is disabled.
Command line: --innodb-adaptive-flushing-lwm=#
Scope: Global
Dynamic: Yes
innodb_adaptive_flushing_methodDescription: Determines the method of flushing dirty blocks from the InnoDB . If set to native or 0, the original InnoDB method is used. The maximum checkpoint age is determined by the total length of all transaction log files. When the checkpoint age reaches the maximum checkpoint age, blocks are flushed. This can cause lag if there are many updates per second and many blocks with an almost identical age need to be flushed. If set to estimate or 1, the default, the oldest modified age are compared with the maximum age capacity. If it's more than 1/4 of this age, blocks are flushed every second. The number of blocks flushed is determined by the number of modified blocks, the LSN progress speed and the average age of all modified blocks. It's therefore independent of the for the 1-second loop, but not entirely so for the 10-second loop. If set to keep_average or 2, designed specifically for SSD cards, a shorter loop cycle is used in an attempt to keep the I/O rate constant. Removed in /XtraDB 5.6 and replaced with InnoDB flushing method from MySQL 5.6.
innodb_adaptive_hash_indexDescription: If set to 1, the default until , the hash index is enabled. Based on performance testing (), the InnoDB adaptive hash index helps performance in mostly read-only workloads, and could slow down performance in other environments, especially , , , or operations.
Command line: --innodb-adaptive-hash-index={0|1}
Scope: Global
innodb_adaptive_hash_index_partitionsDescription: Specifies the number of partitions for use in adaptive searching. If set to 1, no extra partitions are created. XtraDB-only. From (which uses InnoDB as default instead of XtraDB), this is an alias for to allow for easier upgrades.
Command line: innodb-adaptive-hash-index-partitions=#
Scope: Global
innodb_adaptive_hash_index_partsDescription: Specifies the number of partitions for use in adaptive searching. If set to 1, no extra partitions are created.
Command line: innodb-adaptive-hash-index-parts=#
Scope: Global
Dynamic: No
innodb_adaptive_max_sleep_delayDescription: Maximum time in microseconds to automatically adjust the value to, based on the workload. Useful in extremely busy systems with hundreds of thousands of simultaneous connections. 0 disables any limit. Deprecated and ignored from .
Command line: --innodb-adaptive-max-sleep-delay=#
Scope: Global
innodb_additional_mem_pool_sizeDescription: Size in bytes of the memory pool used for storing information about internal data structures. Defaults to 8MB, if your application has many tables and a large structure, and this is exceeded, operating system memory are allocated and warning messages written to the error log, in which case you should increase this value. Deprecated in and removed in along with InnoDB's internal memory allocator.
Command line: --innodb-additional-mem-pool-size=#
Scope: Global
innodb_alter_copy_bulkDescription: Allow bulk insert operation for copy alter operation.
Scope: Global
Dynamic: Yes
Data Type: boolean
innodb_api_bk_commit_intervalDescription: Time in seconds between auto-commits for idle connections using the InnoDB memcached interface (not implemented in MariaDB).
Command line: --innodb-api-bk-commit-interval=#
Scope: Global
Dynamic: Yes
innodb_api_disable_rowlockDescription: For use with MySQL's memcached (not implemented in MariaDB)
Command line: --innodb-api-disable-rowlock={0|1}
Scope: Global
Dynamic: No
innodb_api_enable_binlogDescription: For use with MySQL's memcached (not implemented in MariaDB)
Command line: --innodb-api-enable-binlog={0|1}
Scope: Global
Dynamic: No
innodb_api_enable_mdlDescription: For use with MySQL's memcached (not implemented in MariaDB)
Command line: --innodb-api-enable-mdl={0|1}
Scope: Global
Dynamic: No
innodb_api_trx_levelDescription: For use with MySQL's memcached (not implemented in MariaDB)
Command line: --innodb-api-trx-level=#
Scope: Global
Dynamic: Yes
innodb_auto_lru_dumpDescription: Renamed since XtraDB 5.5.10-20.1, which was in turn replaced by in .
Command line: --innodb-auto-lru-dump=#
Removed: XtraDB 5.5.10-20.1
innodb_autoextend_incrementDescription: Size in MB to increment an auto-extending shared tablespace file when it becomes full. If was set to 1, this setting does not apply to the resulting per-table tablespace files, which are automatically extended in their own way.
Command line: --innodb-autoextend-increment=#
Scope: Global
innodb_autoinc_lock_modeDescription: The lock mode that is used when generating values for InnoDB tables.
Valid values are:
0 is the traditional lock mode.
innodb_background_scrub_data_check_intervalDescription: Check if spaces needs scrubbing every seconds. See . Deprecated and ignored from .
Command line: --innodb-background-scrub-data-check-interval=#
Scope: Global
Dynamic: Yes
innodb_background_scrub_data_compressedDescription: Enable scrubbing of compressed data by background threads (same as encryption_threads). See . Deprecated and ignored from .
Command line: --innodb-background-scrub-data-compressed={0|1}
Scope: Global
Dynamic: Yes
innodb_background_scrub_data_intervalDescription: Scrub spaces that were last scrubbed longer than this number of seconds ago. See . Deprecated and ignored from .
Command line: --innodb-background-scrub-data-interval=#
Scope: Global
Dynamic: Yes
innodb_background_scrub_data_uncompressedDescription: Enable scrubbing of uncompressed data by background threads (same as encryption_threads). See . Deprecated and ignored from .
Command line: --innodb-background-scrub-data-uncompressed={0|1}
Scope: Global
Dynamic: Yes
innodb_blocking_buffer_pool_restoreDescription: If set to 1 (0 is default), XtraDB will wait until the least-recently used (LRU) dump is completely restored upon restart before reporting back to the server that it has successfully started up. Available with XtraDB only, not InnoDB.
Command line: innodb-blocking-buffer-pool-restore={0|1}
Scope: Global
innodb_buf_dump_status_frequencyDescription: Determines how often (as a percent) the buffer pool dump status should be printed in the logs. For example, 10 means that the buffer pool dump status is printed when every 10% of the number of buffer pool pages are dumped. The default is 0 (only start and end status is printed).
Command line: --innodb-buf-dump-status-frequency=#
Scope: Global
innodb_buffer_pool_chunk_sizeDescription: Chunk size used for dynamically resizing the . Note that changing this setting can change the size of the buffer pool. When is used this value is effectively rounded up to the next multiple of . See . From , the variable is autosized based on the .
Command line: --innodb-buffer-pool-chunk-size=#
Scope: Global
innodb_buffer_pool_dump_at_shutdownDescription: Whether to record pages cached in the on server shutdown, which reduces the length of the warmup the next time the server starts. The related specifies whether the buffer pool is automatically warmed up at startup.
Command line: --innodb-buffer-pool-dump-at-shutdown={0|1}
Scope: Global
Dynamic: Yes
innodb_buffer_pool_dump_nowDescription: Immediately records pages stored in the . The related does the reverse, and will immediately warm up the buffer pool.
Command line: --innodb-buffer-pool-dump-now={0|1}
Scope: Global
Dynamic: Yes
innodb_buffer_pool_dump_pctDescription: Dump only the hottest N% of each .
Command line: --innodb-buffer-pool-dump-pct={0|1}
Scope: Global
Dynamic: Yes
innodb_buffer_pool_evictDescription: Evict pages from the buffer pool. If set to "uncompressed" then all uncompressed pages are evicted from the buffer pool. Variable to be used only for testing. Only exists in DEBUG builds.
Command line: --innodb-buffer-pool-evict=#
Scope: Global
Dynamic: Yes
innodb_buffer_pool_filenameDescription: The file that holds the list of page numbers set by and .
Command line: --innodb-buffer-pool-filename=file
Scope: Global
Dynamic: Yes
innodb_buffer_pool_instancesDescription: If is set to more than 1GB, innodb_buffer_pool_instances divides the buffer pool into the specified number of instances. The default was 1 in , but for large systems with buffer pools of many gigabytes, many instances could help reduce contention concurrency through . The default is 8 in MariaDB 10 (except on Windows 32-bit, where it varies according to , or from , where it is set to 1 if < 1GB). Each instance manages its own data structures and takes an equal portion of the total buffer pool size, so for example if innodb_buffer_pool_size is 4GB and innodb_buffer_pool_instances is set to 4, each instance are 1GB. Each instance should ideally be at least 1GB in size. Starting with , performance improvements intended to reduce the overhead of context-switching between buffer pools changed the recommended number of innodb_buffer_pool_instances to one for every 128GB of buffer pool size. Based on these changes, the variable is deprecated and ignored from , where the buffer pool runs in a single instance regardless of size.
Command line: --innodb-buffer-pool-instances=#
innodb_buffer_pool_load_abortDescription: Aborts the process of restoring contents started by or .
Command line: --innodb-buffer-pool-load-abort={0|1}
Scope: Global
Dynamic: Yes
innodb_buffer_pool_load_at_startupDescription: Specifies whether the is automatically warmed up when the server starts by loading the pages held earlier. The related specifies whether pages are saved at shutdown. If the buffer pool is large and taking a long time to load, increasing at startup may help.
Command line: --innodb-buffer-pool-load-at-startup={0|1}
Scope: Global
innodb_buffer_pool_load_nowDescription: Immediately warms up the by loading the stored data pages. The related does the reverse, and immediately records pages stored in the buffer pool.
Command line: --innodb-buffer-pool-load-now={0|1}
Scope: Global
Dynamic: Yes
innodb_buffer_pool_load_pages_abortDescription: Number of pages during a buffer pool load to process before signaling . Debug builds only.
Command line: --innodb-buffer-pool-load-pages-abort=#
Scope: Global
Dynamic: Yes
innodb_buffer_pool_populateDescription: When set to 1 (0 is default), XtraDB will preallocate pages in the buffer pool on starting up so that NUMA allocation decisions are made while the buffer cache is still clean. XtraDB only. This option was made ineffective in . Added as a deprecated and ignored option in (which uses InnoDB as default instead of XtraDB) to allow for easier upgrades.
Command line: innodb-buffer-pool-populate={0|1}
Scope: Global
innodb_buffer_pool_restore_at_startupDescription: Time in seconds between automatic buffer pool dumps. If set to a non-zero value, XtraDB will also perform an automatic restore of the at startup. If set to 0, automatic dumps are not performed, nor automatic restores on startup. Replaced by in .
Command line: innodb-buffer-pool-restore-at-startup
Scope: Global
innodb_buffer_pool_shm_checksumDescription: Used with Percona's SHM buffer pool patch in XtraDB 5.5. Was shortly deprecated and removed in XtraDB 5.6. XtraDB only.
Command line: innodb-buffer-pool-shm-checksum={0|1}
Scope: Global
Dynamic: No
innodb_buffer_pool_shm_keyDescription: Used with Percona's SHM buffer pool patch in XtraDB 5.5. Later deprecated in XtraDB 5.5, and removed in XtraDB 5.6.
Command line: innodb-buffer-pool-shm-key={0|1}
Scope: Global
Dynamic: No
innodb_buffer_pool_sizeDescription: InnoDB buffer pool size in bytes. The primary value to adjust on a database server with entirely/primarily tables, can be set up to 80% of the total memory in these environments. See the for more on setting this variable, and also if doing so dynamically.
Command line: --innodb-buffer-pool-size=#
Scope: Global
innodb_buffer_pool_size_auto_minDescription: Minimum innodb_buffer_pool_size in bytes for dynamic shrinking on memory pressure. Only affects Linux. If a memory pressure event is reported by Linux, the innodb_buffer_pool_size may be automatically shrunk towards this value. By default, set to , that is, memory pressure events will be ignored. 0 sets no minimum value.
Command line: --innodb-buffer-pool-size-auto-min=#
Scope: Global
innodb_buffer_pool_size_maxDescription: Maximum innodb_buffer_pool_size value.
Command line: --innodb-buffer-pool-size-max=#
Scope: Global
Dynamic: No
innodb_change_buffer_dumpDescription: If set, causes the contents of the InnoDB change buffer to be dumped to the server error log at startup. Only available in debug builds.
Scope: Global
Dynamic: No
Data Type: boolean
innodb_change_buffer_max_sizeDescription: Maximum size of the as a percentage of the total buffer pool. The default is 25%, and this can be increased up to 50% for servers with high write activity, and lowered down to 0 for servers used exclusively for reporting.
Command line: --innodb-change-buffer-max-size=#
Scope: Global
Dynamic: Yes
innodb_change_bufferingDescription: Sets how change buffering is performed. See for details on the settings. Deprecated and ignored from .
Command line: --innodb-change-buffering=#
Scope: Global
Dynamic: Yes
innodb_change_buffering_debugDescription: If set to 1, an debug flag is set. 1 forces all changes to the change buffer, while 2 causes a crash at merge. 0, the default, indicates no flag is set. Only available in debug builds.
Command line: --innodb-change-buffering-debug=#
innodb_checkpoint_age_targetDescription: The maximum value of the checkpoint age. If set to 0, has no effect. Removed in /XtraDB 5.6 and replaced with InnoDB flushing method from MySQL 5.6.
Command line: innodb-checkpoint-age-target=#
Scope: Global
innodb_checksum_algorithmDescription: Specifies how the InnoDB tablespace checksum is generated and verified.
innodb: Backwards compatible with earlier versions (<= ). Deprecated in , , and removed in . If really needed, data files can still be converted with .
crc32: A newer, faster algorithm, but incompatible with earlier versions. Tablespace blocks are converted to the new format over time, meaning that a mix of checksums may be present.
innodb_checksumsDescription: By default, performs checksum validation on all pages read from disk, which provides extra fault tolerance. You would usually want this set to 1 in production environments, although setting it to 0 can provide marginal performance improvements. Deprecated and functionality replaced by in , and should be removed to avoid conflicts. ON is equivalent to --innodb_checksum_algorithm=innodb and OFF to --innodb_checksum_algorithm=none.
Command line: --innodb-checksums
innodb_cleaner_lsn_age_factorDescription: XtraDB has enhanced page cleaner heuristics, and with these in place, the default InnoDB adaptive flushing may be too aggressive. As a result, a new LSN age factor formula has been introduced, controlled by this variable. The default setting, high_checkpoint, uses the new formula, while the alternative, legacy, uses the original algorithm. XtraDB only. Added as a deprecated and ignored option in (which uses InnoDB as default instead of XtraDB) to allow for easier upgrades.
Command line: --innodb-cleaner-lsn-age-factor=value
Scope: Global
innodb_cmp_per_index_enabledDescription: If set to ON (OFF is default), per-index compression statistics are stored in the table. These are expensive to record, so this setting should only be changed with care, such as for performance tuning on development or replica servers.
Command line: --innodb-cmp-per-index-enabled={0|1}
Scope: Global
innodb_commit_concurrencyDescription: Limit to the number of transaction threads that can commit simultaneously. 0, the default, imposes no limit. While you can change from one positive limit to another at runtime, you cannot set this variable to 0, or change it from 0, while the server is running. Deprecated and ignored from .
Command line: --innodb-commit-concurrency=#
Scope: Global
Dynamic: Yes
innodb_compression_algorithmDescription: Compression algorithm used for . The supported values are:
none: Pages are not compressed.
zlib: Pages are compressed using the bundled compression algorithm.
innodb_compression_defaultDescription: Whether or not is enabled by default for new tables.
The default value is OFF, which means new tables are not compressed.
See for more information.
Command line:
innodb_compression_failure_threshold_pctDescription: Specifies the percentage cutoff for expensive compression failures during updates to a table that uses , after which free space is added to each new compressed page, dynamically adjusted up to the level set by . Zero disables checking of compression efficiency and adjusting padding.
See for more information.
Command line: --innodb-compression-failure-threshold-pct=#
innodb_compression_levelDescription: Specifies the default level of compression for tables that use .
Only a subset of InnoDB page compression algorithms support compression levels. If an InnoDB page compression algorithm does not support compression levels, then the compression level value is ignored.
The compression level can be set to any value between 1 and 9. The default compression level is 6. The range goes from the fastest to the most compact, which means that
innodb_compression_pad_pct_maxDescription: The maximum percentage of reserved free space within each compressed page for tables that use . Reserved free space is used when the page's data is reorganized and might be recompressed. Only used when is not zero, and the rate of compression failures exceeds its setting.
See for more information.
Command line: --innodb-compression-pad-pct-max=#
innodb_concurrency_ticketsDescription: Number of times a newly-entered thread can enter and leave until it is again subject to the limitations of and may possibly be queued. Deprecated and ignored from .
Command line: --innodb-concurrency-tickets=#
Scope: Global
Dynamic: Yes
innodb_corrupt_table_actionDescription: What action to perform when a corrupt table is found. XtraDB only.
When set to assert, the default, XtraDB will intentionally crash the server when it detects corrupted data in a single-table tablespace, with an assertion failure.
When set to warn, it will pass corruption as corrupt table instead of crashing, and disable all further I/O (except for deletion) on the table file.
innodb_data_file_bufferingDescription: Whether to enable the file system cache for data files. Set to OFF by default, are set to ON if is set to fsync, littlesync, nosync, or (Windows specific) normal.
Command line: --innodb-data-file-buffering={0|1}
innodb_data_file_pathDescription: Individual data files, paths and sizes. The value of is joined to each path specified by innodb_data_file_path to get the full directory path. If innodb_data_home_dir is an empty string, absolute paths can be specified here. A file size is specified (with K for kilobytes, M for megabytes and G for gigabytes). Also whether or not to autoextend the data file, and whether or not to on startup may also be specified.
Command line: --innodb-data-file-path=name
Scope: Global
innodb_data_file_write_throughDescription: Whether writes to InnoDB data files (including the temporary tablespace) are write through. Set to OFF by default, are set to ON if is set to O_DSYNC. On systems that support FUA it may make sense to enable write-through, to avoid extra system calls.
Command line: --innodb-data-file-write-through={0|1}
Scope: Global
innodb_data_home_dirDescription: Directory path for all data files in the shared tablespace (assuming is not enabled). File-specific information can be added in , as well as absolute paths if innodb_data_home_dir is set to an empty string.
Command line: --innodb-data-home-dir=path
Scope: Global
Dynamic: No
innodb_deadlock_detectDescription: By default, the InnoDB deadlock detector is enabled. If set to off, deadlock detection is disabled and MariaDB will rely on instead. This may be more efficient in systems with high concurrency as deadlock detection can cause a bottleneck when a number of threads have to wait for the same lock.
Command line: --innodb-deadlock-detect
Scope: Global
Dynamic: Yes
innodb_deadlock_reportDescription: How to report deadlocks (if ).
off: Do not report any details of deadlocks.
basic: Report transactions and waiting locks.
innodb_default_page_encryption_keyDescription: Encryption key used for page encryption.
See and for more information.
Command line: --innodb-default-page-encryption-key=#
Scope: Global
innodb_default_encryption_key_idDescription: ID of encryption key used by default to encrypt InnoDB tablespaces.
See and for more information.
Command line: --innodb-default-encryption-key-id=#
Scope: Global, Session
innodb_default_row_formatDescription: Specifies the default to be used for InnoDB tables. The compressed row format cannot be set as the default.
See for more information.
Command line: --innodb-default-row-format=value
innodb_defragmentDescription: When set to 1 (the default is 0), InnoDB defragmentation is enabled. When set to FALSE, all existing defragmentation are paused and new defragmentation commands will fail. Paused defragmentation commands will resume when this variable is set to true again. See .
Command line: --innodb-defragment={0|1}
Scope: Global
innodb_defragment_fill_factorDescription:. Indicates how full defragmentation should fill a page. Together with ensures defragmentation won’t pack the page too full and cause page split on the next insert on every page. The variable indicating more defragmentation gain is the one effective. See .
Command line: --innodb-defragment-fill-factor=#
Scope: Global
Dynamic: Yes
innodb_defragment_fill_factor_n_recsDescription: Number of records of space that defragmentation should leave on the page. This variable, together with , is introduced so defragmentation won't pack the page too full and cause page split on the next insert on every page. The variable indicating more defragmentation gain is the one effective. See .
Command line: --innodb-defragment-fill-factor-n-recs=#
Scope: Global
innodb_defragment_frequencyDescription: Maximum times per second for defragmenting a single index. This controls the number of times the defragmentation thread can request X_LOCK on an index. The defragmentation thread will check whether 1/defragment_frequency (s) has passed since it last worked on this index, and put the index back in the queue if not enough time has passed. The actual frequency can only be lower than this given number. See .
Command line: --innodb-defragment-frequency=#
Scope: Global
innodb_defragment_n_pagesDescription: Number of pages considered at once when merging multiple pages to defragment. See .
Command line: --innodb-defragment-n-pages=#
Scope: Global
Dynamic: Yes
innodb_defragment_stats_accuracyDescription: Number of defragment stats changes there are before the stats are written to persistent storage. Defaults to zero, meaning disable defragment stats tracking. See .
Command line: --innodb-defragment-stats-accuracy=#
Scope: Global
Dynamic: Yes
innodb_dict_size_limitDescription: Size in bytes of a soft limit the memory used by tables in the data dictionary. Once this limit is reached, XtraDB will attempt to remove unused entries. If set to 0, the default and standard InnoDB behavior, there is no limit to memory usage. Removed in /XtraDB 5.6 and replaced by MySQL 5.6's new implementation.
Command line: innodb-dict-size-limit=#
Scope: Global
innodb_disable_sort_file_cacheDescription: If set to 1 (0 is default), the operating system file system cache for merge-sort temporary files is disabled.
Command line: --innodb-disable-sort-file-cache={0|1}
Scope: Global
innodb_disallow_writesDescription: Tell InnoDB to stop any writes to disk.
Command line: None
Scope: Global
Dynamic: Yes
innodb_doublewriteDescription: If set to ON, the default, to improve fault tolerance first stores data to a before writing it to data file. Disabling will provide a marginal performance improvement, and assumes that writes of are atomic. fast is available from , and is like ON, but writes are not synchronized to data files. The deprecated start-up parameter will cause innodb_doublewrite=ON to be changed to innodb_doublewrite=fast, which will prevent InnoDB from making any durable writes to data files. This would normally be done right before the log checkpoint LSN is updated. Depending on the file systems being used and their configuration, this may or may not be safe.
The value innodb_doublewrite=fast differs from the previous combination of innodb_doublewrite=ON and innodb_flush_method=O_DIRECT_NO_FSYNC by always invoking os_file_flush() on the doublewrite buffer itself in buf_dblwr_t::flush_buffered_writes_completed(). This should be safer when there are multiple doublewrite batches between checkpoints.
Typically, once per second, buf_flush_page_cleaner() would write out up to innodb_io_capacity pages and advance the log checkpoint. Also typically, innodb_io_capacity>128, which is the size of the doublewrite buffer in pages. Should os_file_flush_func() not be invoked between doublewrite batches, writes could be reordered in an unsafe way.
innodb_doublewrite_fileDescription: The absolute or relative path and filename to a dedicated tablespace for the . In heavy workloads, the doublewrite buffer can impact heavily on the server, and moving it to a different drive will reduce contention on random reads. Since the doublewrite buffer is mostly sequential writes, a traditional HDD is a better choice than SSD. This Percona XtraDB variable has not been ported to XtraDB 5.6.
Command line: innodb-doublewrite-file=filename
Scope: Global
innodb_empty_free_list_algorithmDescription: XtraDB 5.6.13-61 introduced an algorithm to assist with reducing mutex contention when the buffer pool free list is empty, controlled by this variable. If set to backoff, the default until , the new algorithm are used. If set to legacy, the original InnoDB algorithm are used. XtraDB only. Added as a deprecated and ignored option in (which uses InnoDB as default instead of XtraDB) to allow for easier upgrades. See for the reasons this was changed back to legacy in XtraDB 5.6.36-82.0. When upgrading from 10.0 to 10.1 (>= 10.1.24), for large buffer pools the default will remain backoff, while for small ones it are changed to legacy.
Command line: innodb-empty-free-list-algorithm=value
innodb_enable_unsafe_group_commitDescription: Unneeded after XtraDB 1.0.5. If set to 0, the default, InnoDB will keep transactions between the transaction log and s in the same order. Safer, but slower. If set to 1, transactions can be group-committed, but there is no guarantee of the order being kept, and a small risk of the two logs getting out of sync. In write-intensive environments, can lead to a significant improvement in performance.
Command line: --innodb-enable-unsafe-group-commit
Scope: Global
innodb_encrypt_logDescription: Enables encryption of the . This also enables encryption of some temporary files created internally by InnoDB, such as those used for merge sorts and row logs.
See and for more information.
Command line: --innodb-encrypt-log
innodb_encrypt_tablesDescription: Enables automatic encryption of all InnoDB tablespaces.
OFF - Disables table encryption for all new and existing tables that have the table option set to DEFAULT.
ON - Enables table encryption for all new and existing tables that have the table option set to DEFAULT
innodb_encrypt_temporary_tablesDescription: Enables automatic encryption of the InnoDB .
See and for more information.
Command line: --innodb-encrypt-temporary-tables={0|1}
innodb_encryption_rotate_key_ageDescription: Re-encrypt in background any page having a key older than this number of key versions. When setting up encryption, this variable must be set to a non-zero value. Otherwise, when you enable encryption through MariaDB won't be able to automatically encrypt any unencrypted tables.
See and for more information.
Command line: --innodb-encryption-rotate-key-age=#
innodb_encryption_rotation_iopsDescription: Use this many iops for background key rotation operations performed by the background encryption threads.
See and for more information.
Command line: --innodb-encryption-rotation_iops=#
innodb_encryption_threadsDescription: Number of background encryption threads performing background key rotation and . When setting up encryption, this variable must be set to a non-zero value. Otherwise, when you enable encryption through MariaDB won't be able to automatically encrypt any unencrypted tables. Recommended never be set higher than 255.
See and for more information.
Command line: --innodb-encryption-threads=#
innodb_extra_rsegmentsDescription: Removed in XtraDB 5.5 and replaced by . Usually there is one rollback segment protected by single mutex, a source of contention in high write environments. This option specifies a number of extra user rollback segments. Changing the default will make the data readable by XtraDB only, and is incompatible with InnoDB. After modifying, the server must be slow-shutdown. If there is existing data, it must be dumped before changing, and re-imported after the change has taken effect.
Command line: --innodb-extra-rsegments=#
Scope: Global
innodb_extra_undoslotsDescription: Usually, InnoDB has 1024 undo slots in its rollback segment, so 1024 transactions can run in parallel. New transactions will fail if all slots are used. Setting this variable to 1 expands the available undo slots to 4072. Not recommended unless you get the Warning: cannot find a free slot for an undo log error in the error log, as it makes data files unusable for ibbackup, or MariaDB servers not run with this option. See also .
Command line: --innodb-extra-undoslots={0|1}
Scope: Global
innodb_fake_changesDescription: From until , XtraDB-only option that enables the fake changes feature. In , setting up or restarting a replica can cause a replication reads to perform more slowly, as MariaDB is single-threaded and needs to read the data before it can execute the queries. This can be speeded up by prefetching threads to warm the server, replaying the statements and then rolling back at commit. This however has an overhead from locking rows only then to undo changes at rollback. Fake changes attempts to reduce this overhead by reading the rows for INSERT, UPDATE and DELETE statements but not updating them. The rollback is then very fast with little or nothing to do. Added as a deprecated and ignored option in (which uses InnoDB as default instead of XtraDB) to allow for easier upgrades. Not present in and beyond.
Command line: --innodb-fake-changes={0|1}
innodb_fast_checksumDescription: Implements a more CPU efficient XtraDB checksum algorithm, useful for write-heavy loads with high I/O. If set to 1 on a server with tables that have been created with it set to 0, reads are slower, so tables should be recreated (dumped and reloaded). XtraDB will fail to start if set to 0 and there are tables created while set to 1. Replaced with in /XtraDB 5.6.
Command line: --innodb-fast-checksum={0|1}
innodb_fast_shutdownDescription: The shutdown mode.
0 - InnoDB performs a slow shutdown, including full purge (before , not always, due to ) and change buffer merge. Can be very slow, even taking hours in extreme cases.
1 - the default, performs a fast shutdown, not performing a full purge or an insert buffer merge.
innodb_fatal_semaphore_wait_thresholdDescription: In MariaDB, the fatal semaphore timeout is configurable. This variable sets the maximum number of seconds for semaphores to time out in InnoDB.
Command line: --innodb-fatal-semaphore-wait-threshold=#
Scope: Global
Dynamic: No
innodb_file_formatDescription: File format for new tables. Can either be Antelope, the default and the original format, or Barracuda, which supports . Note that this value is also used when a table is re-created with an which requires a table copy. See for more on the file formats. Removed in 10.3.1 and restored as a deprecated and unused variable in 10.4.3 for compatibility purposes.
Command line: --innodb-file-format=value
Scope: Global
innodb_file_format_checkDescription: If set to 1, the default, checks the shared tablespace file format tag. If this is higher than the current version supported by XtraDB/InnoDB (for example Barracuda when only Antelope is supported), XtraDB/InnoDB will not start. If it the value is not higher, XtraDB/InnoDB starts correctly and the value is set to this value. If innodb_file_format_check is set to 0, no checking is performed. See for more on the file formats.
Command line: --innodb-file-format-check={0|1}
Scope: Global
innodb_file_format_maxDescription: The highest file format. This is set to the value of the file format tag in the shared tablespace on startup (see ). If the server later creates a higher table format, innodb_file_format_max is set to that value. See for more on the file formats.
Command line: --innodb-file-format-max=value
Scope: Global
innodb_file_per_tableDescription: If set to ON, then new tables are created with their own . If set to OFF, then new tables are created in the instead. is only available with file-per-table tablespaces. Note that this value is also used when a table is re-created with an which requires a table copy. Deprecated in as there's no benefit to setting to OFF, the original InnoDB default.
Command line: --innodb-file-per-table
innodb_fill_factorDescription: Percentage of B-tree page filled during bulk insert (sorted index build). Used as a hint rather than an absolute value. Setting to 70, for example, reserves 30% of the space on each B-tree page for the index to grow in future.
Command line: --innodb-fill-factor=#
Scope: Global
innodb_flush_log_at_timeoutDescription: Interval in seconds to write and flush the . Before MariaDB 10, this was fixed at one second, which is still the default, but this can now be changed. It's usually increased to reduce flushing and avoid impacting performance of binary log group commit.
Scope: Global
Dynamic: Yes
Data Type: numeric
innodb_flush_log_at_trx_commitDescription: Set to 1, along with for the greatest level of fault tolerance. The value of determines whether this variable can be reset with a SET statement or not.
1 The default, the log buffer is written to the file and a flush to disk performed after each transaction. This is required for full ACID compliance.
0 Nothing is done on commit; rather the log buffer is written and flushed to the
innodb_flush_methodDescription: flushing method. Windows always uses async_unbuffered and this variable then has no effect. On Unix, before , by default fsync() is used to flush data and logs. Adjusting this variable can give performance improvements, but behavior differs widely on different filesystems, and changing from the default has caused problems in some situations, so test and benchmark carefully before adjusting. In MariaDB, Windows recognises and correctly handles the Unix methods, but if none are specified it uses own default - unbuffered write (analog of O_DIRECT) + syncs (e.g FileFlushBuffers()) for all files.
O_DSYNC - O_DSYNC is used to open and flush logs, and fsync() to flush the data files.
O_DIRECT
innodb_flush_neighbor_pagesDescription: Determines whether, when dirty pages are flushed to the data file, neighboring pages in the data file are flushed at the same time. If set to none, the feature is disabled. If set to area, the default, the standard InnoDB behavior is used. For each page to be flushed, dirty neighboring pages are flushed too. If there's little head seek delay, such as SSD or large enough write buffer, one of the other two options may be more efficient. If set to cont, for each page to be flushed, neighboring contiguous blocks are flushed at the same time. Being contiguous, a sequential I/O is used, unlike the random I/O used in area. Replaced by in /XtraDB 5.6.
Command line: innodb-flush-neighbor-pages=value
innodb_flush_neighborsDescription: Determines whether flushing a page from the will flush other dirty pages in the same group of pages (extent). In high write environments, if flushing is not aggressive enough, it can fall behind resulting in higher memory usage, or if flushing is too aggressive, cause excess I/O activity. SSD devices, with low seek times, would be less likely to require dirty neighbor flushing to be set. Since an attempt is made under Windows and Linux to determine SSD status which was exposed in . This variable is ignored for table spaces that are detected as stored on SSD (and the 0 behavior applies).
1: The default, flushes contiguous dirty pages in the same extent from the buffer pool.
innodb_flush_syncDescription: If set to ON, the default, the setting is ignored for I/O bursts occurring at checkpoints.
Command line: --innodb-flush-sync={0|1}
Scope: Global
Dynamic: Yes
innodb_flushing_avg_loopsDescription: Determines how quickly adaptive flushing will respond to changing workloads. The value is the number of iterations that a previously calculated flushing state snapshot is kept. Increasing the value smooths and slows the rate that the flushing operations change, while decreasing it causes flushing activity to spike quickly in response to workload changes.
Command line: --innodb-flushing-avg-loops=#
Scope: Global
innodb_force_load_corruptedDescription: Set to 0 by default, if set to 1, are permitted to load tables marked as corrupt. Only use this to recover data you can't recover any other way, or in troubleshooting. Always restore to 0 when the returning to regular use. Given that in aims to allow any metadata for a missing or corrupted table to be dropped, and given that and and related tasks made DDL operations crash-safe, the parameter no longer serves any purpose and was removed in .
Command line: --innodb-force-load-corrupted
innodb_force_primary_keyDescription: If set to 1 (0 is default) CREATE TABLEs without a primary or unique key where all keyparts are NOT NULL will not be accepted, and will return an error.
Command line: --innodb-force-primary-key
Scope: Global
innodb_force_recoveryDescription: crash recovery mode. 0 is the default. The other modes are for recovery purposes only, and no data can be changed while another mode is active. Some queries relying on indexes are also blocked. See for more on mode specifics.
Command line: --innodb-force-recovery=#
Scope: Global
innodb_foreground_preflushDescription: Before XtraDB 5.6.13-61.0, if the checkpoint age is in the sync preflush zone while a thread is writing to the , it will try to advance the checkpoint by issuing a flush list flush batch if this is not already being done. XtraDB has enhanced page cleaner tuning, and may already be performing furious flushing, resulting in the flush simply adding unneeded mutex pressure. Instead, the thread now waits for the flushes to finish, and then has two options, controlled by this variable. XtraDB only. Added as a deprecated and ignored option in (which uses InnoDB as default instead of XtraDB) to allow for easier upgrades.
exponential_backoff - thread sleeps while it waits for the flush list flush to occur. The sleep time randomly progressively increases, periodically reset to avoid runaway sleeps.
innodb_ft_aux_tableDescription: Diagnostic variable intended only to be set at runtime. It specifies the qualified name (for example test/ft_innodb) of an InnoDB table that has a , and after being set the INFORMATION_SCHEMA tables , , INNODB_FT_CONFIG, , and will contain search index information for the specified table.
Command line: --innodb-ft-aux-table=value
Scope: Global
innodb_ft_cache_sizeDescription: Cache size available for a parsed document while creating an InnoDB .
Command line: --innodb-ft-cache-size=#
Scope: Global
Dynamic: No
innodb_ft_enable_diag_printDescription: If set to 1, additional search diagnostic output is enabled.
Command line: --innodb-ft-enable-diag-print={0|1}
Scope: Global
Dynamic: Yes
innodb_ft_enable_stopwordDescription: If set to 1, the default, a set of is associated with an InnoDB when it is created. The stopword list comes from the table set by the session variable , if set, otherwise the global variable , if that is set, or the if neither variable is set.
Command line: --innodb-ft-enable-stopword={0|1}
Scope: Global
innodb_ft_max_token_sizeDescription: Maximum length of words stored in an InnoDB . A larger limit will increase the size of the index, slowing down queries, but permit longer words to be searched for. In most normal situations, longer words are unlikely search terms.
Command line: --innodb-ft-max-token-size=#
Scope: Global
Dynamic: No
innodb_ft_min_token_sizeDescription: Minimum length of words stored in an InnoDB . A smaller limit will increase the size of the index, slowing down queries, but permit shorter words to be searched for. For data stored in a Chinese, Japanese or Korean , a value of 1 should be specified to preserve functionality.
Command line: --innodb-ft-min-token-size=#
Scope: Global
innodb_ft_num_word_optimizeDescription: Number of words processed during each on an InnoDB . To ensure all changes are incorporated, multiple OPTIMIZE TABLE statements could be run in case of a substantial change to the index.
Command line: --innodb-ft-num-word-optimize=#
Scope: Global
Dynamic: Yes
innodb_ft_result_cache_limitDescription: Limit in bytes of the InnoDB query result cache per fulltext query. The latter stages of the full-text search are handled in memory, and limiting this prevents excess memory usage. If the limit is exceeded, the query returns an error.
Command line: --innodb-ft-result-cache-limit=#
Scope: Global
Dynamic: Yes
innodb_ft_server_stopword_tableDescription: Table name containing a list of stopwords to ignore when creating an InnoDB , in the format db_name/table_name. The specified table must exist before this option is set, and must be an InnoDB table with a single column, a named VALUE. See also .
Command line: --innodb-ft-server-stopword-table=db_name/table_name
Scope: Global
innodb_ft_sort_pll_degreeDescription: Number of parallel threads used when building an InnoDB . See also .
Command line: --innodb-ft-sort-pll-degree=#
Scope: Global
Dynamic: No
innodb_ft_total_cache_sizeDescription:Total memory allocated for the cache for all InnoDB tables. A force sync is triggered if this limit is exceeded.
Command line: --innodb-ft-total-cache-size=#
Scope: Global
Dynamic: No
innodb_ft_user_stopword_tableDescription: Table name containing a list of stopwords to ignore when creating an InnoDB , in the format db_name/table_name. The specified table must exist before this option is set, and must be an InnoDB table with a single column, a named VALUE. See also .
Command line: --innodb-ft-user-stopword-table=db_name/table_name
Scope: Session
innodb_ibuf_accel_rateDescription: Allows the insert buffer activity to be adjusted. The following formula is used: [real activity] = [default activity] * (innodb_io_capacity/100) * (innodb_ibuf_accel_rate/100). As innodb_ibuf_accel_rate is increased from its default value of 100, the lowest setting, insert buffer activity is increased. See also . This Percona XtraDB variable has not been ported to XtraDB 5.6.
Command line: innodb-ibuf-accel-rate=#
Scope: Global
innodb_ibuf_active_contractDescription: Specifies whether the insert buffer can be processed before it's full. If set to 0, the standard InnoDB method is used, and the buffer is not processed until it's full. If set to 1, the default, the insert buffer can be processed before it is full. This Percona XtraDB variable has not been ported to XtraDB 5.6.
Command line: innodb-ibuf-active-contract=#
Scope: Global
innodb_ibuf_max_sizeDescription: Maximum size in bytes of the insert buffer. Defaults to half the size of the so you may want to reduce if you have a very large buffer pool. If set to 0, the insert buffer is disabled, which will cause all secondary index updates to be performed synchronously, usually at a cost to performance. This Percona XtraDB variable has not been ported to XtraDB 5.6.
Command line: innodb-ibuf-max-size=#
Scope: Global
innodb_idle_flush_pctDescription: Up to what percentage of dirty pages should be flushed when innodb finds it has spare resources to do so. Has had no effect since merging InnoDB 5.7 from mysql-5.7.9 (). Deprecated in , , and removed in .
Command line: --innodb-idle-flush-pct=#
Scope: Global
innodb_immediate_scrub_data_uncompressedDescription: Enable scrubbing of data. See .
Command line: --innodb-immediate-scrub-data-uncompressed={0|1}
Scope: Global
Dynamic: Yes
innodb_import_table_from_xtrabackupDescription: If set to 1, permits importing of .ibd files exported with the --export option. Previously named innodb_expand_import. Removed in /XtraDB 5.6 and replaced with MySQL 5.6's transportable tablespaces.
Command line: innodb-import-table-from-xtrabackup=#
Scope: Global
innodb_instant_alter_column_allowedDescription:
If a table is altered using ALGORITHM=INSTANT, it can force the table to use a non-canonical format: A hidden metadata record at the start of the clustered index is used to store each column's DEFAULT value. This makes it possible to add new columns that have default values without rebuilding the table. Starting with , a BLOB in the hidden metadata record is used to store column mappings. This makes it possible to drop or reorder columns without rebuilding the table. This also makes it possible to add columns to any position or drop columns from any position in the table without rebuilding the table. If a column is dropped without rebuilding the table, old records will contain garbage in that column's former position, and new records are written with NULL values, empty strings, or dummy values.
This is generally not a problem. However, there may be cases where you want to avoid putting a table into this format. For example, to ensure that future UPDATE operations after an ADD COLUMN are performed in-place, to reduce write amplification. (Instantly added columns are essentially always variable-length.) Also avoid bugs similar to
innodb_instrument_semaphoresDescription: Enable semaphore request instrumentation. This could have some effect on performance but allows better information on long semaphore wait problems.
Command line: --innodb-instrument-semaphores={0|1}
Scope: Global
Dynamic: Yes
innodb_io_capacityDescription: Limit on I/O activity for InnoDB background tasks, including merging data from the insert buffer and flushing pages. Should be set to around the number of I/O operations per second that system can handle, based on the type of drive/s being used. You can also set it higher when the server starts to help with the extra workload at that time, and then reduce for normal use. Ideally, opt for a lower setting, as at higher value data is removed from the buffers too quickly, reducing the effectiveness of caching. See also .
See for more information.
Command line: --innodb-io-capacity=#
innodb_io_capacity_maxDescription: Upper limit to which InnoDB can extend in case of emergency. See for more information.
Command line: --innodb-io-capacity-max=#
Scope: Global
Dynamic: Yes
innodb_kill_idle_transactionDescription: Time in seconds before killing an idle XtraDB transaction. If set to 0 (the default), the feature is disabled. Used to prevent accidental user locks. XtraDB only. Added as a deprecated and ignored option in (which uses InnoDB as default instead of XtraDB) to allow for easier upgrades.
Scope: Global
Dynamic: Yes
Data Type:
innodb_large_prefixDescription: If set to 1, tables that use specific are permitted to have index key prefixes up to 3072 bytes (for 16k pages, ). If not set, the limit is 767 bytes.
This applies to the and row formats.
Removed in 10.3.1 and restored as a deprecated and unused variable in 10.4.3 for compatibility purposes.
innodb_lazy_drop_tableDescription: Deprecated and removed in XtraDB 5.6. processing can take a long time when is set to 1 and there's a large . If innodb_lazy_drop_table is set to 1 (0 is default), XtraDB attempts to optimize processing by deferring the dropping of related pages from the until there is time, only initially marking them.
Command line: innodb-lazy-drop-table={0|1}
innodb_lock_schedule_algorithmDescription: Removed in due to problems with the VATS implementation (). Specifies the algorithm that InnoDB uses to decide which of the waiting transactions should be granted the lock once it has been released. The possible values are: FCFS (First-Come-First-Served) where locks are granted in the order they appear in the lock queue and VATS (Variance-Aware-Transaction-Scheduling) where locks are granted based on the Eldest-Transaction-First heuristic. Note that VATS should not be used with , and InnoDB will refuse to start if VATS is used with Galera. It is also not recommended to set to VATS even in the general case (). From , the value was changed to FCFS and a warning produced when using Galera.
innodb_lock_wait_timeoutDescription: Time in seconds that an InnoDB transaction waits for an InnoDB record lock (or table lock) before giving up with the error ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction. When this occurs, the statement (not transaction) is rolled back. The whole transaction can be rolled back if the option is used. Increase this for data warehousing applications or where other long-running operations are common, or decrease for OLTP and other highly interactive applications. This setting does not apply to deadlocks, which InnoDB detects immediately, rolling back a deadlocked transaction. 0 means no wait. See . Setting to 100000000 or more (from , 100000000 is the maximum) means the timeout is infinite.
Command line: --innodb-lock-wait-timeout=#
innodb_locking_fake_changesDescription: From to , XtraDB-only option that if set to OFF, fake transactions (see ) don't take row locks. This is an experimental feature to attempt to deal with drawbacks in fake changes blocking real locks. It is not safe for use in all environments. Added as a deprecated and ignored option in (which uses InnoDB as default instead of XtraDB) to allow for easier upgrades.
Command line: --innodb-locking-fake-changes
Scope: Global
innodb_locks_unsafe_for_binlogDescription: Set to 0 by default, in which case XtraDB/InnoDB uses . If set to 1, gap locking is disabled for searches and index scans. Deprecated in , and removed in , use instead.
Command line: --innodb-locks-unsafe-for-binlog
Scope: Global
innodb_log_arch_dirDescription: The directory for archiving. XtraDB only. Added as a deprecated and ignored option in (which uses InnoDB as default instead of XtraDB) to allow for easier upgrades.
Command line: --innodb-log-arch-dir=name
Scope: Global
Dynamic: No
innodb_log_arch_expire_secDescription: Time in seconds since the last change after which the archived should be deleted. XtraDB only. Added as a deprecated and ignored option in (which uses InnoDB as default instead of XtraDB) to allow for easier upgrades.
Command line: --innodb-log-arch-expire-sec=#
Scope: Global
Dynamic: Yes
innodb_log_archiveDescription: Whether or not archiving is enabled. XtraDB only. Added as a deprecated and ignored option in (which uses InnoDB as default instead of XtraDB) to allow for easier upgrades.
Command line: --innodb-log-archive={0|1}
Scope: Global
Dynamic: Yes
innodb_log_block_sizeDescription: Size in bytes of the records. Generally 512, the default, or 4096, are the only two useful values. If the server is restarted and this value is changed, all old log files need to be removed. Should be set to 4096 for SSD cards or if is set to ALL_O_DIRECT on ext4 filesystems. XtraDB only. Added as a deprecated and ignored option in (which uses InnoDB as default instead of XtraDB) to allow for easier upgrades.
Command line: innodb-log-block-size=#
innodb_log_buffer_sizeDescription: Size in bytes of the buffer for writing files to disk. Increasing this means larger transactions can run without needing to perform disk I/O before committing.
Command line: --innodb-log-buffer-size=#
Scope: Global
Dynamic: No
innodb_log_checkpoint_nowDescription: Write back dirty pages from the and update the log checkpoint. Prior to , , was only available in debug builds. Introduced in order to force checkpoints before a backup, allowing mariadb-backup to create much smaller incremental backups. However, this comes at the cost of heavy I/O usage and it is now disabled by default.
Command line: --innodb-log-checkpoint{=1|0}
Scope: Global
innodb_log_checksum_algorithmDescription: Experimental feature (as of ), this variable specifies how to generate and verify checksums. XtraDB only. Added as a deprecated and ignored option in (which uses InnoDB as default instead of XtraDB) to allow for easier upgrades.
none - No checksum. A constant value is instead written to logs, and no checksum validation is performed.
innodb - The default, and the original InnoDB algorithm. This is inefficient, but compatible with all MySQL, MariaDB and Percona versions that don't support other checksum algorithms.
innodb_log_checksumsDescription: If set to 1, the CRC32C for Innodb or innodb_log_checksum_algorithm for XtraDB algorithm is used for pages. If disabled, the checksum field contents are ignored. From , the variable is deprecated, and checksums are always calculated, as previously, the InnoDB redo log used the slow innodb algorithm, but with hardware or SIMD assisted CRC-32C computation being available, there is no reason to allow checksums to be disabled on the redo log.
Command line: innodb-log-checksums={0|1}
Scope: Global
innodb_log_compressed_pagesDescription: Whether or not images of recompressed pages are stored in the . Deprecated and ignored from .
Command line: --innodb-log-compressed-pages={0|1}
Scope: Global
Dynamic: Yes
innodb_log_file_bufferingDescription: Whether the file system cache for ib_logfile0 is enabled. In , MariaDB disabled the file system cache on the InnoDB write-ahead log file (ib_logfile0) by default on Linux. With in particular, writing to the log via the file system cache typically improves throughput, especially on slow storage or at a small number of concurrent transactions. For other values of innodb_flush_log_at_trx_commit, direct writes were observed to be mostly but not always faster. Whether it pays off to disable the file system cache on the log may depend on the type of storage, the workload, and the operating system kernel version. If the server is started up with , the value are changed to ON. Will be set to OFF if is set to O_DSYNC. On Linux, when the physical block size cannot be determined to be a power of 2 between 64 and 4096 bytes, the file system cache cannot be disabled, and innodb_log_file_buffering=ON cannot be changed. Linux and Windows only.
Command line: --innodb-log-file-buffering={0|1}
innodb_log_file_mmapDescription: Whether ib_logfile0 resides in persistent memory or should initially be memory-mapped. When using the default innodb_log_buffer_size=2m, mariadb-backup --backup would spend a lot of time re-reading and re-parsing the log. For reading the log file during mariadb-backup --backup, it is beneficial to memory-map the entire ib_logfile0 to the address space (typically 48 bits or 256 TiB) and read it from there, both during --backup and --prepare. OFF by default on most platforms, to avoid aggressive read-ahead of the entire ib_logfile0 in when only a tiny portion would be accessed. On Linux and FreeBSD the default is innodb_log_file_mmap=ON, because those platforms define a specific mmap(2) option for enabling such read-ahead and therefore it can be assumed that the default wouldbe on-demand paging. This parameter will only have impact on the initial InnoDB startup and recovery. Any writes to the log will use regular I/O, except when the ib_logfile0 is stored in a specially configured file system that is backed by persistent memory (Linux "mount -o dax").
Command line: --innodb-log-file-mmap{=0|1}
innodb_log_file_sizeDescription: Size in bytes of each file in the log group. The combined size can be no more than 512GB. Larger values mean less disk I/O due to less flushing checkpoint activity, but also slower recovery from a crash. In , crash recovery has been improved and shouldn't run out of memory, so the default has been increased. It can safely be set higher to reduce checkpoint flushing, even larger than .From the variable is dynamic, and the server no longer needs to be restarted for the resizing to take place. Unless the log is located in a persistent memory file system (PMEM), an attempt to innodb_log_file_size to less than are refused. Log resizing can be aborted by killing the connection that is executing the SET GLOBAL statement.
Command line: --innodb-log-file-size=#
Scope: Global
innodb_log_file_write_throughDescription: Whether each write to ib_logfile0 is write through (disabling any caching, as in O_SYNC or O_DSYNC). Set to OFF by default, are set to ON if is set to O_DSYNC. On systems that support FUA it may make sense to enable write-through, to avoid extra system calls.
Command line: --innodb-log-file-write-through={0|1}
Scope: Global
innodb_log_files_in_groupDescription: Number of physical files in the . Deprecated and ignored from
Command line: --innodb-log-files-in-group=#
Scope: Global
Dynamic: No
innodb_log_group_home_dirDescription: Path to the files. If none is specified, files named ib_logfile0 and so on, with a size of are created in the data directory.
Command line: --innodb-log-group-home-dir=path
Scope: Global
Dynamic: No
innodb_log_optimize_ddlDescription: Whether activity should be reduced when natively creating indexes or rebuilding tables. Reduced logging requires additional page flushing and interferes with . Enabling this may slow down backup and cause delay due to page flushing. Deprecated and ignored from . Deprecated (but not ignored) from , and .
Command line: --innodb-log-optimize-ddl={0|1}
Scope: Global
innodb_log_spin_wait_delayDescription: Delay between log buffer spin lock polls (0 to use a blocking latch). Specifically, enables a spin lock that will execute that many MY_RELAX_CPU() operations (such as the x86 PAUSE instruction) between successive attempts of acquiring the spin lock. On some hardware with certain workloads (observed on write intensive workloads on NUMA systems), the default setting results in a significant amount of time being spent in native_queued_spin_lock_slowpath() in the Linux kernel, plus context switching between user and kernel address space, in which case changing from the default (for example, setting to 50), may result in a performance improvement.
Command line: --innodb-log-spin-wait-delay=#
Scope: Global
innodb_log_write_ahead_sizeDescription: write ahead unit size to avoid read-on-write. Should match the OS cache block IO size. Removed in , and instead on Linux and Windows, the physical block size of the underlying storage is detected and used. Reintroduced in and later versions. On Linux and Windows, the default or the specified innodb_log_write_ahead_size are automatically adjusted to not be less than the physical block size (if it can be determined).
Command line: --innodb-log-write-ahead-size=#
Scope: Global
innodb_lru_flush_sizeDescription: Number of pages to flush on LRU eviction. Changes in , , , , and made this setting superfluous, and it is no longer used.
Command line: --innodb-lru-flush-size=#
Scope: Global
innodb_lru_scan_depthDescription: Specifies how far down the buffer pool least-recently used (LRU) list the cleaning thread should look for dirty pages to flush. This process is performed once a second. In an I/O intensive-workload, can be increased if there is spare I/O capacity, or decreased if in a write-intensive workload with little spare I/O capacity.
See for more information.
Command line: --innodb-lru-scan-depth=#
innodb_max_bitmap_file_sizeDescription: Limit in bytes of the changed page bitmap files. For faster incremental backup with , XtraDB tracks pages with changes written to them according to the and writes the information to special changed page bitmap files. These files are rotated when the server restarts or when this limit is reached. XtraDB only. See also and .
Deprecated and ignored in (which uses InnoDB as default instead of XtraDB) to allow for easier upgrades.
Command line: innodb-max-bitmap-file-size=#
innodb_max_changed_pagesDescription: Limit to the number of changed page bitmap files (stored in the ). Zero is unlimited. See and . Previously named innodb_changed_pages_limit. XtraDB only.
Deprecated and ignored in (which uses InnoDB as default instead of XtraDB) to allow for easier upgrades.
Command line: innodb-max-changed-pages=#
innodb_max_dirty_pages_pctDescription: Maximum percentage of unwritten (dirty) pages in the buffer pool.
See for more information.
Command line: --innodb-max-dirty-pages-pct=#
Scope: Global
innodb_max_dirty_pages_pct_lwmDescription: Low water mark percentage of dirty pages that will enable preflushing to lower the dirty page ratio. The value 0 (default) means 'refer to '. (Note that 0 meant 0 in 10.5.7 to 10.5.8, but was then reverted back to "same as innodb_max_dirty_pages_pct" again in 10.5.9)
See for more information.
Command line: --innodb-max-dirty-pages-pct-lwm=#
innodb_max_purge_lagDescription: When purge operations are lagging on a busy server, setting innodb_max_purge_lag can help. By default set to 0, no lag, the figure is used to calculate a time lag for each INSERT, UPDATE, and DELETE when the system is lagging. InnoDB keeps a list of transactions with delete-marked index records due to UPDATE and DELETE statements. The length of this list is purge_lag, and the calculation, performed every ten seconds, is as follows: ((purge_lag/innodb_max_purge_lag)×10)–5 microseconds.
Command line: --innodb-max-purge-lag=#
Scope: Global
innodb_max_purge_lag_delayDescription: Maximum delay in milliseconds imposed by the setting. If set to 0, the default, there is no maximum.
Command line: --innodb-max-purge-lag-delay=#
Scope: Global
Dynamic: Yes
innodb_max_purge_lag_waitDescription: Wait until History list length is below the specified limit.
Command line: --innodb-max-purge-wait=#
Scope: Global
Dynamic: Yes
innodb_max_undo_log_sizeDescription: If an undo tablespace is larger than this, it is marked for truncation if is set.
Command line: --innodb-max-undo-log-size=#
Scope: Global
Dynamic: Yes
innodb_merge_sort_block_sizeDescription: Size in bytes of the block used for merge sorting in fast index creation. Replaced in /XtraDB 5.6 by .
Command line: innodb-merge-sort-block-size=#
Scope: Global
Dynamic: Yes
innodb_mirrored_log_groupsDescription: Unused. Restored as a deprecated and ignored option in (which uses InnoDB as default instead of XtraDB) to allow for easier upgrades.
Deprecated:
Removed: -
innodb_mtflush_threadsDescription: Sets the number of threads to use in Multi-Threaded Flush operations. For more information, see .
InnoDB's multi-thread flush feature was deprecated in and removed from . In later versions of MariaDB, use system variable instead.
See for more information.
innodb_monitor_disableDescription: Disables the specified counters in the table.
Command line: --innodb-monitor-disable=string
Scope: Global
Dynamic: Yes
innodb_monitor_enableDescription: Enables the specified counters in the table.
Command line: --innodb-monitor-enable=string
Scope: Global
Dynamic: Yes
innodb_monitor_resetDescription: Resets the count value of the specified counters in the table to zero.
Command line: --innodb-monitor-reset=string
Scope: Global
Dynamic: Yes
innodb_monitor_reset_allDescription: Resets all values for the specified counters in the table.
Command line: ---innodb-monitor-reset-all=string
Scope: Global
Dynamic: Yes
innodb_numa_interleaveDescription: Whether or not to use the NUMA interleave memory policy to allocate the . Before , required that MariaDB be compiled on a NUMA-enabled Linux system.
Command line: innodb-numa-interleave={0|1}
Scope: Global
Dynamic: No
innodb_old_blocks_pctDescription: Percentage of the to use for the old block sublist.
Command line: --innodb-old-blocks-pct=#
Scope: Global
Dynamic: Yes
innodb_old_blocks_timeDescription: Time in milliseconds an inserted block must stay in the old sublist after its first access before it can be moved to the new sublist. '0' means "no delay". Setting a non-zero value can help prevent full table scans clogging the . See also .
Command line: --innodb-old-blocks-time=#
Scope: Global
Dynamic: Yes
innodb_online_alter_log_max_sizeDescription: The maximum size for temporary log files during online DDL (data and index structure changes). The temporary log file is used for each table being altered, or index being created, to store data changes to the table while the process is underway. The table is extended by up to the limit set by this variable. If this limit is exceeded, the online DDL operation fails and all uncommitted changes are rolled back. A lower value reduces the time a table could lock at the end of the operation to apply all the log's changes, but also increases the chance of the online DDL changes failing.
Command line: --innodb-online-alter-log-max-size=#
Scope: Global
innodb_open_filesDescription: Maximum .ibd files MariaDB can have open at the same time. Only applies to systems with multiple XtraDB/InnoDB tablespaces, and is separate to the table cache and . The default, if is disabled, is 300 or the value of , whichever is higher. It will also auto-size up to the default value if it is set to a value less than 10.
Command line: --innodb-open-files=#
Scope: Global
innodb_optimize_fulltext_onlyDescription: When set to 1 (0 is default), will only process InnoDB data. Only intended for use during fulltext index maintenance.
Command line: --innodb-optimize-fulltext-only={0|1}
Scope: Global
innodb_page_cleanersDescription: Number of page cleaner threads. The default is 4, but the value are set to the number of if this is lower. If set to 1, only a single cleaner thread is used, as was the case until . Cleaner threads flush dirty pages from the , performing flush list and least-recently used (LRU) flushing. Deprecated and ignored from , as the original reasons for splitting the buffer pool have mostly gone away.
See for more information.
Command line:
innodb_page_sizeDescription: Specifies the page size in bytes for all InnoDB tablespaces. The default, 16k, is suitable for most uses.
A smaller InnoDB page size might work more effectively in a situation with many small writes (OLTP), or with SSD storage, which usually has smaller block sizes.
A larger InnoDB page size can provide a larger .
innodb_pass_corrupt_tableRemoved: XtraDB 5.5 - renamed .
innodb_prefix_index_cluster_optimizationDescription: Enable prefix optimization to sometimes avoid cluster index lookups. Deprecated and ignored from , as the optimization is now always enabled.
Command line: --innodb-prefix-index-cluster-optimization={0|1}
Scope: Global
Dynamic: Yes
innodb_print_all_deadlocksDescription: If set to 1 (0 is default), all InnoDB transaction deadlock information is written to the .
Command line: --innodb-print-all-deadlocks={0|1}
Scope: Global
innodb_purge_batch_sizeDescription: Number of pages to purge in one batch from the history list. Together with has a small effect on tuning.
Command line: --innodb-purge-batch-size=#
Scope: Global
Dynamic: No
innodb_purge_rseg_truncate_frequencyDescription: Frequency with which undo records are purged. Set by default to every 128 times, reducing this increases the frequency at which rollback segments are freed. See also . The motivation for introducing this in MySQL seems to have been to avoid stalls due to freeing undo log pages or truncating undo log tablespaces. In MariaDB, should be a much lighter operation because it will not involve any log checkpoint, hence this is deprecated and ignored from , , , , and . ()
Command line: -- innodb-purge-rseg-truncate-frequency=#
Scope: Global
innodb_purge_threadsDescription: Number of background threads dedicated to InnoDB purge operations. The range is 1 to 32. At least one background thread is always used. Setting to a value greater than 1 creates that many separate purge threads. This can improve efficiency in some cases, such as when performing DML operations on many tables. See also .
Command line: --innodb-purge-threads=#
Scope: Global
innodb_random_read_aheadDescription: Originally, random read-ahead was always set as an optimization technique, but was removed in . innodb_random_read_ahead permits it to be re-instated if set to 1 (0) is default.
Command line: --innodb-random-read-ahead={0|1}
Scope: Global
innodb_read_aheadDescription: If set to linear, the default, XtraDB/InnoDB will automatically fetch remaining pages if there are enough within the same extent that can be accessed sequentially. If set to none, read-ahead is disabled. random has been removed and is now ignored, while both sets to both linear and random. Also see for more control on read-aheads. Removed in /XtraDB 5.6 and replaced by MySQL 5.6's .
Command line: innodb-read-ahead=value
innodb_read_ahead_thresholdDescription: Minimum number of pages InnoDB must read sequentially from an extent of 64 before initiating an asynchronous read for the following extent.
Command line: --innodb-read-ahead-threshold=#
Scope: Global
Dynamic: Yes
innodb_read_io_threadsDescription: Prior to , this was simply the number of I/O threads for InnoDB reads. From , asynchronous I/O functionality in the InnoDB Background Thread Pool replaces the old InnoDB I/O Threads. This variable is now multiplied by 256 to determine the maximum number of concurrent asynchronous I/O read requests that can be completed by the Background Thread Pool. The default is therefore 4*256 = 1024 conccurrent asynchronous read requests. You may on rare occasions need to reduce this default on Linux systems running multiple MariaDB servers to avoid exceeding system limits, or increase if spending too much time waiting on I/O requests.
Command line: --innodb-read-io-threads=#
Scope: Global
innodb_read_onlyDescription: If set to 1 (0 is default), the server are read-only. For use in distributed applications, data warehouses or read-only media.
Command line: --innodb-read-only={0|1}
Scope: Global
innodb_read_only_compressedDescription: If set (the default before ), tables are read-only. This was intended to be the first step towards removing write support and deprecating the feature, but this plan has been abandoned.
Command line: --innodb-read-only-compressed, --skip-innodb-read-only-compressed
Scope: Global
innodb_recovery_statsDescription: If set to 1 (0 is default) and recovery is necessary on startup, the server will write detailed recovery statistics to the error log at the end of the recovery process. This Percona XtraDB variable has not been ported to XtraDB 5.6.
Command line: No
Scope: Global
innodb_recovery_update_relay_logDescription: If set to 1 (0 is default), the relay log info file are overwritten on crash recovery if the information differs from the InnoDB record. Should not be used if multiple storage engine types are being replicated. Previously named innodb_overwrite_relay_log_info. Removed in /XtraDB 5.6 and replaced by MySQL 5.6's relay-log-recovery
Command line: innodb-recovery-update-relay-log={0|1}
innodb_replication_delayDescription: Time in milliseconds for the replica server to delay the replication thread if is reached. Deprecated and ignored from .
Command line: --innodb-replication-delay=#
Scope: Global
Dynamic: Yes
innodb_rollback_on_timeoutDescription: InnoDB usually rolls back the last statement of a transaction that's been timed out (see ). If innodb_rollback_on_timeout is set to 1 (0 is default), InnoDB will roll back the entire transaction. Before , rolling back the entire transaction was the default behavior.
Command line: --innodb-rollback-on-timeout
Scope: Global
Dynamic: No
innodb_rollback_segmentsDescription: Specifies the number of rollback segments that XtraDB/InnoDB will use within a transaction (see ). Deprecated and replaced by in . Removed in as part of an InnoDB cleanup, as it makes sense to always create and use the maximum number of rollback segments. |
Command line: --innodb-rollback-segments=#
Scope: Global
innodb_safe_truncateDescription: Use a backup-safe implementation and crash-safe rename operations inside InnoDB. This is not compatible with hot backup tools other than . Users who need to use such tools may set this to OFF.
Command line: --innodb-safe-truncate={0|1}
Scope: Global
innodb_scrub_logDescription: Enable scrubbing. See . Deprecated and ignored from , as never really worked ( and ). If old log contents should be kept secret, then enabling or setting a smaller could help.
Command line: --innodb-scrub-log
Scope: Global
innodb_scrub_log_intervalDescription: Used with in 10.1.3 only - replaced in 10.1.4 by . scrubbing interval in milliseconds.
Command line: --innodb-scrub-log-interval=#
Scope: Global
Dynamic: Yes
innodb_scrub_log_speedDescription: scrubbing speed in bytes/sec. See . Deprecated and ignored from .
Command line: --innodb-scrub-log-speed=#
Scope: Global
Dynamic: Yes
innodb_sched_priority_cleanerDescription: Set a thread scheduling priority for cleaner and least-recently used (LRU) manager threads. The range from 0 to 39 corresponds in reverse order to Linux nice values of -20 to 19. So 0 is the lowest priority (Linux nice value 19) and 39 is the highest priority (Linux nice value -20). XtraDB only. Added as a deprecated and ignored option in (which uses InnoDB as default instead of XtraDB) to allow for easier upgrades.
innodb_show_locks_heldDescription: Specifies the number of locks held for each InnoDB transaction to be displayed in output. XtraDB only. Added as a deprecated and ignored option in (which uses InnoDB as default instead of XtraDB) to allow for easier upgrades.
Command line: innodb-show-locks-held=#
Scope: Global
Dynamic: Yes
innodb_show_verbose_locksDescription: If set to 1, and is also ON, the traditional InnoDB behavior is followed and locked records are shown in output. If set to 0, the default, only high-level information about the lock is shown. XtraDB only. Added as a deprecated and ignored option in (which uses InnoDB as default instead of XtraDB) to allow for easier upgrades.
Command line: innodb-show-verbose-locks=#
Scope: Global
innodb_simulate_comp_failuresDescription: Simulate compression failures. Used for testing robustness against random compression failures. XtraDB only.
Command line: None
Scope: Global
Dynamic: Yes
innodb_snapshot_isolationDescription: Use snapshot isolation (write-write conflict detection). If set, if an attempt to acquire a lock on a record that does not exist in the current read view is made, an error DB_RECORD_CHANGED (HA_ERR_RECORD_CHANGED, ER_CHECKREAD) are raised. This error are treated in the same way as a deadlock and the transaction are rolled back. When set, the default isolation level, arecome Snapshot Isolation. Prior to , the default is OFF for backwards compatibility.
Command line: --innodb-snapshot-isolation={0|1}
Scope: Global, Session
innodb_sort_buffer_sizeDescription: Size of the sort buffers used for sorting data when an InnoDB index is created, as well as the amount by which the temporary log file is extended during online DDL operations to record concurrent writes. The larger the setting, the fewer merge phases are required between buffers while sorting. When a or creates a new index, three buffers of this size are allocated, as well as pointers for the rows in the buffer.
Command line: --innodb-sort-buffer-size=#
Scope: Global
innodb_spin_wait_delayDescription: Maximum delay (not strictly corresponding to a time unit) between spin lock polls. Default changed from 6 to 4 in , as this was verified to give the best throughput by OLTP update index and read-write benchmarks on Intel Broadwell (2/20/40) and ARM (1/46/46).
Command line: --innodb-log-spin-wait-delay=#
Scope: Global
innodb_stats_auto_recalcDescription: If set to 1 (the default), persistent statistics are automatically recalculated when the table changes significantly (more than 10% of the rows). Affects tables created or altered with STATS_PERSISTENT=1 (see ), or when is enabled. determines how much data to sample when recalculating. See .
Command line: --innodb-stats-auto-recalc={0|1}
Scope: Global
innodb_stats_auto_updateDescription: If set to 0 (1 is default), index statistics will not be automatically calculated except when an is run, or the table is first opened. Replaced by in /XtraDB 5.6.
Scope: Global
Dynamic: Yes
innodb_stats_include_delete_markedDescription: Include delete marked records when calculating persistent statistics.
Scope: Global
Dynamic: Yes
Data Type: boolean
innodb_stats_methodDescription: Determines how NULLs are treated for InnoDB index statistics purposes.
nulls_equal: The default, all NULL index values are treated as a single group. This is usually fine, but if you have large numbers of NULLs the average group size is slanted higher, and the optimizer may miss using the index for ref accesses when it would be useful.
nulls_unequal: The opposite approach to nulls_equal is taken, with each NULL forming its own group of one. Conversely, the average group size is slanted lower, and the optimizer may use the index for ref accesses when not suitable.
innodb_stats_modified_counterDescription: The number of rows modified before we calculate new statistics. If set to 0, the default, current limits are used.
Command line: --innodb-stats-modified-counter=#
Scope: Global
Dynamic: Yes
innodb_stats_on_metadataDescription: If set to 1, the default, XtraDB/InnoDB updates statistics when accessing the INFORMATION_SCHEMA.TABLES or INFORMATION_SCHEMA.STATISTICS tables, and when running metadata statements such as or . If set to 0, statistics are not updated at those times, which can reduce the access time for large schemas, as well as make execution plans more stable.
Command line: --innodb-stats-on-metadata
Scope: Global
innodb_stats_persistentDescription: produces index statistics, and this setting determines whether they are stored on disk, or be required to be recalculated more frequently, such as when the server restarts. This information is stored for each table, and can be set with the STATS_PERSISTENT clause when creating or altering tables (see ). See .
Command line: --innodb-stats-persistent={0|1}
Scope: Global
innodb_stats_persistent_sample_pagesDescription: Number of index pages sampled when estimating cardinality and statistics for indexed columns. Increasing this value will increases index statistics accuracy, but use more I/O resources when running . See .
Command line: --innodb-stats-persistent-sample-pages=#
Scope: Global
Dynamic: Yes
innodb_stats_sample_pagesDescription: Gives control over the index distribution statistics by determining the number of index pages to sample. Higher values produce more disk I/O, but, especially for large tables, produce more accurate statistics and therefore make more effective use of the query optimizer. Lower values than the default are not recommended, as the statistics can be quite inaccurate.
If is enabled, then the exact number of pages configured by this system variable are sampled for statistics.
If is disabled, then the number of pages to sample for statistics is calculated using a logarithmic algorithm, so the exact number can change depending on the size of the table. This means that more samples may be used for larger tables.
innodb_stats_traditionalDescription: This system variable affects how the number of pages to sample for transient statistics is determined, in particular how is used.
If is enabled, then the exact number of pages configured by the system variable are sampled for statistics.
If is disabled, then the number of pages to sample for statistics is calculated using a logarithmic algorithm, so the exact number can change depending on the size of the table. This means that more samples may be used for larger tables.
innodb_stats_transient_sample_pagesDescription: Gives control over the index distribution statistics by determining the number of index pages to sample. Higher values produce more disk I/O, but, especially for large tables, produce more accurate statistics and therefore make more effective use of the query optimizer. Lower values than the default are not recommended, as the statistics can be quite inaccurate.
If is enabled, then the exact number of pages configured by this system variable are sampled for statistics.
If is disabled, then the number of pages to sample for statistics is calculated using a logarithmic algorithm, so the exact number can change depending on the size of the table. This means that more samples may be used for larger tables.
innodb_stats_update_need_lockDescription: Setting to 0 (1 is default) may help reduce contention of the &dict_operation_lock, but also disables the Data_free option in . This Percona XtraDB variable has not been ported to XtraDB 5.6.
Scope: Global
Dynamic: Yes
innodb_status_outputDescription: Enable output to the .
Command line: --innodb-status-output={0|1}
Scope: Global
Dynamic: Yes
innodb_status_output_locksDescription: Enable output to the and . Also requires to enable output to the error log.
Command line: --innodb-status-output-locks={0|1}
Scope: Global
Dynamic: Yes
innodb_strict_modeDescription: If set to 1 (the default), InnoDB will return errors instead of warnings in certain cases, similar to strict SQL mode. See for details.
Command line: --innodb-strict-mode={0|1}
Scope: Global, Session
innodb_support_xaDescription: If set to 1, the default, are supported. XA support ensures data is written to the in the same order to the actual database, which is critical for and disaster recovery, but comes at a small performance cost. If your database is set up to only permit one thread to change data (for example, on a replication replica with only the replication thread writing), it is safe to turn this option off. Removed in , XA transactions are always supported.
Command line: --innodb-support-xa
Scope: Global, Session
innodb_sync_array_sizeDescription: By default 1, can be increased to split internal thread co-ordinating, giving higher concurrency when there are many waiting threads.
Command line: --innodb-sync-array-size=#
Scope: Global
Dynamic: No
innodb_sync_spin_loopsDescription: The number of times a thread waits for an InnoDB mutex to be freed before the thread is suspended.
Command line: --innodb-sync-spin-loops=#
Scope: Global
Dynamic: Yes
innodb_table_locksDescription: If is set to 0 (1 is default), setting innodb_table_locks to 1, the default, will cause InnoDB to lock a table internally upon a .
Command line: --innodb-table-locks
Scope: Global, Session
innodb_thread_concurrencyDescription: Once this number of threads is reached (excluding threads waiting for locks), XtraDB/InnoDB will place new threads in a wait state in a first-in, first-out queue for execution, in order to limit the number of threads running concurrently. A setting of 0, the default, permits as many threads as necessary. A suggested setting is twice the number of CPU's plus the number of disks. Deprecated and ignored from .
Command line: --innodb-thread-concurrency=#
Scope: Global
innodb_thread_concurrency_timer_basedDescription: If set to 1, thread concurrency are handled in a lock-free timer-based manner rather than the default mutex-based method. Depends on atomic op builtins being available. This Percona XtraDB variable has not been ported to XtraDB 5.6.
Command line: innodb-thread-concurrency-timer-based={0|1}
Scope: Global
innodb_thread_sleep_delayDescription: Time in microseconds that InnoDB threads sleep before joining the queue. Setting to 0 disables sleep. Deprecated and ignored from
Command line: --innodb-thread-sleep-delay=#
Scope: Global
innodb_temp_data_file_pathDescription: Path where to store data for temporary tables. Argument is filename:size followed by options separated by ':' Multiple paths can be given separated by ';' A file size is specified (with K for kilobytes, M for megabytes and G for gigabytes). Also whether or not to autoextend the data file, max size and whether or not to on startup may also be specified.
Command line: --innodb-temp-data-file-path=path
innodb_tmpdirDescription: Allows an alternate location to be set for temporary non-tablespace files. If not set (the default), files are created in the usual location.
Alternate location must be outside of datadir
Command line: --innodb-tmpdir=path
Scope: Global
innodb_track_changed_pagesDescription: For faster incremental backup with , XtraDB tracks pages with changes written to them according to the and writes the information to special changed page bitmap files. This read-only variable is used for controlling this feature. See also and . XtraDB only. Added as a deprecated and ignored option in (which uses InnoDB as default instead of XtraDB) to allow for easier upgrades.
Command line: innodb-track-changed-pages={0|1}
Scope: Global
innodb_track_redo_log_nowDescription: Available on debug builds only. XtraDB only. Added as a deprecated and ignored option in (which uses InnoDB as default instead of XtraDB) to allow for easier upgrades.
Command line: innodb-track-redo-log-now={0|1}
Scope: Global
Dynamic: Yes
innodb_truncate_temporary_tablespace_nowDescription: Set to ON to shrink the temporary tablespace.
Command line: innodb-truncate-temporary-tablespace-now={0|1}
Scope: Global
Dynamic: Yes
innodb_undo_directoryDescription: Path to the directory (relative or absolute) that InnoDB uses to create separate tablespaces for the . . (the default value before 10.2.2) leaves the undo logs in the same directory as the other log files. From , the default value is NULL, and if no path is specified, undo tablespaces are created in the directory defined by . Use together with and . Undo logs are most usefully placed on a separate storage device.
Command line: --innodb-undo-directory=name
Scope: Global
innodb_undo_log_truncateDescription: When enabled, that are larger than are marked for truncation. See also . Enabling this setting may cause stalls during heavy write workloads.
Command line: --innodb-undo-log-truncate[={0|1}]
Scope: Global
Dynamic: Yes
innodb_undo_logsDescription: Specifies the number of rollback segments that XtraDB/InnoDB will use within a transaction (or the number of active ). By default set to the maximum, 128, it can be reduced to avoid allocating unneeded rollback segments. See the status variable for the number of undo logs available. See also and . Replaced in . The contains information about the XtraDB rollback segments. Deprecated and ignored in , as it always makes sense to use the maximum number of rollback segments.
Command line: --innodb-undo-logs=#
innodb_undo_tablespacesDescription: Number of tablespaces files used for dividing up the . Zero (the default before ) means that undo logs are all part of the system tablespace, which contains one undo tablespace more than the innodb_undo_tablespaces setting. A value of 1 is reset to 0 as 2 or more are needed for separate tablespaces. When the undo logs can grow large, splitting them over multiple tablespaces will reduce the size of any single tablespace. Until , must be set before InnoDB is initialized, or else MariaDB will fail to start, with an error saying that InnoDB did not find the expected number of undo tablespaces. The files are created in the directory specified by , and are named undoN, N being an integer. The default size of an undo tablespace is 10MB.From , multiple undo tablespaces are enabled by default, and the default is changed to 3 so that the space occupied by possible bursts of undo log records can be reclaimed after is set. Before , must have a non-zero setting for innodb_undo_tablespaces to take effect.
innodb_use_atomic_writesDescription: Implement atomic writes on supported SSD devices. See for other variables affected when this is set.
Command line: innodb-use-atomic-writes={0|1}
Scope: Global
Dynamic: No
innodb_use_fallocateDescription: Preallocate files fast, using operating system functionality. On POSIX systems, posix_fallocate system call is used.
Automatically set to 1 when is set - see .
See for more information.
innodb_use_global_flush_log_at_trx_commitDescription: Determines whether a user can set the variable . If set to 1, a user cannot reset the value with a SET command, while if set to 1, a user can reset the value of innodb_flush_log_at_trx_commit. XtraDB only. Added as a deprecated and ignored option in (which uses InnoDB as default instead of XtraDB) to allow for easier upgrades.
Command line: innodb-use-global-flush-log-at-trx_commit={0|1}
innodb_use_mtflushDescription: Whether to enable Multi-Threaded Flush operations. For more information, see Fusion.
InnoDB's multi-thread flush feature was deprecated in and removed from . In later versions of MariaDB, use system variable instead.
See for more information.
Command line:
innodb_use_native_aioDescription: For Linux systems only, specified whether to use Linux's asynchronous I/O subsystem. Set to ON by default, it may be changed to 0 at startup if InnoDB detects a problem, or from /, if a 5.11 - 5.15 Linux kernel is detected, to avoid an io-uring bug/incompatibility (). MariaDB-10.6.6/MariaDB-10.7.2 and later also consider 5.15.3+ as a fixed kernel and default to ON. To really benefit from the setting, the files should be opened in O_DIRECT mode (, default from ), to bypass the file system cache. In this way, the reads and writes can be submitted with DMA, using the InnoDB buffer pool directly, and no processor cycles need to be used for copying data.
Command line: --innodb-use-native-aio={0|1}
innodb_use_purge_threadDescription: Usually with InnoDB, data changed by a transaction is written to an undo space to permit read consistency, and freed when the transaction is complete. Many, or large, transactions, can cause the main tablespace to grow dramatically, reducing performance. This option, introduced in XtraDB 5.1 and removed for 5.5, allows multiple threads to perform the purging, resulting in slower, but much more stable performance.
Command line: --innodb-use-purge-thread=#
Scope: Global
innodb_use_stacktraceDescription: If set to ON (OFF is default), a signal handler for SIGUSR2 is installed when the InnoDB server starts. When a long semaphore wait is detected at sync/sync0array.c, a SIGUSR2 signal is sent to the waiting thread and thread that has acquired the RW-latch. For both threads a full stacktrace is produced as well as if possible. XtraDB only. Added as a deprecated and ignored option in (which uses InnoDB as default instead of XtraDB) to allow for easier upgrades.
Command line: --innodb-use-stacktrace={0|1}
Scope: Global
innodb_use_sys_mallocDescription: If set the 1, the default, XtraDB/InnoDB will use the operating system's memory allocator. If set to 0 it will use its own. Deprecated in and removed in along with InnoDB's internal memory allocator.
Command line: --innodb-use-sys-malloc={0|1}
Scope: Global
innodb_use_sys_stats_tableDescription: If set to 1 (0 is default), XtraDB will use the SYS_STATS system table for extra table index statistics. When a table is opened for the first time, statistics will then be loaded from SYS_STATS instead of sampling the index pages. Statistics are designed to be maintained only by running an . Replaced by MySQL 5.6's Persistent Optimizer Statistics.
Command line: innodb-use-sys-stats-table={0|1}
Scope: Global
innodb_use_trimDescription: Use trim to free up space of compressed blocks.
See for more information.
Command line: --innodb-use-trim={0|1}
Scope: Global
innodb_versionDescription: InnoDB version number. From , as the InnoDB implementation in MariaDB has diverged from MySQL, the MariaDB version is instead reported. For example, the InnoDB version reported in (which is based on MySQL 5.6) included encryption and variable-size page compression before MySQL 5.7 introduced them. (based on MySQL 5.7) introduced persistent AUTO_INCREMENT () in a GA release before MySQL 8.0. (based on MySQL 5.7) introduced instant ADD COLUMN () before MySQL.
Scope: Global
Dynamic: No
innodb_write_io_threadsDescription: Prior to , this was simply the number of I/O threads for InnoDB writes. From , asynchronous I/O functionality in the InnoDB Background Thread Pool replaces the old InnoDB I/O Threads. This variable is now multiplied by 256 to determine the maximum number of concurrent asynchronous I/O write requests that can be completed by the Background Thread Pool. The default is therefore 4*256 = 1024 conccurrent asynchronous write requests. You may on rare occasions need to reduce this default on Linux systems running multiple MariaDB servers to avoid exceeding system limits, or increase if spending too much time waiting on I/O requests.
Command line: --innodb-write-io-threads=#
Scope: Global
This page is licensed: CC BY-SA / Gnu FDL
Dynamic: No
Data Type: boolean
Default Value: OFF
estimate The default, and independent of innodb_io_capacity. If the oldest modified age exceeds 1/2 of the maximum age capacity, blocks are flushed every second at a rate determined by the number of modified blocks, LSN progress speed and the average age of all modified blocks.keep_average Attempts to keep the I/O rate constant by using a shorter loop cycle of one tenth of a second. Designed for SSD cards.
Command line: --innodb-adaptive-checkpoint=#
Scope: Global
Dynamic: Yes
Data Type: string
Default Value: estimate
Valid Values: none or 0, reflex or 1, estimate or 2, keep_average or 3
Removed: XtraDB 5.5 - replaced with innodb_adaptive_flushing_method
Dynamic: Yes
Data Type: boolean
Default Value: ON
Data Type: double
Default Value: 10.000000
Range: 0 to 70
Command line: innodb-adaptive-flushing-method=value
Scope: Global
Dynamic: Yes
Data Type: enumeration
Default Value: estimate
Valid Values: native or 0, estimate or 1, keep_average or 2
Removed: - replaced with InnoDB flushing method from MySQL 5.6
Dynamic: Yes
Data Type: boolean
Default Value: OFF (>= ), ON (<= )
Data Type: numeric
Default Value: 1
Range: 1 to 64
Data Type: numeric
Default Value: 8
Range: 1 to 512
Data Type: numeric
Default Value:
0 (>= )
150000 (<= )
Range: 0 to 1000000
Introduced:
Deprecated:
Removed: MariaDB 10.6.0
Data Type: numeric
Default Value: 8388608
Range: 2097152 to 4294967295
Deprecated:
Removed:
Default Value: ON
Introduced: MariaDB 10.11.9, , , MariaDB 11.4.3, ,
Data Type: numeric
Default Value: 5
Range: 1 to 1073741824
Introduced:
Removed:
Data Type: boolean
Default Value: OFF
Introduced:
Removed:
Data Type: boolean
Default Value: OFF
Introduced:
Removed:
Data Type: boolean
Default Value: OFF
Introduced:
Removed:
Data Type: numeric
Default Value: 0
Introduced:
Removed:
Data Type: numeric
Default Value: 64 (from ) 8 (before ),
Range: 1 to 1000
1 is the consecutive lock mode.2 is the interleaved lock mode.
In order to use Galera Cluster, the lock mode needs to be set to 2.
See AUTO_INCREMENT Handling in InnoDB: AUTO_INCREMENT Lock Modes for more information.
Command line: --innodb-autoinc-lock-mode=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: 1
Range: 0 to 2
Data Type: numeric
Default Value: 3600
Range: 1 to 4294967295
Deprecated:
Removed: MariaDB 10.6.0
Data Type: boolean
Default Value: 0
Deprecated:
Removed: MariaDB 10.6.0
Data Type: numeric
Default Value: 604800
Range: 1 to 4294967295
Deprecated:
Removed: MariaDB 10.6.0
Data Type: boolean
Default Value: 0
Deprecated:
Removed: MariaDB 10.6.0
Dynamic: No
Data Type: boolean
Default Value: OFF
Removed:
Dynamic: Yes
Data Type: numeric
Default Value: 0
Range: 0 to 100
Data Type: numeric
Default Value:
autosize (0), resulting in innodb_buffer_pool_size/64, if large_pages round down to multiple of largest page size, with 1MiB minimum (from )
134217728 (until )
Range:
0, as autosize, and then 1048576 to 18446744073709551615 (from )
1048576 to innodb_buffer_pool_size/innodb_buffer_pool_instances (until )
Block size: 1048576
Deprecated and ignored from MariaDB 10.11.12, MariaDB 11.4.6, MariaDB 11.8.2
Data Type: boolean
Default Value: ON
Data Type: boolean
Default Value: OFF
Introduced:
Data Type: boolean
Default Value:
25
Range: 1 to 100
Data Type: string
Default Value: ""
Valid Values: "" or "uncompressed"
Data Type: string
Default Value: ib_buffer_pool
Introduced:
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: >= : 8, 1 (>= if innodb_buffer_pool_size < 1GB), or dependent on innodb_buffer_pool_size (Windows 32-bit)
Deprecated:
Removed: MariaDB 10.6.0
Data Type: boolean
Default Value: OFF
Data Type: boolean
Default Value: ON
Data Type: boolean
Default Value: OFF
Data Type: numeric
Default Value: 9223372036854775807
Range: 1 to 9223372036854775807
Dynamic: No
Data Type: boolean
Default Value: OFF
Deprecated:
Removed:
Dynamic: Yes
Data Type: numeric
Default Value: 0
Range - 32 bit: 0 to 4294967295
Range - 64 bit: 0 to 18446744073709547520
Removed: - replaced by innodb_buffer_pool_load_at_startup
Data Type: boolean
Default Value: ON
Removed:
Data Type: boolean
Default Value: 0
Removed:
Data Type: numeric
Default Value: 134217728 (128MiB)
Range:
Minimum: 5242880 (5MiB ) for InnoDB Page Size <= 16k otherwise 25165824 (24MiB) for InnoDB Page Size > 16k (for versions less than next line)
Minimum: 2MiB InnoDB Page Size = 4k, 3MiB InnoDB Page Size = 8k, 5MiB = 16k, 10MiB = 32k, 20MiB = 64k, (>= , >= , >= , >= , >= , >= )
Minimum: 1GiB for > 1 (<= )
Maximum: 9223372036854775807 (8192PB) (all versions)
Block size: 1048576
Dynamic: Yes
Data Type: numeric
Default Value: 134217728 (128MiB)
Range: 0 to 18446744073701163008
Block size: 8388608 (8 MB on 64-bit systems)
Introduced: MariaDB 10.11.12, MariaDB 11.4.6, MariaDB 11.8.2
Data Type: numeric
Default Value: specified by the initial value of innodb_buffer_pool_size, rounded up to the block size of that variable. See the section about buffer pool changes in MariaDB 10.11.12, 11.4.6, and 11.8.2.
Range: 0 to 18446744073701163008
Block size: 8388608 (8 MB on 64-bit systems)
Introduced: MariaDB 10.11.12, MariaDB 11.4.6, MariaDB 11.8.2
Default Value: OFF
Introduced: , ,
Data Type: numeric
Default Value: 25
Range: 0 to 50
Introduced:
Deprecated:
Removed:
Data Type: enumeration (>= ), string (<= )
Default Value:
= , MariaDB 10.6.7, , :
none
<= , MariaDB 10.6.6, , :all
Valid Values: inserts, none, deletes, purges, changes, all
Deprecated:
Removed:
Dynamic: Yes
Data Type: numeric
Default Value: 0
Range: 0 to 2
Data Type: numeric
Default Value: 0
Range: 0 upwards
Removed: - replaced with InnoDB flushing method from MySQL 5.6.
full_crc32 and strict_full_crc32: From . Permits encryption to be supported over a SPATIAL INDEX, which crc32 does not support. Newly-created data files will carry a flag that indicates that all pages of the file will use a full CRC-32C checksum over the entire page contents (excluding the bytes where the checksum is stored, at the very end of the page). Such files will always use that checksum, no matter what parameter innodb_checksum_algorithm is assigned to. Even if innodb_checksum_algorithm is modified later, the same checksum will continue to be used. A special flag are set in the FSP_SPACE_FLAGS in the first data page to indicate the new format of checksum and encryption/page_compressed. ROW_FORMAT=COMPRESSED tables will only use the old format.
These tables do not support new features, such as larger innodb_page_size or instant ADD/DROP COLUMN. Also cleans up the MariaDB tablespace flags - flags are reserved to store the page_compressed compression algorithm, and to store the compressed payload length, so that checksum can be computed over the compressed (and possibly encrypted) stream and can be validated without decrypting or decompressing the page. In the full_crc32 format, there no longer are separate before-encryption and after-encryption checksums for pages. The single checksum is computed on the page contents that is written to the file.See MDEV-12026 for details.
none: Writes a constant rather than calculate a checksum. Deprecated in , , and removed in MariaDB 10.6 as was mostly used to disable the original, slow, page checksum for benchmarking purposes.
strict_crc32, strict_innodb and strict_none: The options are the same as the regular options, but InnoDB will halt if it comes across a mix of checksum values. These are faster, as both new and old checksum values are not required, but can only be used when setting up tablespaces for the first time.
Command line: --innodb-checksum-algorithm=#
Scope: Global
Dynamic: Yes
Data Type: enumeration
Default Value:
full_crc32 (>= )
crc32 (>= to <= )
innodb (<= )
Valid Values:
= MariaDB 10.6.0:
crc32,full_crc32,strict_crc32,strict_full_crc32
, >= : innodb, crc32, full_crc32, none, strict_innodb, strict_crc32, strict_none, strict_full_crc32
<= : innodb, crc32, none, strict_innodb, strict_crc32, strict_none
--skip-innodb-checksumsScope: Global
Dynamic: No
Data Type: boolean
Default Value: ON
Deprecated:
Removed:
Dynamic: Yes
Data Type: enum
Default Value:
deprecated
Valid Values:
deprecated, high_checkpoint, legacy
Deprecated:
Removed:
Dynamic: Yes
Data Type: boolean
Default Value: OFF
Introduced:
Data Type: numeric
Default Value: 0
Range: 0 to 1000
Deprecated:
Removed: MariaDB 10.6.0
lz4: Pages are compressed using the lz4 compression algorithm.lzo: Pages are compressed using the lzo compression algorithm.
lzma: Pages are compressed using the lzma compression algorithm.
bzip2: Pages are compressed using the bzip2 compression algorithm.
snappy: Pages are compressed using the snappy algorithm.
On many distributions, MariaDB may not support all page compression algorithms by default. From , libraries can be installed as a plugin. See Compression Plugins.
See InnoDB Page Compression: Configuring the InnoDB Page Compression Algorithm for more information.
Command line: --innodb-compression-algorithm=value
Scope: Global
Dynamic: Yes
Data Type: enum
Default Value: zlib
Valid Values:none, zlib, lz4, lzo, lzma, bzip2 or snappy
--innodb-compression-default={0|1}Scope: Global, Session
Dynamic: Yes
Data Type: boolean
Default Value: OFF
Scope: Global
Dynamic: Yes
Data Type: numeric
Default Value: 5
Range: 0 to 100
Introduced:
19See InnoDB Page Compression: Configuring the Default Compression Level for more information.
Command line: --innodb-compression-level=#
Scope: Global
Dynamic: Yes
Data Type: numeric
Default Value: 6
Range: 1 to 9
Introduced:
Scope: Global
Dynamic: Yes
Data Type: numeric
Default Value: 50
Range: 0 to 75
Introduced:
Data Type: numeric
Default Value:
0 (>= )
5000 (<= )
Range: 1 to 18446744073709551615
Deprecated:
Removed: MariaDB 10.6.0
If set to salvage, read access is permitted, but corrupted pages are ignored. innodb_file_per_table must be enabled for this option. Previously named innodb_pass_corrupt_table.
Added as a deprecated and ignored option in (which uses InnoDB as default instead of XtraDB) to allow for easier upgrades.
Command line: innodb-corrupt-table-action=value
Scope: Global
Dynamic: Yes
Data Type: enumeration
Default Value:
assert (<= )
deprecated (<= )
Valid Values:
deprecated, assert, warn, salvage
Deprecated:
Removed:
Scope: Global
Dynamic: Yes
Data Type: boolean
Default Value: OFF
Introduced:
Dynamic: No
Data Type: numeric
Default Value: ibdata1:12M:autoextend (from ), ibdata1:10M:autoextend (before )
Dynamic: Yes
Data Type: boolean
Default Value: OFF
Introduced:
Data Type: directory name
Default Value: The MariaDB data directory
Data Type: boolean
Default Value: 1
full: Default. Report transactions, waiting locks and blocking locks.Command line: --innodb-deadlock-report=val
Scope: Global
Dynamic: Yes
Data Type: enum
Default Value: full
Valid Values: off, basic, full
Introduced: MariaDB 10.6.0
Dynamic: Yes
Data Type: numeric
Default Value: 1
Range: 1 to 255
Introduced:
Removed:
Dynamic: Yes
Data Type: numeric
Default Value: 1
Range: 1 to 4294967295
Dynamic: Yes
Data Type: enum
Default Value: dynamic
Valid Values: redundant, compact or dynamic
Dynamic: Yes
Data Type: boolean
Default Value: OFF
Deprecated:
Removed:
Data Type: double
Default Value: 0.9
Range: 0.7 to 1
Deprecated:
Removed:
Data Type: numeric
Default Value: 20
Range: 1 to 100
Deprecated:
Removed:
Data Type: integer
Default Value: 40
Range: 1 to 1000
Deprecated:
Removed:
Data Type: numeric
Default Value: 7
Range: 2 to 32
Deprecated:
Removed:
Data Type: numeric
Default Value: 0
Range: 0 to 4294967295
Deprecated:
Removed:
Dynamic: Yes
Data Type: numeric
Default Value: 0
Default Value - 32 bit: 2147483648
Default Value - 64 bit: 9223372036854775807
Removed: - replaced by MySQL 5.6's table_definition_cache implementation.
Data Type: boolean
Default Value: OFF
booleanDefault Value: OFF
Removed: , , , MariaDB 10.6.8,
The setting innodb_doublewrite=fast could be safe when the doublewrite buffer (the first file of the system tablespace) and the data files reside in the same file system.
Command line: --innodb-doublewrite{=val}, --skip-innodb-doublewrite
Scope: Global
Dynamic: Yes
Data Type: enum
Default Value: ON
Valid Values: OFF, ON, fast
Description: If set to 1, the default, to improve fault tolerance InnoDB first stores data to a doublewrite buffer before writing it to data file. Disabling will provide a marginal performance improvement.
Command line: --innodb-doublewrite, --skip-innodb-doublewrite
Scope: Global
Dynamic:No
Data Type: boolean
Default Value: ON
Data Type: filename
Default Value: NULL
Removed:
Scope: Global
Dynamic: Yes
Data Type: enum
Default Value:
deprecated
Valid Values:
deprecated, backoff, legacy
Deprecated:
Removed:
Dynamic: Yes
Data Type: numeric
Default Value: 0
Range: 0 to 1
Removed: Not needed after XtraDB 1.0.5
Dynamic: No
Data Type: boolean
Default Value: OFF
FORCE - Enables table encryption for all new and existing tables that have the ENCRYPTED table option set to DEFAULT, and doesn't allow unencrypted tables to be created (CREATE TABLE ... ENCRYPTED=NO will fail).
See Data-at-Rest Encryption and Enabling InnoDB Encryption: Enabling Encryption for Automatically Encrypted Tablespaces for more information.
Command line: --innodb-encrypt-tables={0|1}
Scope: Global
Dynamic: Yes
Data Type: boolean
Default Value: OFF
Valid Values: ON, OFF, FORCE
Dynamic: No
Data Type: boolean
Default Value: OFF
Valid Values: ON, OFF
Introduced: , ,
Scope: Global
Dynamic: Yes
Data Type: numeric
Default Value: 1
Range: 0 to 4294967295
Dynamic: Yes
Data Type: numeric
Default Value: 100
Range: 0 to 4294967295
Scope: Global
Dynamic: Yes
Data Type: numeric
Default Value: 0
Range:
0 to 4294967295 (<= , , , , )
0 to 255 (>= , , , , )
Data Type: numeric
Default Value: 0
Range: 0 to 126
Removed: XtraDB 5.5 - replaced by innodb_rollback_segments
Dynamic: No
Data Type: boolean
Default Value: OFF
Removed: XtraDB 5.5
Dynamic: Yes
Data Type: boolean
Default Value: OFF
Deprecated:
Removed:
Scope: Global
Dynamic: No
Data Type: boolean
Default Value: OFF
Removed: /XtraDB 5.6 - replaced with innodb_checksum_algorithm
2, the InnoDB redo log is flushed and a cold shutdown takes place, similar to a crash. The resulting startup then performs crash recovery. Extremely fast, in cases of emergency, but risks corruption. Not suitable for upgrades between major versions!
3 (from ) - active transactions will not be rolled back, but all changed pages are written to data files. The active transactions are rolled back by a background thread on a subsequent startup. The fastest option that will not involve InnoDB redo log apply on subsequent startup. See MDEV-15832.
Command line: --innodb-fast-shutdown[=#]
Scope: Global
Dynamic: Yes
Data Type: numeric
Default Value: 1
Range: 0 to 3 (>= ), 0 to 2 (<= )
Data Type: numeric
Default Value: 600
Range: 1 to 4294967295
Dynamic: Yes
Data Type: string
Default Value:
Barracuda
Valid Values: Antelope, Barracuda
Deprecated:
Removed:
Re-introduced: (for compatibility purposes)
Removed: MariaDB 10.6.0
Dynamic: No
Data Type: boolean
Default Value: ON
Deprecated:
Removed:
Data Type: string
Default Value: Antelope
Valid Values: Antelope, Barracuda
Deprecated:
Removed:
Scope: Global
Dynamic: Yes
Data Type: boolean
Default Value: ON
Deprecated:
Data Type: numeric
Default Value: 100
Range: 10 to 100
Default Value: 1
Range: 0 to 2700
2 The log buffer is written to the InnoDB redo log after each commit, but flushing takes place every innodb_flush_log_at_timeout seconds (by default once a second). Performance is slightly better, but a OS or power outage can cause the last second's transactions to be lost.
3 Emulates group commit (3 syncs per group commit). See Binlog group commit and innodb_flush_log_at_trx_commit. This option has not been working correctly since 10.2 and may be removed in future, see 1873
Command line: --innodb-flush-log-at-trx-commit[=#]
Scope: Global
Dynamic: Yes
Data Type: enumeration
Default Value: 1
Valid Values: 0, 1, 2 or 3
fsync - Default on Unix until . Can be specified directly, but if the variable is unset on Unix, fsync() are used by default.
O_DIRECT_NO_FSYNC - introduced in . Uses O_DIRECT during flushing I/O, but skips fsync() afterwards. Not suitable for XFS filesystems. Generally not recommended over O_DIRECT, as does not get the benefit of innodb_use_native_aio=ON.
ALL_O_DIRECT - introduced in and available with XtraDB only. Uses O_DIRECT for opening both data and logs and fsync() to flush data but not logs. Use with large InnoDB files only, otherwise may cause a performance degradation. Set innodb_log_block_size to 4096 on ext4 filesystems. This is the default log block size on ext4 and will avoid unaligned AIO/DIO warnings.
unbuffered - Windows-only default
async_unbuffered - Windows-only, alias for unbuffered
normal - Windows-only, alias for fsync
littlesync - for internal testing only
nosync - for internal testing only
Deprecated in and replaced by four boolean dynamic variables that can be changed while the server is running: innodb_log_file_buffering (disable O_DIRECT, added by MDEV-28766 in 10.8.4, 10.9.2), innodb_data_file_buffering (disable O_DIRECT on data files), innodb_log_file_write_through (enable O_DSYNC on the log), innodb_data_file_write_through (enable O_DSYNC on persistent data files) From , if set to one of the following values, then the values of the four boolean flags are set as follows:
O_DSYNC: innodb_log_file_write_through=ON, innodb_data_file_write_through=ON,innodb_data_file_buffering=OFF, and (if supported) innodb_log_file_buffering=OFF.
fsync, littlesync, nosync, or (Microsoft Windows specific) normal: , , and .
Command line: --innodb-flush-method=name
Scope: Global
Dynamic: No
Data Type: enumeration (>= ), string (<= )
Default Value:
O_DIRECT (Unix, >= MariaDB 10.6.0)
fsync (Unix, >= , <= )
Not set (<= )
Valid Values:
Unix: fsync, O_DSYNC, littlesync, nosync. O_DIRECT, O_DIRECT_NO_FSYNC
Windows: unbuffered, async_unbuffered, normal
Deprecated:
Scope: Global
Dynamic: Yes
Data Type: enumeration
Default Value: area
Valid Values: none or 0, area or 1, cont or 2
Removed: /XtraDB 5.6 - replaced by innodb_flush_neighbors
0: No other dirty pages are flushed.2: Flushes dirty pages in the same extent from the buffer pool.
Command line: --innodb-flush-neighbors=#
Scope: Global
Dynamic: Yes
Data Type: enumeration
Default Value: 1
Valid Values: 0, 1, 2
Data Type: boolean
Default Value: ON
Data Type: numeric
Default Value: 30
Range: 1 to 1000
Scope: Global
Dynamic: No
Data Type: boolean
Default Value: OFF
Removed: MariaDB 10.6.6
Dynamic: Yes
Data Type: boolean
Default Value: OFF
Data Type: enumeration
Default Value: 0
Range: 0 to 6
sync_preflushCommand line: innodb-foreground-preflush=value
Scope: Global
Dynamic: Yes
Data Type: enum
Default Value:
deprecated
Valid Values:
deprecated, exponential_backoff, sync_preflush
Deprecated:
Removed:
Dynamic: Yes
Data Type: string
Data Type: numeric
Default Value: 8000000
Data Type: boolean
Default Value: OFF
Dynamic: Yes
Data Type: boolean
Default Value: ON
Data Type: numeric
Default Value: 84
Range: 10 to 84
Data Type: numeric
Default Value: 3
Range: 1 to 16
Data Type: numeric
Default Value: 2000
Range: 1000 to 10000
Data Type: numeric
Default Value: 2000000000
Range: 1000000 to 18446744073709551615
Data Type: string
Default Value: Empty
Data Type: numeric
Default Value: 2
Range: 1 to 32
Data Type: numeric
Default Value: 640000000
Range: 32000000 to 1600000000
Introduced:
Data Type: string
Default Value: Empty
Dynamic: Yes
Data Type: numeric
Default Value: 100
Range: 100 to 999999999
Removed:
Dynamic: Yes
Data Type: numeric
Default Value: 1
Range: 0 to 1
Removed:
Dynamic: No
Data Type: numeric
Default Value: 1/2 the size of the InnoDB buffer pool
Range: 0 to 1/2 the size of the InnoDB buffer pool
Removed:
Data Type: numeric
Default Value: 100
Range: 0 to 100
Deprecated: , ,
Removed:
Data Type: boolean
Default Value: OFF
Dynamic: Yes
Data Type: numeric
Default Value: 0
Range: 0 to 1
Removed:
This variable has been introduced as a result, with the following values:
never (0): Do not allow instant add/drop/reorder,
to maintain format compatibility with MariaDB 10.x and MySQL 5.x.
If the table (or partition) is not in the canonical format, then
any ALTER TABLE (even one that does not involve instant column
operations) will force a table rebuild.
add_last (1, default in 10.3): Store a hidden metadata record that
allows columns to be appended to the table instantly (MDEV-11369).
In 10.4 or later, if the table (or partition) is not in this format,
then any ALTER TABLE (even one that does not involve column changes)
will force a table rebuild.
add_drop_reorder (2, default): From only. Like 'add_last', but allow the
metadata record to store a column map, to support instant
add/drop/reorder of columns.
Command line: --innodb-instant-alter-column-allowed=value
Scope: Global
Dynamic: Yes
Data Type: enum
Valid Values:
<= : never, add_last
= :
never,add_last,add_drop_reorder
Default Value:
<= : add_last
= :
add_drop_reorder
Introduced: , ,
Data Type: boolean
Default Value: OFF
Deprecated: (treated as if OFF)
Removed:
Scope: Global
Dynamic: Yes
Data Type: numeric
Default Value: 200
Range: 100 to 18446744073709551615 (264-1)
Data Type: numeric
Default Value: 2000 or twice innodb_io_capacity, whichever is higher.
Range : 100 to 18446744073709551615 (264-1)
numericDefault Value: 0
Range: 0 to 9223372036854775807
Deprecated:
Removed:
Command line: --innodb-large-prefix
Scope: Global
Dynamic: Yes
Data Type: boolean
Default Value:
ON
Deprecated:
Removed:
Re-introduced: (for compatibility purposes)
Removed: MariaDB 10.6.0
Dynamic: Yes
Data Type: boolean
Default Value: 0
Deprecated: XtraDB 5.5.30-30.2
Removed:
Command line: --innodb-lock-schedule-algorithm=#
Scope: Global
Dynamic: No (>= , ), Yes (<= , )
Data Type: enum
Valid Values: FCFS, VATS
Default Value: FCFS (, ), VATS (), FCFS ()
Deprecated: , , ,
Removed: MariaDB 10.6.0
Scope: Global, Session
Dynamic: Yes
Data Type: INT UNSIGNED (>= MariaDB 10.6.3), BIGINT UNSIGNED (<= MariaDB 10.6.2)
Default Value: 50
Range:
0 to 100000000 (>= MariaDB 10.6.3)
0 to 1073741824 (>= to <= MariaDB 10.6.2)
Dynamic: Yes
Data Type: boolean
Default Value: ON
Deprecated:
Removed:
Dynamic: No
Data Type: boolean
Default Value: OFF
Deprecated:
Removed:
Data Type: string
Default Value: ./
Deprecated:
Removed:
Data Type: numeric
Default Value: 0
Deprecated:
Removed:
Data Type: boolean
Default Value: OFF
Deprecated:
Removed:
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: 512
Deprecated:
Removed:
Data Type: numeric
Default Value: 16777216 (16MB)
Range: 262144 to 2147479552 (256KB to 2GB - 4K) (>= MariaDB 10.11.8)
Range: 262144 to 18446744073709551615 (<= MariaDB 10.11.7) - limit to the above maximum because this is an operating system limit.
Block size: 4096
Data Type: boolean
Default Value: OFF
Introduced: MariaDB 10.11.12, MariaDB 11.4.6, MariaDB 11.8.2
crc32 - CRC32© is used for log block checksums, which also permits recent CPUs to use hardware acceleration (on SSE4.2 x86 machines and Power8 or later) for the checksums.
strict_* - Whether or not to accept checksums from other algorithms. If strict mode is used, checksums blocks are considered corrupt if they don't match the specified algorithm. Normally they are considered corrupt only if no other algorithm matches.
Command line: innodb-log-checksum-algorithm=value
Scope: Global
Dynamic: Yes
Data Type: enum
Default Value:
deprecated (>= )
innodb (<= )
Valid Values:
deprecated, innodb, none, crc32, strict_none, strict_innodb, strict_crc32 (>= )
innodb, none, crc32, strict_none, strict_innodb, strict_crc32 (<= )
Deprecated:
Removed:
Dynamic: Yes
Data Type: boolean
Default Value: ON
Deprecated:
Removed: MariaDB 10.6.0
Data Type: boolean
Default Value:
ON
Deprecated:
Removed: MariaDB 10.6.0
Scope: Global
Dynamic: Yes
Data Type: boolean
Default Value: OFF
Introduced: MariaDB 10.8.4, MariaDB 10.9.2
Dynamic: No
Data Type: boolean
Default Value: ON (Linux, FreeBSD), OFF (Other platforms)
Introduced: MariaDB 10.11.10, , MariaDB 11.4.4, ,
Dynamic: Yes (>= ), No (<= )
Data Type: numeric
Default Value: 100663296 (96MB) (>= ), 50331648 (48MB) (<= )
Range:
= :
4194304to512GB(4MB to 512GB)
<= : 1048576 to 512GB (1MB to 512GB)
Block size: 4096
Dynamic: Yes
Data Type: boolean
Default Value: OFF
Introduced:
Data Type: numeric
Default Value: 1 (>= ), 2 (<= )
Range: 1 to 100 (>= )
Deprecated:
Removed: MariaDB 10.6.0
Data Type: directory name
Data Type: boolean
Default Value:
OFF (>= , , , )
ON (<= , , , )
Introduced: ,
Deprecated: , , ,
Removed: MariaDB 10.6.0
Dynamic: Yes
Data Type: numeric
Default Value: 0
Range: 0 to 6000
Introduced: MariaDB 10.11.8, , , , MariaDB 11.4.2,
Data Type: numeric
Default Value: 512 (>= MariaDB 10.11.9), 8192 (<= )
Range:
512 to 4096 (>= MariaDB 10.11.9)
512 to innodb_page_size (<= )
Removed:
Re-introduced: MariaDB 10.11.9, , , MariaDB 11.4.3,
Data Type: numeric
Default Value:
0 (>=MariaDB 10.6.20, MariaDB 10.11.10, , MariaDB 11.4.4. , )
32 (<= MariaDB 10.6.19, MariaDB 10.11.9, , MariaDB 11.4.3)
Range: 1 to 18446744073709551615
Introduced:
Deprecated: MariaDB 10.6.20, MariaDB 10.11.10, and MariaDB 11.4.4. ,
Dynamic: Yes
Data Type: numeric
Default Value:
1536 (>= )
1024 (<= )
Range - 32bit: 100 to 2^32-1
Range - 64bit: 100 to 2^64-1
Scope: Global
Dynamic: Yes
Data Type: numeric
Default Value: 4096 (4KB)
Range: 4096 (4KB) to 18446744073709551615 (16EB)
Deprecated:
Scope: Global
Dynamic: Yes
Data Type: numeric
Default Value: 1000000
Range: 0 to 18446744073709551615
Deprecated:
Dynamic: Yes
Data Type: numeric
Default Value:
90.000000 (>= )
75.000000 (<= )
Range: 0 to 99.999
Dynamic: Yes
Data Type: numeric
Default Value:
0 (>= )
0.001 (<= )
Range: 0 to 99.999
Dynamic: Yes
Data Type: numeric
Default Value: 0
Range: 0 to 4294967295
Data Type: numeric
Default Value: 0
Data Type: numeric
Default Value: 4294967295
Range: 0 to 4294967295
Introduced: , , ,
Data Type: numeric
Default Value:
10485760
Range: 10485760 to 18446744073709551615
Data Type: numeric
Default Value: 1048576 (1M)
Range: 1048576 (1M) to 1073741824 (1G)
Removed: - replaced by innodb_sort_buffer_size
--innodb-mtflush-threads=#Scope: Global
Dynamic: No
Data Type: numeric
Default Value: 8
Range: 1 to 64
Deprecated:
Removed:
Data Type: string
Data Type: string
Data Type: string
Data Type: string
Data Type: boolean
Default Value: OFF
Removed: , ,
Data Type: numeric
Default Value: 37
Range: 5 to 95
Data Type: numeric
Default Value: 1000
Range: 0 to 2^32-1
Dynamic: Yes
Data Type: numeric
Default Value: 134217728
Range: 65536 to 2^64-1
Dynamic: No
Data Type: numeric
Default Value: autosized
Range: 10 to 4294967295
Dynamic: Yes
Data Type: boolean
Default Value: OFF
--innodb-page-cleaners=#Scope: Global
Dynamic: Yes (>= ), No (<= )
Data Type: numeric
Default Value: 4 (or set to innodb_buffer_pool_instances if lower)
Range: 1 to 64
Deprecated:
Removed: MariaDB 10.6.0
64k for tables using the following row formats: DYNAMIC, COMPACT, and REDUNDANT.InnoDB's page size must still be 16k or less for tables using the COMPRESSED row format.
This system variable's value cannot be changed after the datadir has been initialized. InnoDB's page size is set when a MariaDB instance starts, and it remains constant afterwards.
Command line: --innodb-page-size=#
Scope: Global
Dynamic: No
Data Type: enumeration
Default Value: 16384
Valid Values: 4k or 4096, 8k or 8192, 16k or 16384, 32k and 64k.
Data Type: boolean
Default Value: OFF
Deprecated:
Data Type: boolean
Default Value: OFF
Data Type: numeric
Default Value:
127 (>= MariaDB 10.6.20, MariaDB 10.11.10, , MariaDB 11.4.4, )
1000 (>= MariaDB 10.6.16, , MariaDB 10.11.6, , )
300 (<= , , , , )
Range: 1 to 5000
Dynamic: Yes
Data Type: numeric
Default Value: 128
Range: 1 to 128
Deprecated: MariaDB 10.6.16, , MariaDB 10.11.6, , ,
Dynamic: No
Data Type: numeric
Default Value: 4
Range: 1 to 32
Dynamic: Yes
Data Type: boolean
Default Value: OFF
Scope: Global
Dynamic: Yes
Data Type: enumeration
Default Value: linear
Valid Values: none, random, linear, both
Removed: /XtraDB 5.6 - replaced by MySQL 5.6's innodb_random_read_ahead
Data Type: numeric
Default Value: 56
Range: 0 to 64
Dynamic: Yes (>= MariaDB 10.11), No (<= )
Data Type: numeric
Default Value: 4
Range: 1 to 64
Data Type: boolean
Default Value: OFF
Data Type: boolean
Default Value: OFF (>= MariaDB 10.6.6), ON (<= MariaDB 10.6.5)
Introduced: MariaDB 10.6.0
Data Type: boolean
Default Value: OFF
Removed:
Dynamic: No
Data Type: boolean
Default Value: OFF
Removed: - replaced by MySQL 5.6's relay-log-recovery
Data Type: numeric
Default Value: 0
Range: 0 to 4294967295
Deprecated:
Removed: MariaDB 10.6.0
Data Type: boolean
Default Value: 0
Data Type: numeric
Default Value: 128
Range: 1 to 128
Deprecated:
Removed:
Data Type: boolean
Default Value: ON
Introduced:
Removed:
Data Type: boolean
Default Value: OFF
Deprecated:
Removed: MariaDB 10.6.0
Data Type: numeric
Default Value: 56
Range: 0 to 50000
Introduced:
Removed:
Data Type: numeric
Default Value: 256
Range: 1 to 50000
Deprecated:
Removed: MariaDB 10.6.0
Command line: innodb-sched-priority-cleaner=#
Scope: Global
Dynamic: Yes
Data Type: numeric
Default Value: 19
Range: 0 to 39
Deprecated:
Removed:
Data Type: numeric
Default Value: 10
Range: 0 to 1000
Deprecated:
Removed:
Dynamic: Yes
Data Type: numeric
Default Value: 0
Range: 0 to 1
Deprecated:
Removed:
numericDefault Value: 0
Range: 0 to 99
Data Type: boolean
Default Value: ON (>= ), OFF (<= )
Introduced: MariaDB 10.6.18, MariaDB 10.11.8, , , , MariaDB 11.4.2
Data Type: numeric
Default Value: 1048576 (1M)
Range: 65536 to 67108864
Dynamic: Yes
Data Type: numeric
Default Value: 4 (>= ), 6 (<= )
Range: 0 to 4294967295
Dynamic: Yes
Data Type: boolean
Default Value: ON
booleanDefault Value: 1
Removed: - replaced by innodb_stats_auto_recalc.
Default Value: OFF
nulls_ignored: Ignore NULLs altogether from index group calculations.
See also Index Statistics, aria_stats_method and myisam_stats_method.
Command line: --innodb-stats-method=name
Scope: Global
Dynamic: Yes
Data Type: enumeration
Default Value: nulls_equal
Valid Values: nulls_equal, nulls_unequal, nulls_ignored
Data Type: numeric
Default Value: 0
Range: 0 to 18446744073709551615
Dynamic: Yes
Data Type: boolean
Default Value: OFF
Data Type: boolean
Default Value: ON
Data Type: numeric
Default Value: 20
If persistent statistics are enabled, then the innodb_stats_persistent_sample_pages system variable applies instead. persistent statistics are enabled with the innodb_stats_persistent system variable.
This system variable has been deprecated. The innodb_stats_transient_sample_pages system variable should be used instead.
Command line: --innodb-stats-sample-pages=#
Scope: Global
Dynamic: Yes
Data Type: numeric
Default Value: 8
Range: 1 to 2^64-1
Deprecated:
Removed:
Command line: --innodb-stats-traditional={0|1}
Scope: Global
Dynamic: Yes
Data Type: boolean
Default Value: ON
If persistent statistics are enabled, then the innodb_stats_persistent_sample_pages system variable applies instead. persistent statistics are enabled with the innodb_stats_persistent system variable.
Command line: --innodb-stats-transient-sample-pages=#
Scope: Global
Dynamic: Yes
Data Type: numeric
Default Value: 8
Range: 1 to 2^64-1
Data Type: boolean
Default Value: 1
Removed: /XtraDB 5.6
Data Type: boolean
Default Value: OFF
Data Type: boolean
Default Value: OFF
Data Type: boolean
Default Value: ON
Dynamic: Yes
Data Type: boolean
Default Value: ON
Deprecated:
Removed:
Data Type: numeric
Default Value: 1
Range: 1 to 1024
Removed: MariaDB 10.6.0
Data Type: numeric
Default Value: 30
Range: 0 to 4294967295
Dynamic: Yes
Data Type: boolean
Default Value: ON
Dynamic: Yes
Data Type: numeric
Default Value: 0
Range: 0 to 1000
Deprecated:
Removed: MariaDB 10.6.0
Data Type: boolean
Default Value: OFF
Removed: /XtraDB 5.6
Data Type: numeric
Default Value:
0 (>= .)
10000 (<= )
Range: 0 to 1000000
Deprecated:
Removed: MariaDB 10.6.0
Dynamic: No
Data Type: string
Default Value: ibtmp1:12M:autoextend
Documentation & examples: innodb-temporary-tablespaces
Data Type: string
Default Value: Empty
Dynamic: No
Data Type: boolean
Default Value: OFF
Deprecated:
Data Type: boolean
Default Value: OFF
Deprecated:
Data Type: boolean
Default Value: OFF
Introduced:
Dynamic: No
Data Type: string
Default Value: NULL
Data Type: boolean
Default Value: OFF
Dynamic: Yes
Data Type: numeric
Default Value: 128
Range: 0 to 128
Deprecated:
Removed: MariaDB 10.6.0
Command line: --innodb-undo-tablespaces=#
Scope: Global
Dynamic: No
Data Type: numeric
Default Value: 3 (>= ), 0 (<= MariaDB 10.11)
Range: 0, or 2 to 95
Data Type: boolean
Default Value: ON
innodb-use-fallocate={0|1}Scope: Global
Dynamic: No
Data Type: boolean
Default Value: OFF
Deprecated: (treated as if ON)
Removed:
Dynamic: Yes
Data Type: boolean
Default Value: ON
Deprecated:
Removed:
--innodb-use-mtflush={0|1}Scope: Global
Dynamic: No
Data Type: boolean
Default Value: OFF
Deprecated:
Removed:
Scope: Global
Dynamic: No
Data Type: boolean
Default Value: ON
Data Type: numeric
Default Value: 1
Range: 0 to 32
Removed: XtraDB 5.5
Dynamic: No
Data Type: boolean
Default Value: OFF
Deprecated:
Removed:
Dynamic: No
Data Type: boolean
Default Value: ON
Deprecated:
Removed:
Dynamic: No
Data Type: boolean
Default Value: 0
Removed: /XtraDB 5.6
Dynamic: No
Data Type: boolean
Default Value: ON
Deprecated:
Removed:
stringRemoved:
Dynamic: Yes (>= MariaDB 10.11), No (<= )
Data Type: numeric
Default Value: 4
Range: 1 to 64