These terms are commonly used in information about the MySQL database server. This glossary originated as a reference for terminology about the InnoDB storage engine, and the majority of definitions are InnoDB-related.
- .ARM file
- .ARZ file
An acronym standing for atomicity, consistency, isolation, and durability. These properties are all desirable in a database system, and are all closely tied to the notion of a transaction. The transactional features of
InnoDBadhere to the ACID principles.
Transactions are atomic units of work that can be committed or rolled back. When a transaction makes multiple changes to the database, either all the changes succeed when the transaction is committed, or all the changes are undone when the transaction is rolled back.
The database remains in a consistent state at all times — after each commit or rollback, and while transactions are in progress. If related data is being updated across multiple tables, queries see either all old values or all new values, not a mix of old and new values.
Transactions are protected (isolated) from each other while they are in progress; they cannot interfere with each other or see each other's uncommitted data. This isolation is achieved through the locking mechanism. Experienced users can adjust the isolation level, trading off less protection in favor of increased performance and concurrency, when they can be sure that the transactions really do not interfere with each other.
The results of transactions are durable: once a commit operation succeeds, the changes made by that transaction are safe from power failures, system crashes, race conditions, or other potential dangers that many non-database applications are vulnerable to. Durability typically involves writing to disk storage, with a certain amount of redundancy to protect against power failures or software crashes during write operations. (In
InnoDB, the doublewrite buffer assists with durability.)
- adaptive flushing
An algorithm for InnoDB tables that smooths out the I/O overhead introduced by checkpoints. Instead of flushing all modified pages from the buffer pool to the data files at once, MySQL periodically flushes small sets of modified pages. The adaptive flushing algorithm extends this process by estimating the optimal rate to perform these periodic flushes, based on the rate of flushing and how fast redo information is generated.
- adaptive hash index
An optimization for
InnoDBtables that can speed up lookups using
INoperators, by constructing a hash index in memory. MySQL monitors index searches for
InnoDBtables, and if queries could benefit from a hash index, it builds one automatically for index pages that are frequently accessed. In a sense, the adaptive hash index configures MySQL at runtime to take advantage of ample main memory, coming closer to the architecture of main-memory databases. This feature is controlled by the
innodb_adaptive_hash_indexconfiguration option. Because this feature benefits some workloads and not others, and the memory used for the hash index is reserved in the buffer pool, typically you should benchmark with this feature both enabled and disabled.
The hash index is always built based on an existing
InnoDBsecondary index, which is organized as a B-tree structure. MySQL can build a hash index on a prefix of any length of the key defined for the B-tree, depending on the pattern of searches against the index. A hash index can be partial; the whole B-tree index does not need to be cached in the buffer pool.
In MySQL 5.6 and higher, another way to take advantage of fast single-value lookups with
InnoDBtables is to use the
InnoDBmemcached plugin. See Section 14.20, “InnoDB memcached Plugin” for details.
See Also adaptive hash index.
See Also asynchronous I/O.
- application programming interface (API)
When a backup produced by the MySQL Enterprise Backup product does not include the most recent changes that occurred while the backup was underway, the process of updating the backup files to include those changes is known as the apply step. It is specified by the
apply-logoption of the
Before the changes are applied, we refer to the files as a raw backup. After the changes are applied, we refer to the files as a prepared backup. The changes are recorded in the ibbackup_logfile file; once the apply step is finished, this file is no longer necessary.
- asynchronous I/O
A type of I/O operation that allows other processing to proceed before the I/O is completed. Also known as non-blocking I/O and abbreviated as AIO.
InnoDBuses this type of I/O for certain operations that can run in parallel without affecting the reliability of the database, such as reading pages into the buffer pool that have not actually been requested, but might be needed soon.
InnoDBused asynchronous I/O on Windows systems only. Starting with the InnoDB Plugin 1.1 and MySQL 5.5,
InnoDBuses asynchronous I/O on Linux systems. This change introduces a dependency on
libaio. Asynchronous I/O on Linux systems is configured using the
innodb_use_native_aiooption, which is enabled by default. On other Unix-like systems, InnoDB uses synchronous I/O only.
In the SQL context, transactions are units of work that either succeed entirely (when committed) or have no effect at all (when rolled back). The indivisible ("atomic") property of transactions is the “A” in the acronym ACID.
- atomic instruction
A property of a table column (specified by the
AUTO_INCREMENTkeyword) that automatically adds an ascending sequence of values in the column.
InnoDBsupports auto-increment only for primary key columns.
It saves work for the developer, not to have to produce new unique values when inserting new rows. It provides useful information for the query optimizer, because the column is known to be not null and with unique values. The values from such a column can be used as lookup keys in various contexts, and because they are auto-generated there is no reason to ever change them; for this reason, primary key columns are often specified as auto-incrementing.
Auto-increment columns can be problematic with statement-based replication, because replaying the statements on a slave might not produce the same set of column values as on the master, due to timing issues. When you have an auto-incrementing primary key, you can use statement-based replication only with the setting
innodb_autoinc_lock_mode=1. If you have
innodb_autoinc_lock_mode=2, which allows higher concurrency for insert operations, use row-based replication rather than statement-based replication. The setting
innodb_autoinc_lock_mode=0is the previous (traditional) default setting and should not be used except for compatibility purposes.
- auto-increment locking
The convenience of an auto-increment primary key involves some tradeoff with concurrency. In the simplest case, if one transaction is inserting values into the table, any other transactions must wait to do their own inserts into that table, so that rows inserted by the first transaction receive consecutive primary key values.
InnoDBincludes optimizations, and the
innodb_autoinc_lock_modeoption, so that you can choose how to trade off between predictable sequences of auto-increment values and maximum concurrency for insert operations.
A setting that causes a commit operation after each SQL statement. This mode is not recommended for working with
InnoDBtables with transactions that span several statements. It can help performance for read-only transactions on
InnoDBtables, where it minimizes overhead from locking and generation of undo data, especially in MySQL 5.6.4 and up. It is also appropriate for working with
MyISAMtables, where transactions are not applicable.
The ability to cope with, and if necessary recover from, failures on the host, including failures of MySQL, the operating system, or the hardware and maintenance activity that may otherwise cause downtime. Often paired with scalability as critical aspects of a large-scale deployment.
See Also scalability.
A tree data structure that is popular for use in database indexes. The structure is kept sorted at all times, enabling fast lookup for exact matches (equals operator) and ranges (for example, greater than, less than, and
BETWEENoperators). This type of index is available for most storage engines, such as
Because B-tree nodes can have many children, a B-tree is not the same as a binary tree, which is limited to 2 children per node.
Contrast with hash index, which is only available in the
MEMORYstorage engine. The
MEMORYstorage engine can also use B-tree indexes, and you should choose B-tree indexes for
MEMORYtables if some queries use range operators.
The use of the term B-tree is intended as a reference to the general class of index design. B-tree structures used by MySQL storage engines may be regarded as variants due to sophistications not present in a classic B-tree design. For related information, refer to the
InnoDBPage Structure Fil Header section of the MySQL Internals Manual.
See Also hash index.
Identifiers within MySQL SQL statements must be quoted using the backtick character (
`) if they contain special characters or reserved words. For example, to refer to a table named
FOO#BARor a column named
SELECT, you would specify the identifiers as
`SELECT`. Since the backticks provide an extra level of safety, they are used extensively in program-generated SQL statements, where the identifier names might not be known in advance.
Many other database systems use double quotation marks (
") around such special names. For portability, you can enable
ANSI_QUOTESmode in MySQL and use double quotation marks instead of backticks to qualify identifier names.
See Also SQL.
The process of copying some or all table data and metadata from a MySQL instance, for safekeeping. Can also refer to the set of copied files. This is a crucial task for DBAs. The reverse of this process is the restore operation.
With MySQL, physical backups are performed by the MySQL Enterprise Backup product, and logical backups are performed by the
mysqldumpcommand. These techniques have different characteristics in terms of size and representation of the backup data, and speed (especially speed of the restore operation).
Backups are further classified as hot, warm, or cold depending on how much they interfere with normal database operation. (Hot backups have the least interference, cold backups the most.)
The code name for an
InnoDBfile format that supports the COMPRESSED row format that enables InnoDB table compression, and the DYNAMIC row format that improves the storage layout for long variable-length columns.
The MySQL Enterprise Backup product version 3.5 and above supports backing up tablespaces that use the Barracuda file format.
See Also Antelope, compact row format, compressed row format, dynamic row format, file format, file-per-table, general tablespace, innodb_file_format, MySQL Enterprise Backup, row format, system tablespace.
An early stage in the life of a software product, when it is available only for evaluation, typically without a definite release number or a number less than 1.
InnoDBdoes not use the beta designation, preferring an early adopter phase that can extend over several point releases, leading to a GA release.
- binary log
A file containing a record of all statements that attempt to change table data. These statements can be replayed to bring slave servers up to date in a replication scenario, or to bring a database up to date after restoring table data from a backup. The binary logging feature can be turned on and off, although Oracle recommends always enabling it if you use replication or perform backups.
You can examine the contents of the binary log, or replay those statements during replication or recovery, by using the mysqlbinlog command. For full information about the binary log, see Section 5.4.4, “The Binary Log”. For MySQL configuration options related to the binary log, see Section 188.8.131.52, “Binary Log Options and Variables”.
For the MySQL Enterprise Backup product, the file name of the binary log and the current position within the file are important details. To record this information for the master server when taking a backup in a replication context, you can specify the
Prior to MySQL 5.0, a similar capability was available, known as the update log. In MySQL 5.0 and higher, the binary log replaces the update log.
See Also binary log.
- blind query expansion
A special mode of full-text search enabled by the
WITH QUERY EXPANSIONclause. It performs the search twice, where the search phrase for the second search is the original search phrase concatenated with the few most highly relevant documents from the first search. This technique is mainly applicable for short search phrases, perhaps only a single word. It can uncover relevant matches where the precise search term does not occur in the document.
See Also full-text search.
A portion of a system that is constrained in size or capacity, that has the effect of limiting overall throughput. For example, a memory area might be smaller than necessary; access to a single required resource might prevent multiple CPU cores from running simultaneously; or waiting for disk I/O to complete might prevent the CPU from running at full capacity. Removing bottlenecks tends to improve concurrency. For example, the ability to have multiple
InnoDBbuffer pool instances reduces contention when multiple sessions read from and write to the buffer pool simultaneously.
See Also shutdown.
- buddy allocator
A memory or disk area used for temporary storage. Data is buffered in memory so that it can be written to disk efficiently, with a few large I/O operations rather than many small ones. Data is buffered on disk for greater reliability, so that it can be recovered even when a crash or other failure occurs at the worst possible time. The main types of buffers used by InnoDB are the buffer pool, the doublewrite buffer, and the change buffer.
- buffer pool
The memory area that holds cached
InnoDBdata for both tables and indexes. For efficiency of high-volume read operations, the buffer pool is divided into pages that can potentially hold multiple rows. For efficiency of cache management, the buffer pool is implemented as a linked list of pages; data that is rarely used is aged out of the cache, using a variation of the LRU algorithm. On systems with large memory, you can improve concurrency by dividing the buffer pool into multiple buffer pool instances.
performance_schematables help to monitor the internal workings of the buffer pool. Starting in MySQL 5.6, you can avoid a lengthy warmup period after restarting the server, particularly for instances with large buffer pools, by saving the buffer pool state at server shutdown and restoring the buffer pool to the same state at server startup. See Section 184.108.40.206, “Saving and Restoring the Buffer Pool State”.
- buffer pool instance
Any of the multiple regions into which the buffer pool can be divided, controlled by the
innodb_buffer_pool_instancesconfiguration option. The total memory size specified by
innodb_buffer_pool_sizeis divided among all buffer pool instances. Typically, having multiple buffer pool instances is appropriate for systems that allocate multiple gigabytes to the
InnoDBbuffer pool, with each instance being one gigabyte or larger. On systems loading or looking up large amounts of data in the buffer pool from many concurrent sessions, having multiple buffer pool instances reduces contention for exclusive access to data structures that manage the buffer pool.
See Also buffer pool.
InnoDBstorage engine within MySQL is the original form of distribution for the storage engine. Contrast with the InnoDB Plugin. Starting with MySQL 5.5, the InnoDB Plugin is merged back into the MySQL code base as the built-in
InnoDBstorage engine (known as InnoDB 1.1).
This distinction is important mainly in MySQL 5.1, where a feature or bug fix might apply to the InnoDB Plugin but not the built-in
InnoDB, or vice versa.
See Also InnoDB.
- business rules
The relationships and sequences of actions that form the basis of business software, used to run a commercial company. Sometimes these rules are dictated by law, other times by company policy. Careful planning ensures that the relationships encoded and enforced by the database, and the actions performed through application logic, accurately reflect the real policies of the company and can handle real-life situations.
For example, an employee leaving a company might trigger a sequence of actions from the human resources department. The human resources database might also need the flexibility to represent data about a person who has been hired, but not yet started work. Closing an account at an online service might result in data being removed from a database, or the data might be moved or flagged so that it could be recovered if the account is re-opened. A company might establish policies regarding salary maximums, minimums, and adjustments, in addition to basic sanity checks such as the salary not being a negative number. A retail database might not allow a purchase with the same serial number to be returned more than once, or might not allow credit card purchases above a certain value, while a database used to detect fraud might allow these kinds of things.
See Also relational.
- .cfg file
A metadata file used with the
InnoDBtransportable tablespace feature. It is produced by the command
FLUSH TABLES ... FOR EXPORT, puts one or more tables in a consistent state that can be copied to another server. The
.cfgfile is copied along with the corresponding .ibd file, and used to adjust the internal values of the
.ibdfile, such as the space ID, during the
ALTER TABLE ... IMPORT TABLESPACEstep.
The number of different values in a table column. When queries refer to columns that have an associated index, the cardinality of each column influences which access method is most efficient. For example, for a column with a unique constraint, the number of different values is equal to the number of rows in the table. If a table has a million rows but only 10 different values for a particular column, each value occurs (on average) 100,000 times. A query such as
SELECT c1 FROM t1 WHERE c1 = 50;thus might return 1 row or a huge number of rows, and the database server might process the query differently depending on the cardinality of
If the values in a column have a very uneven distribution, the cardinality might not be a good way to determine the best query plan. For example,
SELECT c1 FROM t1 WHERE c1 = x;might return 1 row when
x=50and a million rows when
x=30. In such a case, you might need to use index hints to pass along advice about which lookup method is more efficient for a particular query.
Cardinality can also apply to the number of distinct values present in multiple columns, as in a composite index.
- change buffer
A special data structure that records changes to pages in secondary indexes. These values could result from SQL
DELETEstatements (DML). The set of features involving the change buffer is known collectively as change buffering, consisting of insert buffering, delete buffering, and purge buffering.
Changes are only recorded in the change buffer when the relevant page from the secondary index is not in the buffer pool. When the relevant index page is brought into the buffer pool while associated changes are still in the change buffer, the changes for that page are applied in the buffer pool (merged) using the data from the change buffer. Periodically, the purge operation that runs during times when the system is mostly idle, or during a slow shutdown, writes the new index pages to disk. The purge operation can write the disk blocks for a series of index values more efficiently than if each value were written to disk immediately.
Physically, the change buffer is part of the system tablespace, so that the index changes remain buffered across database restarts. The changes are only applied (merged) when the pages are brought into the buffer pool due to some other read operation.
The kinds and amount of data stored in the change buffer are governed by the
innodb_change_buffer_max_sizeconfiguration options. To see information about the current data in the change buffer, issue the
SHOW ENGINE INNODB STATUScommand.
Formerly known as the insert buffer.
- change buffering
The general term for the features involving the change buffer, consisting of insert buffering, delete buffering, and purge buffering. Index changes resulting from SQL statements, which could normally involve random I/O operations, are held back and performed periodically by a background thread. This sequence of operations can write the disk blocks for a series of index values more efficiently than if each value were written to disk immediately. Controlled by the
As changes are made to data pages that are cached in the buffer pool, those changes are written to the data files sometime later, a process known as flushing. The checkpoint is a record of the latest changes (represented by an LSN value) that have been successfully written to the data files.
InnoDB, a validation mechanism to detect corruption when a page in a tablespace is read from disk into the
InnoDBbuffer pool. This feature is controlled by the
innodb_checksumsconfiguration option in MySQL 5.5.
innodb_checksumsis deprecated in MySQL 5.6.3, replaced by
The innochecksum command helps diagnose corruption problems by testing the checksum values for a specified tablespace file while the MySQL server is shut down.
- child table
In a foreign key relationship, a child table is one whose rows refer (or point) to rows in another table with an identical value for a specific column. This is the table that contains the
FOREIGN KEY ... REFERENCESclause and optionally
ON DELETEclauses. The corresponding row in the parent table must exist before the row can be created in the child table. The values in the child table can prevent delete or update operations on the parent table, or can cause automatic deletion or updates in the child table, based on the
ON CASCADEoption used when creating the foreign key.
- clean page
A page in the
InnoDBbuffer pool where all changes made in memory have also been written (flushed) to the data files. The opposite of a dirty page.
- clean shutdown
A type of program that sends requests to a server, and interprets or processes the results. The client software might run only some of the time (such as a mail or chat program), and might run interactively (such as the mysql command processor).
- clustered index
InnoDBterm for a primary key index.
InnoDBtable storage is organized based on the values of the primary key columns, to speed up queries and sorts involving the primary key columns. For best performance, choose the primary key columns carefully based on the most performance-critical queries. Because modifying the columns of the clustered index is an expensive operation, choose primary columns that are rarely or never updated.
In the Oracle Database product, this type of table is known as an index-organized table.
- cold backup
Each column has a cardinality value. A column can be the primary key for its table, or part of the primary key. A column can be subject to a unique constraint, a NOT NULL constraint, or both. Values in different columns, even across different tables, can be linked by a foreign key relationship.
In discussions of MySQL internal operations, sometimes field is used as a synonym.
- column index
- column prefix
When an index is created with a length specification, such as
CREATE INDEX idx ON t1 (c1(N)), only the first N characters of the column value are stored in the index. Keeping the index prefix small makes the index compact, and the memory and disk I/O savings help performance. (Although making the index prefix too small can hinder query optimization by making rows with different values appear to the query optimizer to be duplicates.)
For columns containing binary values or long text strings, where sorting is not a major consideration and storing the entire value in the index would waste space, the index automatically uses the first N (typically 768) characters of the value to do lookups and sorts.
See Also index.
InnoDBuses an optimistic mechanism for commits, so that changes can be written to the data files before the commit actually occurs. This technique makes the commit itself faster, with the tradeoff that more work is required in case of a rollback.
By default, MySQL uses the autocommit setting, which automatically issues a commit following each SQL statement.
- compact row format
InnoDBrow format for
InnoDBtables since MySQL 5.0.3. The COMPACT row format provides a more compact representation for nulls and variable-length columns than the prior default (REDUNDANT row format).
For additional information about
COMPACTrow format, see Section 14.11.4, “COMPACT and REDUNDANT Row Formats”.
- composite index
See Also index.
- compressed backup
The compression feature of the MySQL Enterprise Backup product makes a compressed copy of each tablespace, changing the extension from
.ibz. Compressing backup data allows you to keep more backups on hand, and reduces the time to transfer backups to a different server. The data is uncompressed during the restore operation. When a compressed backup operation processes a table that is already compressed, it skips the compression step for that table, because compressing again would result in little or no space savings.
A set of files produced by the MySQL Enterprise Backup product, where each tablespace is compressed. The compressed files are renamed with a
Applying compression at the start of the backup process helps to avoid storage overhead during the compression process, and to avoid network overhead when transferring the backup files to another server. The process of applying the binary log takes longer, and requires uncompressing the backup files.
- compressed row format
A row format that enables data and index compression for
InnoDBtables. It was introduced in the
InnoDBPlugin, available as part of the Barracuda file format. Large fields are stored away from the page that holds the rest of the row data, as in dynamic row format. Both index pages and large fields are compressed, yielding memory and disk savings. Depending on the structure of the data, the decrease in memory and disk usage might or might not outweigh the performance overhead of uncompressing the data as it is used. See Section 14.9, “InnoDB Table Compression” for usage details.
For additional information about
COMPRESSEDrow format, see Section 14.11.3, “DYNAMIC and COMPRESSED Row Formats”.
- compressed table
A table for which the data is stored in compressed form. For
InnoDB, it is a table created with
ROW_FORMAT=COMPRESSED. See Section 14.9, “InnoDB Table Compression” for more information.
A feature with wide-ranging benefits from using less disk space, performing less I/O, and using less memory for caching.
InnoDBtable and index data can be kept in a compressed format during database operation.
The data is uncompressed when needed for queries, and re-compressed when changes are made by DML operations. After you enable compression for a table, this processing is transparent to users and application developers. DBAs can consult
INFORMATION_SCHEMAtables to monitor how efficiently the compression parameters work for the MySQL instance and for particular compressed tables.
InnoDBtable data is compressed, the compression applies to the table itself, any associated index data, and the pages loaded into the buffer pool. Compression does not apply to pages in the undo buffer.
The table compression feature requires using MySQL 5.5 or higher, or the InnoDB Plugin in MySQL 5.1 or earlier, and creating the table using the Barracuda file format and compressed row format, with the innodb_file_per_table setting enabled.
Compression for each table is influenced by the
KEY_BLOCK_SIZEclause of the
ALTER TABLEstatements. In MySQL 5.6 and higher, compression is also affected by the server-wide configuration options
innodb_compression_pad_pct_max. See Section 14.9, “InnoDB Table Compression” for usage details.
Another type of compression is the compressed backup feature of the MySQL Enterprise Backup product.
- compression failure
Not actually an error, rather an expensive operation that can occur when using compression in combination with DML operations. It occurs when: updates to a compressed page overflow the area on the page reserved for recording modifications; the page is compressed again, with all changes applied to the table data; the re-compressed data does not fit on the original page, requiring MySQL to split the data into two new pages and compress each one separately. To check the frequency of this condition, query the
INFORMATION_SCHEMA.INNODB_CMPtable and check how much the value of the
COMPRESS_OPScolumn exceeds the value of the
COMPRESS_OPS_OKcolumn. Ideally, compression failures do not occur often; when they do, you can adjust the
- concatenated index
See composite index.
The ability of multiple operations (in database terminology, transactions) to run simultaneously, without interfering with each other. Concurrency is also involved with performance, because ideally the protection for multiple simultaneous transactions works with a minimum of performance overhead, using efficient mechanisms for locking.
- configuration file
The file that holds the option values used by MySQL at startup. Traditionally, on Linux and Unix this file is named
my.cnf, and on Windows it is named
my.ini. You can set a number of options related to InnoDB under the
[mysqld]section of the file.
See Section 4.2.6, “Using Option Files” for information about where MySQL searches for configuration files.
When you use the MySQL Enterprise Backup product, you typically use two configuration files: one that specifies where the data comes from and how it is structured (which could be the original configuration file for your server), and a stripped-down one containing only a small set of options that specify where the backup data goes and how it is structured. The configuration files used with the MySQL Enterprise Backup product must contain certain options that are typically left out of regular configuration files, so you might need to add options to your existing configuration file for use with MySQL Enterprise Backup.
- consistent read
A read operation that uses snapshot information to present query results based on a point in time, regardless of changes performed by other transactions running at the same time. If queried data has been changed by another transaction, the original data is reconstructed based on the contents of the undo log. This technique avoids some of the locking issues that can reduce concurrency by forcing transactions to wait for other transactions to finish.
With REPEATABLE READ isolation level, the snapshot is based on the time when the first read operation is performed. With READ COMMITTED isolation level, the snapshot is reset to the time of each consistent read operation.
Consistent read is the default mode in which
SELECTstatements in READ COMMITTED and REPEATABLE READ isolation levels. Because a consistent read does not set any locks on the tables it accesses, other sessions are free to modify those tables while a consistent read is being performed on the table.
For technical details about the applicable isolation levels, see Section 220.127.116.11, “Consistent Nonlocking Reads”.
An automatic test that can block database changes to prevent data from becoming inconsistent. (In computer science terms, a kind of assertion related to an invariant condition.) Constraints are a crucial component of the ACID philosophy, to maintain data consistency. Constraints supported by MySQL include FOREIGN KEY constraints and unique constraints.
A value that is incremented by a particular kind of
InnoDBoperation. Useful for measuring how busy a server is, troubleshooting the sources of performance issues, and testing whether changes (for example, to configuration settings or indexes used by queries) have the desired low-level effects. Different kinds of counters are available through Performance Schema tables and INFORMATION_SCHEMA tables, particularly
- covering index
An index that includes all the columns retrieved by a query. Instead of using the index values as pointers to find the full table rows, the query returns values from the index structure, saving disk I/O.
InnoDBcan apply this optimization technique to more indexes than MyISAM can, because
InnoDBsecondary indexes also include the primary key columns.
InnoDBcannot apply this technique for queries against tables modified by a transaction, until that transaction ends.
Any column index or composite index could act as a covering index, given the right query. Design your indexes and queries to take advantage of this optimization technique wherever possible.
MySQL uses the term “crash” to refer generally to any unexpected shutdown operation where the server cannot do its normal cleanup. For example, a crash could happen due to a hardware fault on the database server machine or storage device; a power failure; a potential data mismatch that causes the MySQL server to halt; a fast shutdown initiated by the DBA; or many other reasons. The robust, automatic crash recovery for InnoDB tables ensures that data is made consistent when the server is restarted, without any extra work for the DBA.
- crash recovery
The cleanup activities that occur when MySQL is started again after a crash. For InnoDB tables, changes from incomplete transactions are replayed using data from the redo log. Changes that were committed before the crash, but not yet written into the data files, are reconstructed from the doublewrite buffer. When the database is shut down normally, this type of activity is performed during shutdown by the purge operation.
During normal operation, committed data can be stored in the change buffer for a period of time before being written to the data files. There is always a tradeoff between keeping the data files up-to-date, which introduces performance overhead during normal operation, and buffering the data, which can make shutdown and crash recovery take longer.
Acronym for “create, read, update, delete”, a common sequence of operations in database applications. Often denotes a class of applications with relatively simple database usage (basic DDL, DML and query statements in SQL) that can be implemented quickly in any language.
An internal data structure that is used to represent the result set of a query, or other operation that performs a search using an SQL
WHEREclause. It works like an iterator in other high-level languages, producing each value from the result set as requested.
Although SQL usually handles the processing of cursors for you, you might delve into the inner workings when dealing with performance-critical code.
See Also query.
- data definition language
- data dictionary
Metadata that keeps track of InnoDB-related objects such as tables, indexes, and table columns. This metadata is physically located in the
InnoDBsystem tablespace. For historical reasons, it overlaps to some degree with information stored in the .frm files.
Because the MySQL Enterprise Backup product always backs up the system tablespace, all backups include the contents of the data dictionary.
- data directory
The directory under which each MySQL instance keeps the data files for
InnoDBand the directories representing individual databases. Controlled by the
- data files
InnoDBsystem tablespace, which holds the
InnoDBdata dictionary and is capable of holding data for multiple
InnoDBtables, is represented by one or more
File-per-table tablespaces, which hold data for a single
InnoDBtable, are represented by a
General tablespaces (introduced in MySQL 5.7.6), which can hold data for multiple
InnoDBtables, are also represented by a
- data manipulation language
- data warehouse
A database system or application that primarily runs large queries. The read-only or read-mostly data might be organized in denormalized form for query efficiency. Can benefit from the optimizations for read-only transactions in MySQL 5.6 and higher. Contrast with OLTP.
Within the MySQL data directory, each database is represented by a separate directory. The InnoDB system tablespace, which can hold table data from multiple databases within a MySQL instance, is kept in data files that reside outside of individual database directories. When file-per-table mode is enabled, the .ibd files representing individual InnoDB tables are stored inside the database directories unless created elsewhere using the
DATA DIRECTORYclause. General tablespaces, introduced in MySQL 5.7.6, also hold table data in .ibd files. Unlike file-per-table .ibd files, general tablespace .ibd files can hold table data from multiple databases within a MySQL instance, and can be assigned to directories relative to or independent of the MySQL data directory.
For long-time MySQL users, a database is a familiar notion. Users coming from an Oracle Database background will find that the MySQL meaning of a database is closer to what Oracle Database calls a schema.
Data definition language, a set of SQL statements for manipulating the database itself rather than individual table rows. Includes all forms of the
DROPstatements. Also includes the
TRUNCATEstatement, because it works differently than a
DELETE FROMstatement, even though the ultimate effect is similar.
DDL statements automatically commit the current transaction; they cannot be rolled back.
InnoDBonline DDL feature enhances performance for
DROP INDEX, and many types of
ALTER TABLEoperations. See Section 14.13, “InnoDB and Online DDL” for more information. Also, the
InnoDBfile-per-table setting can affect the behavior of
Contrast with DML and DCL.
A situation where different transactions are unable to proceed, because each holds a lock that the other needs. Because both transactions are waiting for a resource to become available, neither will ever release the locks it holds.
A deadlock can occur when the transactions lock rows in multiple tables (through statements such as
SELECT ... FOR UPDATE), but in the opposite order. A deadlock can also occur when such statements lock ranges of index records and gaps, with each transaction acquiring some locks but not others due to a timing issue.
For background information on how deadlocks are automatically detected and handled, see Section 18.104.22.168, “Deadlock Detection and Rollback”. For tips on avoiding and recovering from deadlock conditions, see Section 22.214.171.124, “How to Minimize and Handle Deadlocks”.
- deadlock detection
DELETEstatement, the rows are immediately marked for deletion and no longer are returned by queries. The storage is reclaimed sometime later, during the periodic garbage collection known as the purge operation. For removing large quantities of data, related operations with their own performance characteristics are TRUNCATE and DROP.
- delete buffering
The technique of storing changes to secondary index pages, resulting from
DELETEoperations, in the change buffer rather than writing the changes immediately, so that the physical writes can be performed to minimize random I/O. (Because delete operations are a two-step process, this operation buffers the write that normally marks an index record for deletion.) It is one of the types of change buffering; the others are insert buffering and purge buffering.
A data storage strategy that duplicates data across different tables, rather than linking the tables with foreign keys and join queries. Typically used in data warehouse applications, where the data is not updated after loading. In such applications, query performance is more important than making it simple to maintain consistent data during updates. Contrast with normalized.
- descending index
A type of index available with some database systems, where index storage is optimized to process
ORDER BYclauses. Currently, although MySQL allows the
DESCkeyword in the
CREATE TABLEstatement, it does not use any special storage layout for the resulting index.
See Also index.
- dirty page
- dirty read
This kind of operation does not adhere to the ACID principle of database design. It is considered very risky, because the data could be rolled back, or updated further before being committed; then, the transaction doing the dirty read would be using data that was never confirmed as accurate.
Its opposite is consistent read, where
InnoDBensures that a transaction does not read information updated by another transaction, even if the other transaction commits in the meantime.
A kind of database that primarily organizes data on disk storage (hard drives or equivalent). Data is brought back and forth between disk and memory to be operated upon. It is the opposite of an in-memory database. Although
InnoDBis disk-based, it also contains features such as he buffer pool, multiple buffer pool instances, and the adaptive hash index that allow certain kinds of workloads to work primarily from memory.
Data manipulation language, a set of SQL statements for performing
SELECTstatement is sometimes considered as a DML statement, because the
SELECT ... FOR UPDATEform is subject to the same considerations for locking as
DML statements for an
InnoDBtable operate in the context of a transaction, so their effects can be committed or rolled back as a single unit.
Contrast with DDL and DCL.
- document id
InnoDBfull-text search feature, a special column in the table containing the FULLTEXT index, to uniquely identify the document associated with each ilist value. Its name is
FTS_DOC_ID(uppercase required). The column itself must be of
BIGINT UNSIGNED NOT NULLtype, with a unique index named
FTS_DOC_ID_INDEX. Preferably, you define this column when creating the table. If
InnoDBmust add the column to the table while creating a
FULLTEXTindex, the indexing operation is considerably more expensive.
- doublewrite buffer
InnoDBuses a file flush technique called doublewrite. Before writing pages to the data files,
InnoDBfirst writes them to a contiguous area called the doublewrite buffer. Only after the write and the flush to the doublewrite buffer have completed, does
InnoDBwrite the pages to their proper positions in the data file. If there is an operating system, storage subsystem, or mysqld process crash in the middle of a page write,
InnoDBcan later find a good copy of the page from the doublewrite buffer during crash recovery.
Although data is always written twice, the doublewrite buffer does not require twice as much I/O overhead or twice as many I/O operations. Data is written to the buffer itself as a large sequential chunk, with a single
fsync()call to the operating system.
To turn off the doublewrite buffer, specify the option
A kind of DDL operation that removes a schema object, through a statement such as
DROP INDEX. It maps internally to an
ALTER TABLEstatement. From an
InnoDBperspective, the performance considerations of such operations involve the time that the data dictionary is locked to ensure that interrelated objects are all updated, and the time to update memory structures such as the buffer pool. For a table, the drop operation has somewhat different characteristics than a truncate operation (
- dynamic row format
A row format introduced in the
InnoDBPlugin, available as part of the Barracuda file format. Because long variable-length column values are stored outside of the page that holds the row data, it is very efficient for rows that include large objects. Since the large fields are typically not accessed to evaluate query conditions, they are not brought into the buffer pool as often, resulting in fewer I/O operations and better utilization of cache memory.
As of MySQL 5.7.9, the default row format is defined by
innodb_default_row_format, which has a default value of
For additional information about
DYNAMICrow format, see Section 14.11.3, “DYNAMIC and COMPRESSED Row Formats”.
- early adopter
See Also beta.
- error log
A type of log showing information about MySQL startup and critical runtime errors and crash information. For details, see Section 5.4.2, “The Error Log”.
The process of removing an item from a cache or other temporary storage area, such as the
InnoDBbuffer pool. Often, but not always, uses the LRU algorithm to determine which item to remove. When a dirty page is evicted, its contents are flushed to disk, and any dirty neighbor pages might be flushed also.
- exclusive lock
A kind of lock that prevents any other transaction from locking the same row. Depending on the transaction isolation level, this kind of lock might block other transactions from writing to the same row, or might also block other transactions from reading the same row. The default
InnoDBisolation level, REPEATABLE READ, enables higher concurrency by allowing transactions to read rows that have exclusive locks, a technique known as consistent read.
A group of pages within a tablespace. For the default page size of 16KB, an extent contains 64 pages. In MySQL 5.6, the page size for an
InnoDBinstance can be 4KB, 8KB, or 16KB, controlled by the
innodb_page_sizeconfiguration option. For 4KB, 8KB, and 16KB pages sizes, the extent size is always 1MB (or 1048576 bytes).
Support for 32KB and 64KB
InnoDBpage sizes was added in MySQL 5.7.6. For a 32KB page size, the extent size is 2MB. For a 64KB page size, the extent size is 4MB.
InnoDBfeatures such as segments, read-ahead requests and the doublewrite buffer use I/O operations that read, write, allocate, or free data one extent at a time.
- .frm file
For backups, you must always keep the full set of
.frmfiles along with the backup data to be able to restore tables that are altered or dropped after the backup.
InnoDBtable has a
InnoDBmaintains its own table metadata in the system tablespace; the
.frmfiles are not needed for
InnoDBto operate on
.frmfiles are backed up by the MySQL Enterprise Backup product. These files must not be modified by an
ALTER TABLEoperation while the backup is taking place, which is why backups that include non-
InnoDBtables perform a
FLUSH TABLES WITH READ LOCKoperation to freeze such activity while backing up
.frmfiles. Restoring a backup can result in
.frmfiles being created, changed, or removed to match the state of the database at the time of the backup.
- Fast Index Creation
A capability first introduced in the InnoDB Plugin, now part of MySQL in 5.5 and higher, that speeds up creation of
InnoDBsecondary indexes by avoiding the need to completely rewrite the associated table. The speedup applies to dropping secondary indexes also.
Because index maintenance can add performance overhead to many data transfer operations, consider doing operations such as
ALTER TABLE ... ENGINE=INNODBor
INSERT INTO ... SELECT * FROM ...without any secondary indexes in place, and creating the indexes afterward.
In MySQL 5.6, this feature becomes more general. You can read and write to tables while an index is being created, and many more kinds of
ALTER TABLEoperations can be performed without copying the table, without blocking DML operations, or both. Thus in MySQL 5.6 and higher, this set of features is referred to as online DDL rather than Fast Index Creation.
- fast shutdown
The default shutdown procedure for
InnoDB, based on the configuration setting
innodb_fast_shutdown=1. To save time, certain flush operations are skipped. This type of shutdown is safe during normal usage, because the flush operations are performed during the next startup, using the same mechanism as in crash recovery. In cases where the database is being shut down for an upgrade or downgrade, do a slow shutdown instead to ensure that all relevant changes are applied to the data files during the shutdown.
- file format
The file format for
InnoDBtables, enabled using the
innodb_file_formatconfiguration option. Supported file formats are Antelope and Barracuda. Antelope is the original
InnoDBfile format and supports the REDUNDANT and COMPACT row formats. Barracuda is the newer
InnoDBfile format and supports the COMPRESSED and DYNAMIC row formats.
A general name for the setting controlled by the
innodb_file_per_tableoption, which is an important configuration option that affects aspects of
InnoDBfile storage, availability of features, and I/O characteristics. As of MySQL 5.6.7,
innodb_file_per_tableis enabled by default.
innodb_file_per_tableoption enabled, you can create a table in its own .ibd file rather than in the shared ibdata files of the system tablespace. When table data is stored in an individual .ibd file, you have more flexibility to choose row formats required for features such as data compression. The
TRUNCATE TABLEoperation is also faster, and reclaimed space can be used by the operating system rather than remaining reserved for
The MySQL Enterprise Backup product is more flexible for tables that are in their own files. For example, tables can be excluded from a backup, but only if they are in separate files. Thus, this setting is suitable for tables that are backed up less frequently or on a different schedule.
- fill factor
InnoDBindex, the proportion of a page that is taken up by index data before the page is split. The unused space when index data is first divided between pages allows for rows to be updated with longer string values without requiring expensive index maintenance operations. If the fill factor is too low, the index consumes more space than needed, causing extra I/O overhead when reading the index. If the fill factor is too high, any update that increases the length of column values can cause extra I/O overhead for index maintenance. See Section 14.8.11, “Physical Structure of an InnoDB Index” for more information.
- fixed row format
This row format is used by the
MyISAMstorage engine, not by
InnoDB. If you create an
InnoDBtable with the option
ROW_FORMAT=FIXEDin MySQL 5.7.6 or earlier,
InnoDBuses the compact row format instead, although the
FIXEDvalue might still show up in output such as
SHOW TABLE STATUSreports. As of MySQL 5.7.7,
InnoDBreturns an error if
To write changes to the database files, that had been buffered in a memory area or a temporary disk storage area. The
InnoDBstorage structures that are periodically flushed include the redo log, the undo log, and the buffer pool.
Flushing can happen because a memory area becomes full and the system needs to free some space, because a commit operation means the changes from a transaction can be finalized, or because a slow shutdown operation means that all outstanding work should be finalized. When it is not critical to flush all the buffered data at once,
InnoDBcan use a technique called fuzzy checkpointing to flush small batches of pages to spread out the I/O overhead.
- flush list
InnoDBdata structure that tracks dirty pages in the buffer pool: that is, pages that have been changed and need to be written back out to disk. This data structure is updated frequently by
InnoDBinternal mini-transactions, and so is protected by its own mutex to allow concurrent access to the buffer pool.
- foreign key
In addition to enabling fast lookup of related information, foreign keys help to enforce referential integrity, by preventing any of these pointers from becoming invalid as data is inserted, updated, and deleted. This enforcement mechanism is a type of constraint. A row that points to another table cannot be inserted if the associated foreign key value does not exist in the other table. If a row is deleted or its foreign key value changed, and rows in another table point to that foreign key value, the foreign key can be set up to prevent the deletion, cause the corresponding column values in the other table to become null, or automatically delete the corresponding rows in the other table.
One of the stages in designing a normalized database is to identify data that is duplicated, separate that data into a new table, and set up a foreign key relationship so that the multiple tables can be queried like a single table, using a join operation.
- FOREIGN KEY constraint
The type of constraint that maintains database consistency through a foreign key relationship. Like other kinds of constraints, it can prevent data from being inserted or updated if data would become inconsistent; in this case, the inconsistency being prevented is between data in multiple tables. Alternatively, when a DML operation is performed,
FOREIGN KEYconstraints can cause data in child rows to be deleted, changed to different values, or set to null, based on the
ON CASCADEoption specified when creating the foreign key.
- full backup
- full table scan
An operation that requires reading the entire contents of a table, rather than just selected portions using an index. Typically performed either with small lookup tables, or in data warehousing situations with large tables where all available data is aggregated and analyzed. How frequently these operations occur, and the sizes of the tables relative to available memory, have implications for the algorithms used in query optimization and managing the buffer pool.
The purpose of indexes is to allow lookups for specific values or ranges of values within a large table, thus avoiding full table scans when practical.
- full-text search
The MySQL feature for finding words, phrases, Boolean combinations of words, and so on within table data, in a faster, more convenient, and more flexible way than using the SQL
LIKEoperator or writing your own application-level search algorithm. It uses the SQL function
MATCH()and FULLTEXT indexes.
See Also FULLTEXT index.
- FULLTEXT index
The special kind of index that holds the search index in the MySQL full-text search mechanism. Represents the words from values of a column, omitting any that are specified as stopwords. Originally, only available for
MyISAMtables. Starting in MySQL 5.6.4, it is also available for InnoDB tables.
- fuzzy checkpointing
See Also beta.
A place in an
InnoDBindex data structure where new values could be inserted. When you lock a set of rows with a statement such as
SELECT ... FOR UPDATE,
InnoDBcan create locks that apply to the gaps as well as the actual values in the index. For example, if you select all values greater than 10 for update, a gap lock prevents another transaction from inserting a new value that is greater than 10. The supremum record and infimum record represent the gaps containing all values greater than or less than all the current index values.
- gap lock
A lock on a gap between index records, or a lock on the gap before the first or after the last index record. For example,
SELECT c1 FROM t WHERE c1 BETWEEN 10 and 20 FOR UPDATE;prevents other transactions from inserting a value of 15 into the column
t.c1, whether or not there was already any such value in the column, because the gaps between all existing values in the range are locked. Contrast with record lock and next-key lock.
Gap locks are part of the tradeoff between performance and concurrency, and are used in some transaction isolation levels and not others.
- general log
See general query log.
- general query log
A type of log used for diagnosis and troubleshooting of SQL statements processed by the MySQL server. Can be stored in a file or in a database table. You must enable this feature through the
general_logconfiguration option to use it. You can disable it for a specific connection through the
Records a broader range of queries than the slow query log. Unlike the binary log, which is used for replication, the general query log contains
SELECTstatements and does not maintain strict ordering. For more information, see Section 5.4.3, “The General Query Log”.
- general tablespace
InnoDBtablespace created using
CREATE TABLESPACEsyntax. General tablespaces can be created outside of the MySQL data directory, are capable of holding multiple tables, and support tables of all row formats. General tablespaces were introduced in MySQL 5.7.6.
Tables are added to a general tablespace using
tbl_name... TABLESPACE [=]
Contrast with system tablespace and file-per-table tablespace.
For more information, see InnoDB General Tablespaces.
- global transaction
A type of transaction involved in XA operations. It consists of several actions that are transactional in themselves, but that all must either complete successfully as a group, or all be rolled back as a group. In essence, this extends ACID properties “up a level” so that multiple ACID transactions can be executed in concert as components of a global operation that also has ACID properties.
- group commit
When the binary log is enabled, you typically also set the configuration option
sync_binlog=0, because group commit for the binary log is only supported if it is set to 0.
- hash index
A type of index intended for queries that use equality operators, rather than range operators such as greater-than or
BETWEEN. It is available for
MEMORYtables. Although hash indexes are the default for
MEMORYtables for historic reasons, that storage engine also supports B-tree indexes, which are often a better choice for general-purpose queries.
MySQL includes a variant of this index type, the adaptive hash index, that is constructed automatically for
InnoDBtables if needed based on runtime conditions.
Acronym for “hard disk drive”. Refers to storage media using spinning platters, usually when comparing and contrasting with SSD. Its performance characteristics can influence the throughput of a disk-based workload.
A periodic message that is sent to indicate that a system is functioning properly. In a replication context, if the master stops sending such messages, one of the slaves can take its place. Similar techniques can be used between the servers in a cluster environment, to confirm that all of them are operating properly.
- high-water mark
See Also low-water mark.
- history list
A list of transactions with delete-marked records scheduled to be processed by the
InnoDBpurge operation. Recorded in the undo log. The length of the history list is reported by the command
SHOW ENGINE INNODB STATUS. If the history list grows longer than the value of the
innodb_max_purge_lagconfiguration option, each DML operation is delayed slightly to allow the purge operation to finish flushing the deleted records.
Also known as purge lag.
- hole punching
Releasing empty blocks from a page. The
InnoDBtransparent page compression feature relies on hole punching support. For more information, see InnoDB Page Compression.
Although “hot” typically indicates an undesirable condition, a hot backup is the preferred type of backup.
See Also hot backup.
- hot backup
A backup taken while the database is running and applications are reading and writing to it. The backup involves more than simply copying data files: it must include any data that was inserted or updated while the backup was in process; it must exclude any data that was deleted while the backup was in process; and it must ignore any changes that were not committed.
The Oracle product that performs hot backups, of
InnoDBtables especially but also tables from
MyISAMand other storage engines, is known as MySQL Enterprise Backup.
The hot backup process consists of two stages. The initial copying of the data files produces a raw backup. The apply step incorporates any changes to the database that happened while the backup was running. Applying the changes produces a prepared backup; these files are ready to be restored whenever necessary.
- .ibd file
The data file for file-per-table tablespaces and general tablespaces. File-per-table tablespace
.idbfiles contain a single table and associated index data. General tablespace
.idbfiles may contain table and index data for multiple tables. General tablespaces were introduced in MySQL 5.7.6.
.ibdfile extension does not apply to the system tablespace, which consists of one or more ibdata files.
If a file-per-table tablespace or general tablespace is created with the
DATA DIRECTORY =clause, the
.ibdfile is located at the specified path, outside the normal data directory, and is pointed to by a .isl file.
.ibdfile is included in a compressed backup by the MySQL Enterprise Backup product, the compressed equivalent is a
- .ibz file
The compression applied during backup is distinct from the compressed row format that keeps table data compressed during normal operation. A compressed backup operation skips the compression step for a tablespace that is already in compressed row format, as compressing a second time would slow down the backup but produce little or no space savings.
- .isl file
A file that specifies the location of an .ibd file for an
InnoDBtable created with the
DATA DIRECTORY =clause in MySQL 5.6 and higher, or with the
CREATE TABLESPACE ... ADD DATAFILEclause in MySQL 5.7.8 and higher. It functions like a symbolic link, without the platform restrictions of the actual symbolic link mechanism. You can store
InnoDBtablespaces outside the database directory, for example, on an especially large or fast storage device depending on the usage of the table. For details, see Section 14.7.5, “Creating a File-Per-Table Tablespace Outside the Data Directory”, and InnoDB General Tablespaces.
- ib-file set
The set of files managed by
InnoDBwithin a MySQL database: the system tablespace, file-per-table tablespace files, and redo log files. Depending on MySQL version and
InnoDBconfiguration, may also include general tablespace, temporary tablespace, and undo tablespace files. This term is sometimes used in detailed discussions of
InnoDBfile structures and formats to refer to the set of files managed by
InnoDBwithin a MySQL database.
A supplemental backup file created by the MySQL Enterprise Backup product during a hot backup operation. It contains information about any data changes that occurred while the backup was running. The initial backup files, including
ibbackup_logfile, are known as a raw backup, because the changes that occurred during the backup operation are not yet incorporated. After you perform the apply step to the raw backup files, the resulting files do include those final data changes, and are known as a prepared backup. At this stage, the
ibbackup_logfilefile is no longer necessary.
- ibdata file
A set of files with names such as
ibdata2, and so on, that make up the InnoDB system tablespace. These files contain metadata about
InnoDBdata dictionary), and the storage areas for one or more undo logs, the change buffer, and the doublewrite buffer. They also can contain some or all of the table data also (depending on whether the file-per-table mode is in effect when each table is created). When the innodb_file_per_table option is enabled, data and indexes for newly created tables are stored in separate .ibd files rather than in the system tablespace.
The growth of the
ibdatafiles is influenced by the
- ibtmp file
InnoDBtemporary tablespace data file for non-compressed
InnoDBtemporary tables and related objects. The configuration file option,
innodb_temp_data_file_path, allows users to define a relative path for the temporary tablespace data file. If
innodb_temp_data_file_pathis not specified, the default behavior is to create a single auto-extending 12MB data file named
ibtmp1in the data directory, alongside
A set of files, typically named
ib_logfile1, that form the redo log. Also sometimes referred to as the log group. These files record statements that attempt to change data in
InnoDBtables. These statements are replayed automatically to correct data written by incomplete transactions, on startup following a crash.
This data cannot be used for manual recovery; for that type of operation, use the binary log.
See Also FULLTEXT index.
- implicit row lock
See Also row lock.
- in-memory database
A type of database system that maintains data in memory, to avoid overhead due to disk I/O and translation between disk blocks and memory areas. Some in-memory databases sacrifice durability (the “D” in the ACID design philosophy) and are vulnerable to hardware, power, and other types of failures, making them more suitable for read-only operations. Other in-memory databases do use durability mechanisms such as logging changes to disk or using non-volatile memory.
MySQL features that address the same kinds of memory-intensive processing include the
InnoDBbuffer pool, adaptive hash index, and read-only transaction optimization, the
MEMORYstorage engine, the
MyISAMkey cache, and the MySQL query cache.
- incremental backup
A type of hot backup, performed by the MySQL Enterprise Backup product, that only saves data changed since some point in time. Having a full backup and a succession of incremental backups lets you reconstruct backup data over a long period, without the storage overhead of keeping several full backups on hand. You can restore the full backup and then apply each of the incremental backups in succession, or you can keep the full backup up-to-date by applying each incremental backup to it, then perform a single restore operation.
The granularity of changed data is at the page level. A page might actually cover more than one row. Each changed page is included in the backup.
InnoDBtables always have a clustered index representing the primary key. They can also have one or more secondary indexes defined on one or more columns. Depending on their structure, secondary indexes can be classified as partial, column, or composite indexes.
Indexes are a crucial aspect of query performance. Database architects design tables, queries, and indexes to allow fast lookups for data needed by applications. The ideal database design uses a covering index where practical; the query results are computed entirely from the index, without reading the actual table data. Each foreign key constraint also requires an index, to efficiently check whether values exist in both the parent and child tables.
Although a B-tree index is the most common, a different kind of data structure is used for hash indexes, as in the
MEMORYstorage engine and the
InnoDBadaptive hash index. R-tree indexes are used for spatial indexing of multi-dimensional information.
See Also adaptive hash index, B-tree, child table, clustered index, column index, composite index, covering index, foreign key, hash index, parent table, partial index, primary key, query, R-tree, row, secondary index, table.
- index cache
A memory area that holds the token data for
InnoDBfull-text search. It buffers the data to minimize disk I/O when data is inserted or updated in columns that are part of a FULLTEXT index. The token data is written to disk when the index cache becomes full. Each
FULLTEXTindex has its own separate index cache, whose size is controlled by the configuration option
- index condition pushdown
Index condition pushdown (ICP) is an optimization that pushes part of a
WHEREcondition down to the storage engine if parts of the condition can be evaluated using fields from the index. ICP can reduce the number of times the storage engine must access the base table and the number of times the MySQL server must access the storage engine. For more information, see Section 126.96.36.199, “Index Condition Pushdown Optimization”.
- index hint
Extended SQL syntax for overriding the indexes recommended by the optimizer. For example, the
USE INDEX, and
IGNORE INDEXclauses. Typically used when indexed columns have unevenly distributed values, resulting in inaccurate cardinality estimates.
- index prefix
In an index that applies to multiple columns (known as a composite index), the initial or leading columns of the index. A query that references the first 1, 2, 3, and so on columns of a composite index can use the index, even if the query does not reference all the columns in the index.
- index statistics
- infimum record
A pseudo-record in an index, representing the gap below the smallest value in that index. If a transaction has a statement such as
SELECT ... FROM ... WHERE col < 10 FOR UPDATE;, and the smallest value in the column is 5, it is a lock on the infimum record that prevents other transactions from inserting even smaller values such as 0, -10, and so on.
The name of the database that provides a query interface to the MySQL data dictionary. (This name is defined by the ANSI SQL standard.) To examine information (metadata) about the database, you can query tables such as
INFORMATION_SCHEMA.COLUMNS, rather than using
SHOWcommands that produce unstructured output.
INFORMATION_SCHEMAdatabase also contains tables specific to InnoDB that provide a query interface to the
InnoDBdata dictionary. You use these tables not to see how the database is structured, but to get real-time information about the workings of
InnoDBtables to help with performance monitoring, tuning, and troubleshooting.
A MySQL component that combines high performance with transactional capability for reliability, robustness, and concurrent access. It embodies the ACID design philosophy. Represented as a storage engine; it handles tables created or altered with the
ENGINE=INNODBclause. See Chapter 14, The InnoDB Storage Engine for architectural details and administration procedures, and Section 8.5, “Optimizing for InnoDB Tables” for performance advice.
In MySQL 5.5 and higher,
InnoDBis the default storage engine for new tables and the
ENGINE=INNODBclause is not required.
InnoDBtables are ideally suited for hot backups. See Section 25.2, “MySQL Enterprise Backup Overview” for information about the MySQL Enterprise Backup product for backing up MySQL servers without interrupting normal processing.
innodb_autoinc_lock_modeoption controls the algorithm used for auto-increment locking. When you have an auto-incrementing primary key, you can use statement-based replication only with the setting
innodb_autoinc_lock_mode=1. This setting is known as consecutive lock mode, because multi-row inserts within a transaction receive consecutive auto-increment values. If you have
innodb_autoinc_lock_mode=2, which allows higher concurrency for insert operations, use row-based replication rather than statement-based replication. This setting is known as interleaved lock mode, because multiple multi-row insert statements running at the same time can receive auto-increment values that are interleaved. The setting
innodb_autoinc_lock_mode=0is the previous (traditional) default setting and should not be used except for compatibility purposes.
innodb_file_formatoption defines the file format to use for new
InnoDBfile-per-table tablespaces. Currently, you can specify the Antelope and Barracuda file formats.
An important configuration option that affects many aspects of
InnoDBfile storage, availability of features, and I/O characteristics. In MySQL 5.6.7 and higher, it is enabled by default. The
innodb_file_per_tableoption turns on file-per-table mode. With this mode enabled, a newly created
InnoDBtable and associated indexes can be stored in a file-per-table .ibd file, outside the system tablespace.
innodb_file_per_tableoption allows you to take advantage of features such as table compression and named-table backups in MySQL Enterprise Backup.
For more information, see
innodb_file_per_table, and Section 14.7.4, “InnoDB File-Per-Table Tablespaces”.
innodb_lock_wait_timeoutoption sets the balance between waiting for shared resources to become available, or giving up and handling the error, retrying, or doing alternative processing in your application. Rolls back any
InnoDBtransaction that waits more than a specified time to acquire a lock. Especially useful if deadlocks are caused by updates to multiple tables controlled by different storage engines; such deadlocks are not detected automatically.
innodb_strict_modeoption controls whether
InnoDBoperates in strict mode, where conditions that are normally treated as warnings, cause errors instead (and the underlying statements fail).
See Also strict mode.
One of the primary DML operations in SQL. The performance of inserts is a key factor in data warehouse systems that load millions of rows into tables, and OLTP systems where many concurrent connections might insert rows into the same table, in arbitrary order. If insert performance is important to you, you should learn about InnoDB features such as the insert buffer used in change buffering, and auto-increment columns.
- insert buffer
The former name of the change buffer. In MySQL 5.5, support was added for buffering changes to secondary index pages for
UPDATEoperations. Previously, only changes resulting from
INSERToperations were buffered. The preferred term is now change buffer.
- insert buffering
The technique of storing changes to secondary index pages, resulting from
INSERToperations, in the change buffer rather than writing the changes immediately, so that the physical writes can be performed to minimize random I/O. It is one of the types of change buffering; the others are delete buffering and purge buffering.
Insert buffering is not used if the secondary index is unique, because the uniqueness of new values cannot be verified before the new entries are written out. Other kinds of change buffering do work for unique indexes.
- insert intention lock
A type of gap lock that is set by
INSERToperations prior to row insertion. This type of lock signals the intent to insert in such a way that multiple transactions inserting into the same index gap need not wait for each other if they are not inserting at the same position within the gap. For more information, see Section 14.5.1, “InnoDB Locking”.
A single mysqld daemon managing a data directory representing one or more databases with a set of tables. It is common in development, testing, and some replication scenarios to have multiple instances on the same server machine, each managing its own data directory and listening on its own port or socket. With one instance running a disk-bound workload, the server might still have extra CPU and memory capacity to run additional instances.
Modifications at the source code level to collect performance data for tuning and debugging. In MySQL, data collected by instrumentation is exposed through an SQL interface using the
- intention exclusive lock
See intention lock.
- intention lock
A kind of lock that applies to the table, used to indicate the kind of lock the transaction intends to acquire on rows in the table. Different transactions can acquire different kinds of intention locks on the same table, but the first transaction to acquire an intention exclusive (IX) lock on a table prevents other transactions from acquiring any S or X locks on the table. Conversely, the first transaction to acquire an intention shared (IS) lock on a table prevents other transactions from acquiring any X locks on the table. The two-phase process allows the lock requests to be resolved in order, without blocking locks and corresponding operations that are compatible. For more information about this locking mechanism, see Section 14.5.1, “InnoDB Locking”.
- intention shared lock
See intention lock.
- inverted index
A data structure optimized for document retrieval systems, used in the implementation of
InnoDBfull-text search. The
InnoDBFULLTEXT index, implemented as an inverted index, records the position of each word within a document, rather than the location of a table row. A single column value (a document stored as a text string) is represented by many entries in the inverted index.
Acronym for I/O operations per second. A common measurement for busy systems, particularly OLTP applications. If this value is near the maximum that the storage devices can handle, the application can become disk-bound, limiting scalability.
- isolation level
One of the foundations of database processing. Isolation is the I in the acronym ACID; the isolation level is the setting that fine-tunes the balance between performance and reliability, consistency, and reproducibility of results when multiple transactions are making changes and performing queries at the same time.
From highest amount of consistency and protection to the least, the isolation levels supported by InnoDB are: SERIALIZABLE, REPEATABLE READ, READ COMMITTED, and READ UNCOMMITTED.
InnoDBtables, many users can keep the default isolation level (REPEATABLE READ) for all operations. Expert users might choose the READ COMMITTED level as they push the boundaries of scalability with OLTP processing, or during data warehousing operations where minor inconsistencies do not affect the aggregate results of large amounts of data. The levels on the edges (SERIALIZABLE and READ UNCOMMITTED) change the processing behavior to such an extent that they are rarely used.
A query that retrieves data from more than one table, by referencing columns in the tables that hold identical values. Ideally, these columns are part of an
InnoDBforeign key relationship, which ensures referential integrity and that the join columns are indexed. Often used to save space and improve query performance by replacing repeated strings with numeric IDs, in a normalized data design.
An option to specify the size of data pages within an
InnoDBtable that uses compressed row format. The default is 8 kilobytes. Lower values risk hitting internal limits that depend on the combination of row size and compression percentage.
KEY_BLOCK_SIZEoptionally specifies the size in bytes to use for index key blocks. The value is treated as a hint; a different size could be used if necessary. A
KEY_BLOCK_SIZEvalue specified for an individual index definition overrides a table-level
See Also compressed row format.
A lightweight structure used by
InnoDBto implement a lock for its own internal memory structures, typically held for a brief time measured in milliseconds or microseconds. A general term that includes both mutexes (for exclusive access) and rw-locks (for shared access). Certain latches are the focus of
InnoDBperformance tuning. Statistics about latch use and contention are available through the Performance Schema interface.
InnoDBbuffer pool is represented as a list of memory pages. The list is reordered as new pages are accessed and enter the buffer pool, as pages within the buffer pool are accessed again and are considered newer, and as pages that are not accessed for a long time are evicted from the buffer pool. The buffer pool is divided into sublists, and the replacement policy is a variation of the familiar LRU technique.
The high-level notion of an object that controls access to a resource, such as a table, row, or internal data structure, as part of a locking strategy. For intensive performance tuning, you might delve into the actual structures that implement locks, such as mutexes and latches.
- lock escalation
An operation used in some database systems that converts many row locks into a single table lock, saving memory space but reducing concurrent access to the table.
InnoDBuses a space-efficient representation for row locks, so that lock escalation is not needed.
- lock mode
An exclusive (X) lock allows a transaction to update or delete a row. No other transaction can acquire any kind of lock on that same row at the same time.
Intention locks apply to the table, and are used to indicate what kind of lock the transaction intends to acquire on rows in the table. Different transactions can acquire different kinds of intention locks on the same table, but the first transaction to acquire an intention exclusive (IX) lock on a table prevents other transactions from acquiring any S or X locks on the table. Conversely, the first transaction to acquire an intention shared (IS) lock on a table prevents other transactions from acquiring any X locks on the table. The two-phase process allows the lock requests to be resolved in order, without blocking locks and corresponding operations that are compatible.
The system of protecting a transaction from seeing or changing data that is being queried or changed by other transactions. The locking strategy must balance reliability and consistency of database operations (the principles of the ACID philosophy) against the performance needed for good concurrency. Fine-tuning the locking strategy often involves choosing an isolation level and ensuring all your database operations are safe and reliable for that isolation level.
- locking read
SELECTstatement that also performs a locking operation on an
SELECT ... FOR UPDATEor
SELECT ... LOCK IN SHARE MODE. It has the potential to produce a deadlock, depending on the isolation level of the transaction. The opposite of a non-locking read. Not allowed for global tables in a read-only transaction.
SELECT ... FOR SHAREreplaces
SELECT ... LOCK IN SHARE MODEin MySQL 8.0.1, but
LOCK IN SHARE MODEremains available for backward compatibility.
InnoDBcontext, “log” or “log files” typically refers to the redo log represented by the ib_logfile
Nfiles. Another type of
InnoDBlog is the undo log, which is a storage area that holds copies of data modified by active transactions.
Other kinds of logs that are important in MySQL are the error log (for diagnosing startup and runtime problems), binary log (for working with replication and performing point-in-time restores), the general query log (for diagnosing application problems), and the slow query log (for diagnosing performance problems).
- log buffer
The memory area that holds data to be written to the log files that make up the redo log. It is controlled by the
- log file
- log group
A type of operation that involves high-level, abstract aspects such as tables, queries, indexes, and other SQL concepts. Typically, logical aspects are important to make database administration and application development convenient and usable. Contrast with physical.
- logical backup
A backup that reproduces table structure and data, without copying the actual data files. For example, the
mysqldumpcommand produces a logical backup, because its output contains statements such as
INSERTthat can re-create the data. Contrast with physical backup. A logical backup offers flexibility (for example, you could edit table definitions or insert statements before restoring), but can take substantially longer to restore than a physical backup.
A prefix added to
InnoDBconfiguration options after server startup, so any new configuration options not recognized by the current level of MySQL do not cause a startup failure. MySQL processes configuration options that start with this prefix, but gives a warning rather than a failure if the part after the prefix is not a recognized option.
See Also startup.
- low-water mark
See Also high-water mark.
An acronym for “least recently used”, a common method for managing storage areas. The items that have not been used recently are evicted when space is needed to cache newer items.
InnoDBuses the LRU mechanism by default to manage the pages within the buffer pool, but makes exceptions in cases where a page might be read only a single time, such as during a full table scan. This variation of the LRU algorithm is called the midpoint insertion strategy. For more information, see Section 188.8.131.52, “The InnoDB Buffer Pool”.
Acronym for “log sequence number”. This arbitrary, ever-increasing value represents a point in time corresponding to operations recorded in the redo log. (This point in time is regardless of transaction boundaries; it can fall in the middle of one or more transactions.) It is used internally by
InnoDBduring crash recovery and for managing the buffer pool.
Prior to MySQL 5.6.3, the LSN was a 4-byte unsigned integer. The LSN became an 8-byte unsigned integer in MySQL 5.6.3 when the redo log file size limit increased from 4GB to 512GB, as additional bytes were required to store extra size information. Applications built on MySQL 5.6.3 or later that use LSN values should use 64-bit rather than 32-bit variables to store and compare LSN values.
In the MySQL Enterprise Backup product, you can specify an LSN to represent the point in time from which to take an incremental backup. The relevant LSN is displayed by the output of the mysqlbackup command. Once you have the LSN corresponding to the time of a full backup, you can specify that value to take a subsequent incremental backup, whose output contains another LSN for the next incremental backup.
- .MRG file
A file containing references to other tables, used by the
MERGEstorage engine. Files with this extension are always included in backups produced by the mysqlbackup command of the MySQL Enterprise Backup product.
- .MYD file
A file that MySQL uses to store data for a
- .MYI file
A file that MySQL uses to store indexes for a
- master server
Frequently shortened to “master”. A database server machine in a replication scenario that processes the initial insert, update, and delete requests for data. These changes are propagated to, and repeated on, other servers known as slave servers.
- master thread
To improve concurrency, sometimes actions are moved from the master thread to separate background threads. For example, in MySQL 5.6 and higher, dirty pages are flushed from the buffer pool by the page cleaner thread rather than the master thread.
See Also metadata lock.
A popular component of many MySQL and NoSQL software stacks, allowing fast reads and writes for single values and caching the results entirely in memory. Traditionally, applications required extra logic to write the same data to a MySQL database for permanent storage, or to read data from a MySQL database when it was not cached yet in memory. Now, applications can use the simple memcached protocol, supported by client libraries for many languages, to communicate directly with MySQL servers using InnoDB or MySQL Cluster tables. These NoSQL interfaces to MySQL tables allow applications to achieve higher read and write performance than by issuing SQL statements directly, and can simplify application logic and deployment configurations for systems that already incorporate memcached for in-memory caching.
The memcached interface to
InnoDBtables is available in MySQL 5.6 and higher; see Section 14.20, “InnoDB memcached Plugin” for details. The memcached interface to MySQL Cluster tables is available in MySQL Cluster 7.2; see http://dev.mysql.com/doc/ndbapi/en/ndbmemcache.html for details.
To apply changes to data cached in memory, such as when a page is brought into the buffer pool, and any applicable changes recorded in the change buffer are incorporated into the page in the buffer pool. The updated data is eventually written to the tablespace by the flush mechanism.
- metadata lock
A type of lock that prevents DDL operations on a table that is being used at the same time by another transaction. For details, see Section 8.11.4, “Metadata Locking”.
Enhancements to online operations, particularly in MySQL 5.6 and higher, are focused on reducing the amount of metadata locking. The objective is for DDL operations that do not change the table structure (such as
InnoDBtables) to proceed while the table is being queried, updated, and so on by other transactions.
- metrics counter
A feature implemented by the
INNODB_METRICStable in the INFORMATION_SCEMA, in MySQL 5.6 and higher. You can query counts and totals for low-level
InnoDBoperations, and use the results for performance tuning in combination with data from the Performance Schema.
- midpoint insertion strategy
The technique of initially bringing pages into the
InnoDBbuffer pool not at the “newest” end of the list, but instead somewhere in the middle. The exact location of this point can vary, based on the setting of the
innodb_old_blocks_pctoption. The intent is that pages that are only read once, such as during a full table scan, can be aged out of the buffer pool sooner than with a strict LRU algorithm. For more information, see Section 184.108.40.206, “The InnoDB Buffer Pool”.
An internal phase of
InnoDBprocessing, when making changes at the physical level to internal data structures during DML operations. A mini-transaction (mtr) has no notion of rollback; multiple mini-transactions can occur within a single transaction. Mini-transactions write information to the redo log that is used during crash recovery. A mini-transaction can also happen outside the context of a regular transaction, for example during purge processing by background threads.
- mixed-mode insert
INSERTstatement where auto-increment values are specified for some but not all of the new rows. For example, a multi-value
INSERTcould specify a value for the auto-increment column in some cases and
NULLin other cases.
InnoDBgenerates auto-increment values for the rows where the column value was specified as
NULL. Another example is an
INSERT ... ON DUPLICATE KEY UPDATEstatement, where auto-increment values might be generated but not used, for any duplicate rows that are processed as
Can cause consistency issues between master and slave servers in a replication configuration. Can require adjusting the value of the innodb_autoinc_lock_mode configuration option.
- multiversion concurrency control
Informal abbreviation for “mutex variable”. (Mutex itself is short for “mutual exclusion”.) The low-level object that
InnoDBuses to represent and enforce exclusive-access locks to internal in-memory data structures. Once the lock is acquired, any other process, thread, and so on is prevented from acquiring the same lock. Contrast with rw-locks, which
InnoDBuses to represent and enforce shared-access locks to internal in-memory data structures. Mutexes and rw-locks are known collectively as latches.
Acronym for “multiversion concurrency control”. This technique lets
InnoDBtransactions with certain isolation levels perform consistent read operations; that is, to query rows that are being updated by other transactions, and see the values from before those updates occurred. This is a powerful technique to increase concurrency, by allowing queries to proceed without waiting due to locks held by the other transactions.
This technique is not universal in the database world. Some other database products, and some other MySQL storage engines, do not support it.
- MySQL Enterprise Backup
- mysqlbackup command
A command-line tool of the MySQL Enterprise Backup product. It performs a hot backup operation for
InnoDBtables, and a warm backup for
MyISAMand other kinds of tables. See Section 25.2, “MySQL Enterprise Backup Overview” for more information about this command.
The mysqld program is the database engine for the MySQL database. It runs as a Unix daemon or Windows service, constantly waiting for requests and performing maintenance work in the background.
See Also mysql.
A command that performs a logical backup of some combination of databases, tables, and table data. The results are SQL statements that reproduce the original schema objects, data, or both. For substantial amounts of data, a physical backup solution such as MySQL Enterprise Backup is faster, particularly for the restore operation.
- natural key
If the value should ever change, there is potentially a lot of index maintenance to re-sort the clustered index and update the copies of the primary key value that are repeated in each secondary index.
Even seemingly stable values can change in unpredictable ways that are difficult to represent correctly in the database. For example, one country can change into two or several, making the original country code obsolete. Or, rules about unique values might have exceptions. For example, even if taxpayer IDs are intended to be unique to a single person, a database might have to handle records that violate that rule, such as in cases of identity theft. Taxpayer IDs and other sensitive ID numbers also make poor primary keys, because they may need to be secured, encrypted, and otherwise treated differently than other columns.
Thus, it is typically better to use arbitrary numeric values to form a synthetic key, for example using an auto-increment column.
- neighbor page
Any page in the same extent as a particular page. When a page is selected to be flushed, any neighbor pages that are dirty are typically flushed as well, as an I/O optimization for traditional hard disks. In MySQL 5.6 and up, this behavior can be controlled by the configuration variable
innodb_flush_neighbors; you might turn that setting off for SSD drives, which do not have the same overhead for writing smaller batches of data at random locations.
- next-key lock
A combination of a record lock on the index record and a gap lock on the gap before the index record.
- non-blocking I/O
See Also asynchronous I/O.
- non-locking read
A query that does not use the
SELECT ... FOR UPDATEor
SELECT ... LOCK IN SHARE MODEclauses. The only kind of query allowed for global tables in a read-only transaction. The opposite of a locking read. See Section 220.127.116.11, “Consistent Nonlocking Reads”.
SELECT ... FOR SHAREreplaces
SELECT ... LOCK IN SHARE MODEin MySQL 8.0.1, but
LOCK IN SHARE MODEremains available for backward compatibility.
- non-repeatable read
The situation when a query retrieves data, and a later query within the same transaction retrieves what should be the same data, but the queries return different results (changed by another transaction committing in the meantime).
This kind of operation goes against the ACID principle of database design. Within a transaction, data should be consistent, with predictable and stable relationships.
Among different isolation levels, non-repeatable reads are prevented by the serializable read and repeatable read levels, and allowed by the consistent read, and read uncommitted levels.
A database design strategy where data is split into multiple tables, and duplicate values condensed into single rows represented by an ID, to avoid storing, querying, and updating redundant or lengthy values. It is typically used in OLTP applications.
For example, an address might be given a unique ID, so that a census database could represent the relationship lives at this address by associating that ID with each member of a family, rather than storing multiple copies of a complex value such as 123 Main Street, Anytown, USA.
For another example, although a simple address book application might store each phone number in the same table as a person's name and address, a phone company database might give each phone number a special ID, and store the numbers and IDs in a separate table. This normalized representation could simplify large-scale updates when area codes split apart.
Normalization is not always recommended. Data that is primarily queried, and only updated by deleting entirely and reloading, is often kept in fewer, larger tables with redundant copies of duplicate values. This data representation is referred to as denormalized, and is frequently found in data warehousing applications.
A broad term for a set of data access technologies that do not use the SQL language as their primary mechanism for reading and writing data. Some NoSQL technologies act as key-value stores, only accepting single-value reads and writes; some relax the restrictions of the ACID methodology; still others do not require a pre-planned schema. MySQL users can combine NoSQL-style processing for speed and simplicity with SQL operations for flexibility and convenience, by using the memcached API to directly access some kinds of MySQL tables. The memcached interface to
InnoDBtables is available in MySQL 5.6 and higher; see Section 14.20, “InnoDB memcached Plugin” for details. The memcached interface to MySQL Cluster tables is available in MySQL Cluster 7.2; see ndbmemcache—Memcache API for NDB Cluster.
- NOT NULL constraint
A type of constraint that specifies that a column cannot contain any NULL values. It helps to preserve referential integrity, as the database server can identify data with erroneous missing values. It also helps in the arithmetic involved in query optimization, allowing the optimizer to predict the number of entries in an index on that column.
A special value in SQL, indicating the absence of data. Any arithmetic operation or equality test involving a
NULLvalue, in turn produces a
NULLresult. (Thus it is similar to the IEEE floating-point concept of NaN, “not a number”.) Any aggregate calculation such as
AVG()ignores rows with
NULLvalues, when determining how many rows to divide by. The only test that works with
NULLvalues uses the SQL idioms
IS NOT NULL.
NULLvalues play a part in index operations, because for performance a database must minimize the overhead of keeping track of missing data values. Typically,
NULLvalues are not stored in an index, because a query that tests an indexed column using a standard comparison operator could never match a row with a
NULLvalue for that column. For the same reason, unique indexes do not prevent
NULLvalues; those values simply are not represented in the index. Declaring a
NOT NULLconstraint on a column provides reassurance that there are no rows left out of the index, allowing for better query optimization (accurate counting of rows and estimation of whether to use the index).
Because the primary key must be able to uniquely identify every row in the table, a single-column primary key cannot contain any
NULLvalues, and a multi-column primary key cannot contain any rows with
NULLvalues in all columns.
Although the Oracle database allows a
NULLvalue to be concatenated with a string,
InnoDBtreats the result of such an operation as
- .OPT file
- off-page column
A column containing variable-length data (such as
VARCHAR) that is too long to fit on a B-tree page. The data is stored in overflow pages. The DYNAMIC row format is more efficient for such storage than the older COMPACT row format.
Acronym for “Online Transaction Processing”. A database system, or a database application, that runs a workload with many transactions, with frequent writes as well as reads, typically affecting small amounts of data at a time. For example, an airline reservation system or an application that processes bank deposits. The data might be organized in normalized form for a balance between DML (insert/update/delete) efficiency and query efficiency. Contrast with data warehouse.
With its row-level locking and transactional capability, InnoDB is the ideal storage engine for MySQL tables used in OLTP applications.
A type of operation that involves no downtime, blocking, or restricted operation for the database. Typically applied to DDL. Operations that shorten the periods of restricted operation, such as fast index creation, have evolved into a wider set of online DDL operations in MySQL 5.6.
In the context of backups, a hot backup is an online operation and a warm backup is partially an online operation.
- online DDL
The details vary according to the type of operation. In some cases, the table can be modified concurrently while the
ALTER TABLEis in progress. The operation might be able to be performed without a table copy, or using a specially optimized type of table copy. Space usage is controlled by the
This feature is an enhancement of the Fast Index Creation feature in MySQL 5.5.
A methodology that guides low-level implementation decisions for a relational database system. The requirements of performance and concurrency in a relational database mean that operations must be started or dispatched quickly. The requirements of consistency and referential integrity mean that any operation could fail: a transaction might be rolled back, a DML operation could violate a constraint, a request for a lock could cause a deadlock, a network error could cause a timeout. An optimistic strategy is one that assumes most requests or attempts will succeed, so that relatively little work is done to prepare for the failure case. When this assumption is true, the database does little unnecessary work; when requests do fail, extra work must be done to clean up and undo changes.
InnoDBuses optimistic strategies for operations such as locking and commits. For example, data changed by a transaction can be written to the data files before the commit occurs, making the commit itself very fast, but requiring more work to undo the changes if the transaction is rolled back.
The opposite of an optimistic strategy is a pessimistic one, where a system is optimized to deal with operations that are unreliable and frequently unsuccessful. This methodology is rare in a database system, because so much care goes into choosing reliable hardware, networks, and algorithms.
For the options that apply to InnoDB tables, each option name starts with the prefix
- option file
- overflow page
- .PAR file
With the introduction of native partitioning support for
InnoDBtables in MySQL 5.7.6,
.PARfiles are no longer created for partitioned
A unit representing how much data
InnoDBtransfers at any one time between disk (the data files) and memory (the buffer pool). A page can contain one or more rows, depending on how much data is in each row. If a row does not fit entirely into a single page,
InnoDBsets up additional pointer-style data structures so that the information about the row can be stored in one page.
One way to fit more data in each page is to use compressed row format. For tables that use BLOBs or large text fields, compact row format allows those large columns to be stored separately from the rest of the row, reducing I/O overhead and memory usage for queries that do not reference those columns.
InnoDBreads or writes sets of pages as a batch to increase I/O throughput, it reads or writes an extent at a time.
InnoDBdisk data structures within a MySQL instance share the same page size.
- page cleaner
InnoDBbackground thread that flushes dirty pages from the buffer pool. Prior to MySQL 5.6, this activity was performed by the master thread. The number of page cleaner threads is controlled by the
innodb_page_cleanersconfiguration option, introduced in MySQL 5.7.4.
- page size
For releases up to and including MySQL 5.5, the size of each
InnoDBpage is fixed at 16 kilobytes. This value represents a balance: large enough to hold the data for most rows, yet small enough to minimize the performance overhead of transferring unneeded data to memory. Other values are not tested or supported.
Starting in MySQL 5.6, the page size for an
InnoDBinstance can be either 4KB, 8KB, or 16KB, controlled by the
innodb_page_sizeconfiguration option. As of MySQL 5.7.6,
InnoDBalso supports 32KB and 64KB page sizes. For 32KB and 64KB page sizes,
ROW_FORMAT=COMPRESSEDis not supported and the maximum record size is 16KB.
Page size is set when creating the MySQL instance, and it remains constant afterward. The same page size applies to all
InnoDBtablespaces, including the system tablespace, file-per-table tablespaces, and general tablespaces.
Smaller page sizes can help performance with storage devices that use small block sizes, particularly for SSD devices in disk-bound workloads, such as for OLTP applications. As individual rows are updated, less data is copied into memory, written to disk, reorganized, locked, and so on.
- parent table
The table in a foreign key relationship that holds the initial column values pointed to from the child table. The consequences of deleting, or updating rows in the parent table depend on the
ON DELETEclauses in the foreign key definition. Rows with corresponding values in the child table could be automatically deleted or updated in turn, or those columns could be set to
NULL, or the operation could be prevented.
- partial backup
- partial index
- Performance Schema
performance_schemaschema, in MySQL 5.5 and up, presents a set of tables that you can query to get detailed information about the performance characteristics of many internal parts of the MySQL server. See Chapter 22, MySQL Performance Schema.
- persistent statistics
A feature in MySQL 5.6 that stores index statistics for
InnoDBtables on disk, providing better plan stability for queries. For more information, see Section 18.104.22.168, “Configuring Persistent Optimizer Statistics Parameters”.
A methodology that sacrifices performance or concurrency in favor of safety. It is appropriate if a high proportion of requests or attempts might fail, or if the consequences of a failed request are severe.
InnoDBuses what is known as a pessimistic locking strategy, to minimize the chance of deadlocks. At the application level, you might avoid deadlocks by using a pessimistic strategy of acquiring all locks needed by a transaction at the very beginning.
Many built-in database mechanisms use the opposite optimistic methodology.
A row that appears in the result set of a query, but not in the result set of an earlier query. For example, if a query is run twice within a transaction, and in the meantime, another transaction commits after inserting a new row or updating a row so that it matches the
WHEREclause of the query.
This occurrence is known as a phantom read. It is harder to guard against than a non-repeatable read, because locking all the rows from the first query result set does not prevent the changes that cause the phantom to appear.
Among different isolation levels, phantom reads are prevented by the serializable read level, and allowed by the repeatable read, consistent read, and read uncommitted levels.
A type of operation that involves hardware-related aspects such as disk blocks, memory pages, files, bits, disk reads, and so on. Typically, physical aspects are important during expert-level performance tuning and problem diagnosis. Contrast with logical.
- physical backup
A backup that copies the actual data files. For example, the
mysqlbackupcommand of the MySQL Enterprise Backup product produces a physical backup, because its output contains data files that can be used directly by the
mysqldserver, resulting in a faster restore operation. Contrast with logical backup.
See Also point-in-time recovery.
- plan stability
- point-in-time recovery
The process of restoring a backup to recreate the state of the database at a specific date and time. Commonly abbreviated “PITR”. Because it is unlikely that the specified time corresponds exactly to the time of a backup, this technique usually requires a combination of a physical backup and a logical backup. For example, with the MySQL Enterprise Backup product, you restore the last backup that you took before the specified point in time, then replay changes from the binary log between the time of the backup and the PITR time.
See index prefix.
- prepared backup
A set of backup files, produced by the MySQL Enterprise Backup product, after all the stages of applying binary logs and incremental backups are finished. The resulting files are ready to be restored. Prior to the apply steps, the files are known as a raw backup.
- primary key
InnoDBrequires that every table has such an index (also called the clustered index or cluster index), and organizes the table storage based on the column values of the primary key.
When choosing primary key values, consider using arbitrary values (a synthetic key) rather than relying on values derived from some other source (a natural key).
An instance of an executing program. The operating system switches between multiple running processes, allowing for a certain degree of concurrency. On most operating systems, processes can contain multiple threads of execution that share resources. Context-switching between threads is faster than the equivalent switching between processes.
See Also mutex.
A type of garbage collection performed by one or more separate background threads (controlled by
innodb_purge_threads) that runs on a periodic schedule. Purge parses and processes undo log pages from the history list for the purpose of removing clustered and secondary index records that were marked for deletion (by previous
DELETEstatements) and are no longer required for MVCC or rollback. Purge frees undo log pages from the history list after processing them.
- purge buffering
The technique of storing changes to secondary index pages, resulting from
DELETEoperations, in the change buffer rather than writing the changes immediately, so that the physical writes can be performed to minimize random I/O. (Because delete operations are a two-step process, this operation buffers the write that normally purges an index record that was previously marked for deletion.) It is one of the types of change buffering; the others are insert buffering and delete buffering.
- purge lag
Another name for the
InnoDBhistory list. Related to the
- purge thread
A thread within the
InnoDBprocess that is dedicated to performing the periodic purge operation. In MySQL 5.6 and higher, multiple purge threads are enabled by the
In SQL, an operation that reads information from one or more tables. Depending on the organization of data and the parameters of the query, the lookup might be optimized by consulting an index. If multiple tables are involved, the query is known as a join.
For historical reasons, sometimes discussions of internal processing for statements use “query” in a broader sense, including other types of MySQL statements such as DDL and DML statements.
- query execution plan
The set of decisions made by the optimizer about how to perform a query most efficiently, including which index or indexes to use, and the order in which to join tables. Plan stability involves the same choices being made consistently for a given query.
- query log
See general query log.
To reduce the amount of database activity, often in preparation for an operation such as an
ALTER TABLE, a backup, or a shutdown. Might or might not involve doing as much flushing as possible, so that InnoDB does not continue doing background I/O.
In MySQL 5.6 and higher, the syntax
FLUSH TABLES ... FOR EXPORTwrites some data to disk for
InnoDBtables that make it simpler to back up those tables by copying the data files.
See Also B-tree.
Acronym for “Redundant Array of Inexpensive Drives”. Spreading I/O operations across multiple drives enables greater concurrency at the hardware level, and improves the efficiency of low-level write operations that otherwise would be performed in sequence.
See Also concurrency.
- random dive
A technique for quickly estimating the number of different values in a column (the column's cardinality).
InnoDBsamples pages at random from the index and uses that data to estimate the number of different values.
See Also cardinality.
- raw backup
The initial set of backup files produced by the MySQL Enterprise Backup product, before the changes reflected in the binary log and any incremental backups are applied. At this stage, the files are not ready to restore. After these changes are applied, the files are known as a prepared backup.
- READ COMMITTED
An isolation level that uses a locking strategy that relaxes some of the protection between transactions, in the interest of performance. Transactions cannot see uncommitted data from other transactions, but they can see data that is committed by another transaction after the current transaction started. Thus, a transaction never sees any bad data, but the data that it does see may depend to some extent on the timing of other transactions.
When a transaction with this isolation level performs
UPDATE ... WHEREor
DELETE ... WHEREoperations, other transactions might have to wait. The transaction can perform
SELECT ... FOR UPDATE, and
LOCK IN SHARE MODEoperations without making other transactions wait.
SELECT ... FOR SHAREreplaces
SELECT ... LOCK IN SHARE MODEin MySQL 8.0.1, but
LOCK IN SHARE MODEremains available for backward compatibility.
- read phenomena
- READ UNCOMMITTED
The isolation level that provides the least amount of protection between transactions. Queries employ a locking strategy that allows them to proceed in situations where they would normally wait for another transaction. However, this extra performance comes at the cost of less reliable results, including data that has been changed by other transactions and not committed yet (known as dirty read). Use this isolation level with great caution, and be aware that the results might not be consistent or reproducible, depending on what other transactions are doing at the same time. Typically, transactions with this isolation level only do queries, not insert, update, or delete operations.
- read view
An internal snapshot used by the MVCC mechanism of
InnoDB. Certain transactions, depending on their isolation level, see the data values as they were at the time the transaction (or in some cases, the statement) started. Isolation levels that use a read view are REPEATABLE READ, READ COMMITTED, and READ UNCOMMITTED.
A type of I/O request that prefetches a group of pages (an entire extent) into the buffer pool asynchronously, in anticipation that these pages will be needed soon. The linear read-ahead technique prefetches all the pages of one extent based on access patterns for pages in the preceding extent. The random read-ahead technique prefetches all the pages for an extent once a certain number of pages from the same extent are in the buffer pool. Random read-ahead is not part of MySQL 5.5, but is re-introduced in MySQL 5.6 under the control of the
- read-only transaction
A type of transaction that can be optimized for
InnoDBtables by eliminating some of the bookkeeping involved with creating a read view for each transaction. Can only perform non-locking read queries. It can be started explicitly with the syntax
START TRANSACTION READ ONLY, or automatically under certain conditions. See Section 8.5.3, “Optimizing InnoDB Read-Only Transactions” for details.
- record lock
A lock on an index record. For example,
SELECT c1 FROM t WHERE c1 = 10 FOR UPDATE;prevents any other transaction from inserting, updating, or deleting rows where the value of
t.c1is 10. Contrast with gap lock and next-key lock.
The data, in units of records, recorded in the redo log when DML statements make changes to
InnoDBtables. It is used during crash recovery to correct data written by incomplete transactions. The ever-increasing LSN value represents the cumulative amount of redo data that has passed through the redo log.
- redo log
A disk-based data structure used during crash recovery, to correct data written by incomplete transactions. During normal operation, it encodes requests to change
InnoDBtable data, which result from SQL statements or low-level API calls through NoSQL interfaces. Modifications that did not finish updating the data files before an unexpected shutdown are replayed automatically.
The redo log is physically represented as a set of files, typically named
ib_logfile1. The data in the redo log is encoded in terms of records affected; this data is collectively referred to as redo. The passage of data through the redo logs is represented by the ever-increasing LSN value. The original 4GB limit on maximum size for the redo log is raised to 512GB in MySQL 5.6.3.
The disk layout of the redo log is influenced by the configuration options
innodb_log_group_home_dir, and (rarely)
innodb_log_files_in_group. The performance of redo log operations is also affected by the log buffer, which is controlled by the
- redundant row format
InnoDBrow format. Prior to MySQL 5.0.3, it was the only row format available in
InnoDB. From MySQL 5.0.3 to MySQL 5.7.8, the default row format is COMPACT. As of MySQL 5.7.9, the default row format is defined by the
innodb_default_row_formatconfiguration option, which has a default setting of DYNAMIC. You can still specify the REDUNDANT row format for compatibility with older
For more information, see Section 14.11.4, “COMPACT and REDUNDANT Row Formats”.
- referential integrity
The technique of maintaining data always in a consistent format, part of the ACID philosophy. In particular, data in different tables is kept consistent through the use of foreign key constraints, which can prevent changes from happening or automatically propagate those changes to all related tables. Related mechanisms include the unique constraint, which prevents duplicate values from being inserted by mistake, and the NOT NULL constraint, which prevents blank values from being inserted by mistake.
An important aspect of modern database systems. The database server encodes and enforces relationships such as one-to-one, one-to-many, many-to-one, and uniqueness. For example, a person might have zero, one, or many phone numbers in an address database; a single phone number might be associated with several family members. In a financial database, a person might be required to have exactly one taxpayer ID, and any taxpayer ID could only be associated with one person.
The database server can use these relationships to prevent bad data from being inserted, and to find efficient ways to look up information. For example, if a value is declared to be unique, the server can stop searching as soon as the first match is found, and it can reject attempts to insert a second copy of the same value.
At the database level, these relationships are expressed through SQL features such as columns within a table, unique and
NOT NULLconstraints, foreign keys, and different kinds of join operations. Complex relationships typically involve data split between more than one table. Often, the data is normalized, so that duplicate values in one-to-many relationships are stored only once.
In a mathematical context, the relations within a database are derived from set theory. For example, the
ANDoperators of a
WHEREclause represent the notions of union and intersection.
In the full-text search feature, a number signifying the similarity between the search string and the data in the FULLTEXT index. For example, when you search for a single word, that word is typically more relevant for a row where it occurs several times in the text than a row where it appears only once.
- REPEATABLE READ
The default isolation level for
InnoDB. It prevents any rows that are queried from being changed by other transactions, thus blocking non-repeatable reads but not phantom reads. It uses a moderately strict locking strategy so that all queries within a transaction see data from the same snapshot, that is, the data as it was at the time the transaction started.
When a transaction with this isolation level performs
UPDATE ... WHERE,
DELETE ... WHERE,
SELECT ... FOR UPDATE, and
LOCK IN SHARE MODEoperations, other transactions might have to wait.
SELECT ... FOR SHAREreplaces
SELECT ... LOCK IN SHARE MODEin MySQL 8.0.1, but
LOCK IN SHARE MODEremains available for backward compatibility.
The practice of sending changes from a master database, to one or more slave databases, so that all databases have the same data. This technique has a wide range of uses, such as load-balancing for better scalability, disaster recovery, and testing software upgrades and configuration changes. The changes can be sent between the database by methods called row-based replication and statement-based replication.
The process of putting a set of backup files from the MySQL Enterprise Backup product in place for use by MySQL. This operation can be performed to fix a corrupted database, to return to some earlier point in time, or (in a replication context) to set up a new slave database. In the MySQL Enterprise Backup product, this operation is performed by the
copy-backoption of the
By default, MySQL uses the autocommit setting, which automatically issues a commit following each SQL statement. You must change this setting before you can use the rollback technique.
- rollback segment
InnoDBuses the term row format for consistency with MySQL syntax, the row format is a property of each table and applies to all rows in that table.
- row format
The disk storage format for rows of an
InnoDBgains new capabilities such as compression, new row formats are introduced to support the resulting improvements in storage efficiency and performance.
The row format of an
InnoDBtable is specified by the
ROW_FORMAToption or by the
innodb_default_row_formatconfiguration option (introduced in MySQL 5.7.9). Row formats include
DYNAMIC. To view the row format of an
InnoDBtable, issue the
SHOW TABLE STATUSstatement or query
INFORMATION_SCHEMA.INNODB_SYS_TABLES(available in MySQL 5.6 or higher).
- row lock
A lock that prevents a row from being accessed in an incompatible way by another transaction. Other rows in the same table can be freely written to by other transactions. This is the type of locking done by DML operations on InnoDB tables.
Contrast with table locks used by
MyISAM, or during DDL operations on
InnoDBtables that cannot be done with online DDL; those locks block concurrent access to the table.
- row-based replication
A form of replication where events are propagated from the master server specifying how to change individual rows on the slave server. It is safe to use for all settings of the
- row-level locking
The locking mechanism used for InnoDB tables, relying on row locks rather than table locks. Multiple transactions can modify the same table concurrently. Only if two transactions try to modify the same row does one of the transactions wait for the other to complete (and release its row locks).
The low-level object that
InnoDBuses to represent and enforce shared-access locks to internal in-memory data structures following certain rules. Contrast with mutexes, which
InnoDBuses to represent and enforce exclusive access to internal in-memory data structures. Mutexes and rw-locks are known collectively as latches.
x-locks(exclusive locks), and
s-lockprovides read access to a common resource.
x-lockprovides write access to a common resource while not permitting inconsistent reads by other threads.
sx-lockprovides write access to a common resource while permitting inconsistent reads by other threads.
sx-lockswere introduced in MySQL 5.7 to optimize concurrency and improve scalability for read-write workloads.
The following matrix summarizes rw-lock type compatibility.
Compatible Compatible Conflict
Compatible Conflict Conflict
Conflict Conflict Conflict
Savepoints help to implement nested transactions. They can be used to provide scope to operations on tables that are part of a larger transaction. For example, scheduling a trip in a reservation system might involve booking several different flights; if a desired flight is unavailable, you might roll back the changes involved in booking that one leg, without rolling back the earlier flights that were successfully booked.
The ability to add more work and issue more simultaneous requests to a system, without a sudden drop in performance due to exceeding the limits of system capacity. Software architecture, hardware configuration, application coding, and type of workload all play a part in scalability. When the system reaches its maximum capacity, popular techniques for increasing scalability are scale up (increasing the capacity of existing hardware or software) and scale out (adding new servers and more instances of MySQL). Often paired with availability as critical aspects of a large-scale deployment.
- scale out
A technique for increasing scalability by adding new servers and more instances of MySQL. For example, setting up replication, MySQL Cluster, connection pooling, or other features that spread work across a group of servers. Contrast with scale up.
- scale up
A technique for increasing scalability by increasing the capacity of existing hardware or software. For example, increasing the memory on a server and adjusting memory-related parameters such as
innodb_buffer_pool_instances. Contrast with scale out.
Conceptually, a schema is a set of interrelated database objects, such as tables, table columns, data types of the columns, indexes, foreign keys, and so on. These objects are connected through SQL syntax, because the columns make up the tables, the foreign keys refer to tables and columns, and so on. Ideally, they are also connected logically, working together as part of a unified application or flexible framework. For example, the INFORMATION_SCHEMA and performance_schema databases use “schema” in their names to emphasize the close relationships between the tables and columns they contain.
In MySQL, physically, a schema is synonymous with a database. You can substitute the keyword
DATABASEin MySQL SQL syntax, for example using
CREATE SCHEMAinstead of
Some other database products draw a distinction. For example, in the Oracle Database product, a schema represents only a part of a database: the tables and other objects owned by a single user.
- search index
In MySQL, full-text search queries use a special kind of index, the FULLTEXT index. In MySQL 5.6.4 and up,
MyISAMtables both support
FULLTEXTindexes; formerly, these indexes were only available for
- secondary index
A type of
InnoDBindex that represents a subset of table columns. An
InnoDBtable can have zero, one, or many secondary indexes. (Contrast with the clustered index, which is required for each
InnoDBtable, and stores the data for all the table columns.)
A secondary index can be used to satisfy queries that only require values from the indexed columns. For more complex queries, it can be used to identify the relevant rows in the table, which are then retrieved through lookups using the clustered index.
Creating and dropping secondary indexes has traditionally involved significant overhead from copying all the data in the
InnoDBtable. The fast index creation feature makes both
DROP INDEXstatements much faster for
For example, within a file-per-table tablespace, table data is in one segment and each associated index is in its own segment. The system tablespace contains many different segments, because it can hold many tables and their associated indexes. The system tablespace also includes one or more rollback segments used for undo logs.
Segments grow and shrink as data is inserted and deleted. When a segment needs more room, it is extended by one extent (1 megabyte) at a time. Similarly, a segment releases one extent's worth of space when all the data in that extent is no longer needed.
A property of data distribution, the number of distinct values in a column (its cardinality) divided by the number of records in the table. High selectivity means that the column values are relatively unique, and can retrieved efficiently through an index. If you (or the query optimizer) can predict that a test in a
WHEREclause only matches a small number (or proportion) of rows in a table, the overall query tends to be efficient if it evaluates that test first, using an index.
- semi-consistent read
A type of read operation used for
UPDATEstatements, that is a combination of READ COMMITTED and consistent read. When an
UPDATEstatement examines a row that is already locked,
InnoDBreturns the latest committed version to MySQL so that MySQL can determine whether the row matches the
WHEREcondition of the
UPDATE. If the row matches (must be updated), MySQL reads the row again, and this time
InnoDBeither locks it or waits for a lock on it. This type of read operation can only happen when the transaction has the READ COMMITTED isolation level, or when the
innodb_locks_unsafe_for_binlogoption is enabled.
innodb_locks_unsafe_for_binlogwas removed in MySQL 8.0.
The isolation level that uses the most conservative locking strategy, to prevent any other transactions from inserting or changing data that was read by this transaction, until it is finished. This way, the same query can be run over and over within a transaction, and be certain to retrieve the same set of results each time. Any attempt to change data that was committed by another transaction since the start of the current transaction, cause the current transaction to wait.
This is the default isolation level specified by the SQL standard. In practice, this degree of strictness is rarely needed, so the default isolation level for
InnoDBis the next most strict, REPEATABLE READ.
A type of program that runs continuously, waiting to receive and act upon requests from another program (the client). Because often an entire computer is dedicated to running one or more server programs (such as a database server, a web server, an application server, or some combination of these), the term server can also refer to the computer that runs the server software.
- shared lock
- shared tablespace
- sharp checkpoint
The process of flushing to disk all dirty buffer pool pages whose redo entries are contained in certain portion of the redo log. Occurs before
InnoDBreuses a portion of a log file; the log files are used in a circular fashion. Typically occurs with write-intensive workloads.
The process of stopping the MySQL server. By default, this process cleans up operations for InnoDB tables, so
InnoDBcan be slow to shut down, but fast to start up later. If you skip the cleanup operations, it is fast to shut down but the cleanup must be performed during the next restart.
The shutdown mode for
InnoDBis controlled by the
- slave server
Frequently shortened to “slave”. A database server machine in a replication scenario that receives changes from another server (the master) and applies those same changes. Thus it maintains the same contents as the master, although it might lag somewhat behind.
In MySQL, slave servers are commonly used in disaster recovery, to take the place of a master servers that fails. They are also commonly used for testing software upgrades and new settings, to ensure that database configuration changes do not cause problems with performance or reliability.
Slave servers typically have high workloads, because they process all the DML (write) operations relayed from the master, as well as user queries. To ensure that slave servers can apply changes from the master fast enough, they frequently have fast I/O devices and sufficient CPU and memory to run multiple database instances on the same slave server. For example, the master server might use hard drive storage while the slave servers use SSDs.
- slow query log
A type of log used for performance tuning of SQL statements processed by the MySQL server. The log information is stored in a file. You must enable this feature to use it. You control which categories of “slow” SQL statements are logged. For more information, see Section 5.4.5, “The Slow Query Log”.
- slow shutdown
A type of shutdown that does additional
InnoDBflushing operations before completing. Also known as a clean shutdown. Specified by the configuration parameter
innodb_fast_shutdown=0or the command
SET GLOBAL innodb_fast_shutdown=0;. Although the shutdown itself can take longer, that time will be saved on the subsequent startup.
- sort buffer
The buffer used for sorting data during creation of an
InnoDBindex. Sort buffer size is configured using the
- space ID
An identifier used to uniquely identify an
InnoDBtablespace within a MySQL instance. The space ID for the system tablespace is always zero; this same ID applies to all tables within the system tablespace or within a general tablespace. Each file-per-table tablespace and general tablespace has its own space ID.
Prior to MySQL 5.6, this hardcoded value presented difficulties in moving
InnoDBtablespace files between MySQL instances. Starting in MySQL 5.6, you can copy tablespace files between instances by using the transportable tablespace feature involving the statements
FLUSH TABLES ... FOR EXPORT,
ALTER TABLE ... DISCARD TABLESPACE, and
ALTER TABLE ... IMPORT TABLESPACE. The information needed to adjust the space ID is conveyed in the .cfg file which you copy along with the tablespace. See Section 14.7.6, “Copying File-Per-Table Tablespaces to Another Server” for details.
- sparse file
A type of file that uses file system space more efficiently by writing metadata representing empty blocks to disk instead of writing the actual empty space. The
InnoDBtransparent page compression feature relies on sparse file support. For more information, see InnoDB Page Compression.
A type of wait operation that continuously tests whether a resource becomes available. This technique is used for resources that are typically held only for brief periods, where it is more efficient to wait in a “busy loop” than to put the thread to sleep and perform a context switch. If the resource does not become available within a short time, the spin loop ceases and another wait technique is used.
The Structured Query Language that is standard for performing database operations. Often divided into the categories DDL, DML, and queries. MySQL includes some additional statement categories such as replication. See Chapter 9, Language Structure for the building blocks of SQL syntax, Chapter 11, Data Types for the data types to use for MySQL table columns, Chapter 13, SQL Statement Syntax for details about SQL statements and their associated categories, and Chapter 12, Functions and Operators for standard and MySQL-specific functions to use in queries.
Acronym for “solid-state drive”. A type of storage device with different performance characteristics than a traditional hard disk drive (HDD): smaller storage capacity, faster for random reads, no moving parts, and with a number of considerations affecting write performance. Its performance characteristics can influence the throughput of a disk-bound workload.
The process of starting the MySQL server. Typically done by one of the programs listed in Section 4.3, “MySQL Server and Server-Startup Programs”. The opposite of shutdown.
See Also shutdown.
- statement-based replication
A form of replication where SQL statements are sent from the master server and replayed on the slave server. It requires some care with the setting for the
innodb_autoinc_lock_modeoption, to avoid potential timing problems with auto-increment locking.
Estimated values relating to each
InnoDBtable and index, used to construct an efficient query execution plan. The main values are the cardinality (number of distinct values) and the total number of table rows or index entries. The statistics for the table represent the data in its primary key index. The statistics for a secondary index represent the rows covered by that index.
The values are estimated rather than counted precisely because at any moment, different transactions can be inserting and deleting rows from the same table. To keep the values from being recalculated frequently, you can enable persistent statistics, where the values are stored in
InnoDBsystem tables, and refreshed only when you issue an
You can control how NULL values are treated when calculating statistics through the
Other types of statistics are available for database objects and database activity through the INFORMATION_SCHEMA and PERFORMANCE_SCHEMA tables.
The ability to search for different variations of a word based on a common root word, such as singular and plural, or past, present, and future verb tense. This feature is currently supported in
MyISAMfull-text search feature but not in FULLTEXT indexes for
In a FULLTEXT index, a word that is considered common or trivial enough that it is omitted from the search index and ignored in search queries. Different configuration settings control stopword processing for
MyISAMtables. See Section 12.9.4, “Full-Text Stopwords” for details.
- storage engine
A component of the MySQL database that performs the low-level work of storing, updating, and querying data. In MySQL 5.5 and higher, InnoDB is the default storage engine for new tables, superceding
MyISAM. Different storage engines are designed with different tradeoffs between factors such as memory usage versus disk usage, read speed versus write speed, and speed versus robustness. Each storage engine manages specific tables, so we refer to
MyISAMtables, and so on.
The MySQL Enterprise Backup product is optimized for backing up
InnoDBtables. It can also back up tables handled by
MyISAMand other storage engines.
- strict mode
The general name for the setting controlled by the
innodb_strict_modeoption. Turning on this setting causes certain conditions that are normally treated as warnings, to be considered errors. For example, certain invalid combinations of options related to file format and row format, that normally produce a warning and continue with default values, now cause the
CREATE TABLEoperation to fail.
innodb_strict_modeis enabled by default in MySQL 5.7.
MySQL also has something called strict mode.
Within the list structure that represents the buffer pool, pages that are relatively old and relatively new are represented by different portions of the list. A set of parameters control the size of these portions and the dividing point between the new and old pages.
- supremum record
A pseudo-record in an index, representing the gap above the largest value in that index. If a transaction has a statement such as
SELECT ... FROM ... WHERE col > 10 FOR UPDATE;, and the largest value in the column is 20, it is a lock on the supremum record that prevents other transactions from inserting even larger values such as 50, 100, and so on.
- surrogate key
See Also synthetic key.
- synthetic key
An indexed column, typically a primary key, where the values are assigned arbitrarily. Often done using an auto-increment column. By treating the value as completely arbitrary, you can avoid overly restrictive rules and faulty application assumptions. For example, a numeric sequence representing employee numbers might have a gap if an employee was approved for hiring but never actually joined. Or employee number 100 might have a later hiring date than employee number 500, if they left the company and later rejoined. Numeric values also produce shorter values of predictable length. For example, storing numeric codes meaning “Road”, “Boulevard”, “Expressway”, and so on is more space-efficient than repeating those strings over and over.
Also known as a surrogate key. Contrast with natural key.
- system tablespace
One or more data files (ibdata files) containing metadata for
InnoDB-related objects (the
InnoDBdata dictionary), and the storage areas for one or more undo logs, the change buffer, and the doublewrite buffer. Depending on the
innodb_file_per_tablesetting, it might also contain table and index data for
InnoDBtables. The data and metadata in the system tablespace apply to all databases in a MySQL instance.
Prior to MySQL 5.6.7, the default was to keep all
InnoDBtables and indexes inside the system tablespace, often causing this file to become very large. Because the system tablespace never shrinks, storage problems could arise if large amounts of temporary data were loaded and then deleted. In MySQL 5.6.7 and higher, the default is file-per-table mode, where each table and its associated indexes are stored in a separate .ibd file. This new default makes it easier to use
InnoDBfeatures that rely on the Barracuda file format, such as table compression, efficient storage of off-page columns, and large index key prefixes (
Keeping all table data in the system tablespace or in separate
.ibdfiles has implications for storage management in general. The MySQL Enterprise Backup product might back up a small set of large files, or many smaller files. On systems with thousands of tables, the file system operations to process thousands of
.ibdfiles can cause bottlenecks.
In MySQL 5.6 and higher, the
innodb_undo_tablespacesoption allows you to configure separate tablespace files for undo logs. These files are still considered part of the system tablespace.
See Also Barracuda, change buffer, compression, data dictionary, database, doublewrite buffer, dynamic row format, file-per-table, general tablespace, .ibd file, ibdata file, innodb_file_per_table, instance, MySQL Enterprise Backup, off-page column, tablespace, undo log.
- .TRG file
- .TRN file
Each MySQL table is associated with a particular storage engine. InnoDB tables have particular physical and logical characteristics that affect performance, scalability, backup, administration, and application development.
In terms of file storage, an
InnoDBtable belongs to one of the following tablespace types:
InnoDBsystem tablespace, which is comprised of one or more ibdata files.
A file-per-table tablespace, comprised of an individual .ibd file.
A shared general tablespace, comprised of an individual
.ibdfile. General tablespaces were introduced in MySQL 5.7.6.
.ibddata files contain both table and index data.
InnoDBtables created in file-per-table tablespaces can use the Barracuda file format, and Barracuda tables can use DYNAMIC or COMPRESSED row format. These row formats enable
InnoDBfeatures such as compression, efficient storage of off-page columns, and large index key prefixes (see
innodb_large_prefix). General tablespaces support all row formats regardless of the
Up to MySQL 5.7.5,
InnoDBtables inside the system tablespace had to use the Antelope file format for backward compatibility with MySQL 5.1 and earlier. The Antelope file format supports COMPACT and REDUNDANT row format. The system tablespace supports tables that use DYNAMIC row format as of MySQL 5.7.6.
The rows of an
InnoDBtable are organized into an index structure known as the clustered index, with entries sorted based on the primary key columns of the table. Data access is optimized for queries that filter and sort on the primary key columns, and each index contains a copy of the associated primary key columns for each entry. Modifying values for any of the primary key columns is an expensive operation. Thus an important aspect of
InnoDBtable design is choosing a primary key with columns that are used in the most important queries, and keeping the primary key short, with rarely changing values.
See Also Antelope, backup, Barracuda, clustered index, compact row format, compressed row format, compression, dynamic row format, Fast Index Creation, file-per-table, .ibd file, index, off-page column, primary key, redundant row format, row, system tablespace, tablespace.
- table lock
A lock that prevents any other transaction from accessing a table.
InnoDBmakes considerable effort to make such locks unnecessary, by using techniques such as online DDL, row locks and consistent reads for processing DML statements and queries. You can create such a lock through SQL using the
LOCK TABLEstatement; one of the steps in migrating from other database systems or MySQL storage engines is to remove such statements wherever practical.
- table scan
See full table scan.
- table statistics
- table type
The system tablespace contains the
InnoDBdata dictionary, and prior to MySQL 5.6 holds all other
InnoDBtables by default.
innodb_file_per_tableoption, enabled by default in MySQL 5.6 and higher, allows tables to be created in their own tablespaces. File-per-table tablespaces support features such as efficient storage of off-page columns, table compression, and transportable tablespaces. See Section 14.7.4, “InnoDB File-Per-Table Tablespaces” for details.
InnoDBintroduced general tablespaces in MySQL 5.7.6. General tablespaces are shared tablespaces created using
CREATE TABLESPACEsyntax. They can be created outside of the MySQL data directory, are capable of holding multiple tables, and support tables of all row formats.
MySQL Cluster also groups its tables into tablespaces. See Section 22.214.171.124, “NDB Cluster Disk Data Objects” for details.
- tablespace dictionary
A representation of the data dictionary metadata for a table, within the
InnoDBtablespace. This metadata can be checked against the .frm file for consistency when the table is opened, to diagnose errors resulting from out-of-date
.frmfiles. This information is present for
InnoDBtables that reside in the system tablespace, a file-per-table tablespace, or a general tablespace.
- temporary table
A table whose data does not need to be truly permanent. For example, temporary tables might be used as storage areas for intermediate results in complicated calculations or transformations; this intermediate data would not need to be recovered after a crash. Database products can take various shortcuts to improve the performance of operations on temporary tables, by being less scrupulous about writing data to disk and other measures to protect the data across restarts.
Sometimes, the data itself is removed automatically at a set time, such as when the transaction ends or when the session ends. With some database products, the table itself is removed automatically too.
See Also table.
- temporary tablespace
The tablespace for non-compressed
InnoDBtemporary tables and related objects, introduced in MySQL 5.7.1. The configuration file option,
innodb_temp_data_file_path, allows users to define a relative path for the temporary tablespace data file. If
innodb_temp_data_file_pathis not specified, the default behavior is to create a single auto-extending 12MB data file named
ibtmp1in the data directory, alongside the system tablespace files. The temporary tablespace is recreated on each server start and receives a dynamically generated space ID, which helps avoid conflicts with existing space IDs. The temporary tablespace cannot reside on a raw device. Startup is refused if the temporary tablespace cannot be created.
The temporary tablespace is removed on normal shutdown or on an aborted initialization. The temporary tablespace is not removed when a crash occurs. In this case, the database administrator may remove the temporary tablespace manually or restart the server with the same configuration, which removes and recreates the temporary tablespace.
- text collection
See Also FULLTEXT index.
- torn page
An error condition that can occur due to a combination of I/O device configuration and hardware failure. If data is written out in chunks smaller than the
InnoDBpage size (by default, 16KB), a hardware failure while writing could result in only part of a page being stored to disk. The
InnoDBdoublewrite buffer guards against this possibility.
See Also doublewrite buffer.
Acronym for “transactions per second”, a unit of measurement sometimes used in benchmarks. Its value depends on the workload represented by a particular benchmark test, combined with factors that you control such as the hardware capacity and database configuration.
Transactions are atomic units of work that can be committed or rolled back. When a transaction makes multiple changes to the database, either all the changes succeed when the transaction is committed, or all the changes are undone when the transaction is rolled back.
Database transactions, as implemented by
InnoDB, have properties that are collectively known by the acronym ACID, for atomicity, consistency, isolation, and durability.
- transaction ID
- transparent page compression
A feature added in MySQL 5.7.8 that permits page-level compression for
InnoDBtables that reside in file-per-table tablespaces. Page compression is enabled by specifying the
ALTER TABLE. For more information, see InnoDB Page Compression.
- transportable tablespace
A feature that allows a tablespace to be moved from one instance to another. Traditionally, this has not been possible for
InnoDBtablespaces because all table data was part of the system tablespace. In MySQL 5.6 and higher, the
FLUSH TABLES ... FOR EXPORTsyntax prepares an
InnoDBtable for copying to another server; running
ALTER TABLE ... DISCARD TABLESPACEand
ALTER TABLE ... IMPORT TABLESPACEon the other server brings the copied data file into the other instance. A separate .cfg file, copied along with the .ibd file, is used to update the table metadata (for example the space ID) as the tablespace is imported. See Section 14.7.6, “Copying File-Per-Table Tablespaces to Another Server” for usage information.
A DDL operation that removes the entire contents of a table, while leaving the table and related indexes intact. Contrast with drop. Although conceptually it has the same result as a
DELETEstatement with no
WHEREclause, it operates differently behind the scenes:
InnoDBcreates a new empty table, drops the old table, then renames the new table to take the place of the old one. Because this is a DDL operation, it cannot be rolled back.
If the table being truncated contains foreign keys that reference another table, the truncation operation uses a slower method of operation, deleting one row at a time so that corresponding rows in the referenced table can be deleted as needed by any
ON DELETE CASCADEclause. (MySQL 5.5 and higher do not allow this slower form of truncate, and return an error instead if foreign keys are involved. In this case, use a
A technical term designating an ordered set of elements. It is an abstract notion, used in formal discussions of database theory. In the database field, tuples are usually represented by the columns of a table row. They could also be represented by the result sets of queries, for example, queries that retrieved only some columns of a table, or columns from joined tables.
See Also cursor.
- two-phase commit
An operation that is part of a distributed transaction, under the XA specification. (Sometimes abbreviated as 2PC.) When multiple databases participate in the transaction, either all databases commit the changes, or all databases roll back the changes.
Data that is maintained throughout the life of a transaction, recording all changes so that they can be undone in case of a rollback operation. It is stored in the undo log either within the system tablespace or in separate undo tablespaces.
- undo buffer
See undo log.
- undo log
A storage area that holds copies of data modified by active transactions. If another transaction needs to see the original data (as part of a consistent read operation), the unmodified data is retrieved from this storage area.
By default, this area is physically part of the system tablespace. In MySQL 5.6 and higher, you can use the
innodb_undo_directoryconfiguration options to split it into one or more separate tablespace files, the undo tablespaces, optionally stored on another storage device such as an SSD.
The undo log is split into separate portions, the insert undo buffer and the update undo buffer.
- undo log segment
A collection of undo logs. Undo log segments exists within rollback segments. An undo log segment might contain undo logs from multiple transactions. An undo log segment can only be used by one transaction at a time but can be reused after it is released at transaction commit or rollback. May also be referred to as an “undo segment”.
- undo tablespace
An undo tablespace comprises one or more files that contain undo logs. Undo logs exist within undo log segments, which are contained within rollback segments. By default, rollback segments are physically part of the system tablespace. However, rollback segments can reside in separate undo tablespaces. An undo tablespace is created when the undo log is separated from the system tablespace using the
innodb_undo_directoryconfiguration options. Undo tablespaces were introduced in MySQL 5.6.
For more information, see Section 14.7.7, “Storing InnoDB Undo Logs in Separate Tablespaces”.
- unique constraint
A kind of constraint that asserts that a column cannot contain any duplicate values. In terms of relational algebra, it is used to specify 1-to-1 relationships. For efficiency in checking whether a value can be inserted (that is, the value does not already exist in the column), a unique constraint is supported by an underlying unique index.
- unique index
An index on a column or set of columns that have a unique constraint. Because the index is known not to contain any duplicate values, certain kinds of lookups and count operations are more efficient than in the normal kind of index. Most of the lookups against this type of index are simply to determine if a certain value exists or not. The number of values in the index is the same as the number of rows in the table, or at least the number of rows with non-null values for the associated columns.
Change buffering optimization does not apply to unique indexes. As a workaround, you can temporarily set
unique_checks=0while doing a bulk data load into an
- unique key
The set of columns (one or more) comprising a unique index. When you can define a
WHEREcondition that matches exactly one row, and the query can use an associated unique index, the lookup and error handling can be performed very efficiently.
- variable-length type
InnoDBtreats fixed-length fields greater than or equal to 768 bytes in length as variable-length fields, which can be stored off-page. For example, a
CHAR(255)column can exceed 768 bytes if the maximum byte length of the character set is greater than 3, as it is with
Deadlock detection can be disabled using the
When an operation, such as acquiring a lock, mutex, or latch, cannot be completed immediately,
InnoDBpauses and tries again. The mechanism for pausing is elaborate enough that this operation has its own name, the wait. Individual threads are paused using a combination of internal
InnoDBscheduling, operating system
wait()calls, and short-duration spin loops.
On systems with heavy load and many transactions, you might use the output from the
SHOW INNODB STATUScommand or Performance Schema to determine whether threads are spending too much time waiting, and if so, how you can improve concurrency.
- warm backup
A backup taken while the database is running, but that restricts some database operations during the backup process. For example, tables might become read-only. For busy applications and web sites, you might prefer a hot backup.
- warm up
To run a system under a typical workload for some time after startup, so that the buffer pool and other memory regions are filled as they would be under normal conditions. This process happens naturally over time when a MySQL server is restarted or subjected to a new workload.
Typically, you run a workload for some time to warm up the buffer pool before running performance tests, to ensure consistent results across multiple runs; otherwise, performance might be artificially low during the first run.
In MySQL 5.6, you can speed up the warmup process by enabling the
innodb_buffer_pool_load_at_startupconfiguration options, to bring the contents of the buffer pool back into memory after a restart. These options are enabled by default in MySQL 5.7. See Section 126.96.36.199, “Saving and Restoring the Buffer Pool State”.
The combination and volume of SQL and other database operations, performed by a database application during typical or peak usage. You can subject the database to a particular workload during performance testing to identify bottlenecks, or during capacity planning.
- write combining
An optimization technique that reduces write operations when dirty pages are flushed from the
InnoDBbuffer pool. If a row in a page is updated multiple times, or multiple rows on the same page are updated, all of those changes are stored to the data files in a single write operation rather than one write for each change.
A standard interface for coordinating distributed transactions, allowing multiple databases to participate in a transaction while maintaining ACID compliance. For full details, see Section 13.3.7, “XA Transactions”.
XA Distributed Transaction support is enabled by default. If you are not using this feature, you can disable the
innodb_support_xaconfiguration option, avoiding the performance overhead of an extra fsync for each transaction.
As of MySQL 5.7.10, disabling
innodb_support_xais not permitted as it makes replication unsafe and prevents performance gains associated with binary log group commit. The
innodb_support_xaconfiguration option is removed in MySQL 8.0.
A characteristic of a page in the
InnoDBbuffer pool meaning it has been accessed recently, and so is moved within the buffer pool data structure, so that it will not be flushed soon by the LRU algorithm. This term is used in some INFORMATION_SCHEMA column names of tables related to the buffer pool.