MySQL Tutorials - Herong's Tutorial Examples
∟Storage Engines in MySQL Server
∟MySQL System Variables for InnoDB Engine
This section describes some important MySQL system variables that control the behavior of the InnoDB storage engine.
As of MySQL 8.0, there are 144 system variables to control the behavior
of the InnoDB storage engine. Here are some important ones you should
pay attention:
- innodb_buffer_pool_size (Default: 134217728) -
The size in bytes of the buffer pool, the memory area where InnoDB caches table and index data.
- innodb_change_buffering (Default: all) -
Whether InnoDB performs change buffering, an optimization that delays write operations to secondary indexes so that the I/O operations can be performed sequentially.
- innodb_commit_concurrency (Default: 0 (any number)) -
The number of threads that can commit at the same time.
- innodb_compression_level (Default: 6) -
Specifies the level of zlib compression to use for InnoDB compressed tables and indexes. A higher value lets you fit more data onto a storage device, at the expense of more CPU overhead during compression.
- innodb_ddl_buffer_size (Default: 1048576) -
Maximum buffer size in bytes for DDL operations.
- innodb_ddl_threads (Default: 4) -
Maximum number of parallel threads for the sort and build phases of index creation. Applies to online DDL operations that create or rebuild secondary indexes.
- innodb_deadlock_detect (Default: ON) -
Used to disable deadlock detection. On high concurrency systems, deadlock detection can cause a slowdown when numerous threads wait for the same lock.
- innodb_dedicated_server (Default: OFF) -
Only consider enabling innodb_dedicated_server if the MySQL instance resides on a dedicated server where it can use all available system resources.
- innodb_default_row_format (Default: DYNAMIC) -
Defines the default row format for InnoDB tables and user-created temporary tables.
- innodb_directories (Default: NULL) -
Directories to scan at startup for tablespace files.
- innodb_extend_and_initialize (Default: ON) -
Controls how space is allocated to file-per-table and general tablespaces on Linux systems.
- innodb_file_per_table (Default: ON) -
When innodb_file_per_table is enabled, tables are created in file-per-table tablespaces by default.
- innodb_ft_cache_size (Default: 8000000) -
The memory allocated, in bytes, for the InnoDB FULLTEXT search index cache, which holds a parsed document in memory while creating an InnoDB FULLTEXT index.
- innodb_ft_num_word_optimize (Default: 2000) -
Number of words to process during each OPTIMIZE TABLE operation on an InnoDB FULLTEXT index.
- innodb_ft_total_cache_size (Default: 640000000) -
The total memory allocated, in bytes, for the InnoDB full-text search index cache for all tables.
- innodb_io_capacity (Default: 200) -
The number of I/O operations per second (IOPS) available to InnoDB background tasks, such as flushing pages from the buffer pool and merging data from the change buffer.
- innodb_lock_wait_timeout (Default: 50) -
The length of time in seconds an InnoDB transaction waits for a row lock before giving up.
- innodb_log_buffer_size (Default: 16777216) -
The size in bytes of the buffer that InnoDB uses to write to the log files on disk.
- innodb_log_file_size (Default: 50331648) -
The size in bytes of each log file in a log group.
- innodb_max_dirty_pages_pct (Default: 90) -
InnoDB tries to flush data from the buffer pool so that the percentage of dirty pages does not exceed this value.
- innodb_monitor_enable (Default: NULL) -
Enables InnoDB metrics counters. Counter data may be queried using the INFORMATION_SCHEMA.INNODB_METRICS table.
- innodb_page_cleaners (Default: 4) -
The number of page cleaner threads that flush dirty pages from buffer pool instances.
- innodb_page_size (Default: 16384) -
Specifies the page size for InnoDB tablespaces.
- innodb_parallel_read_threads (Default: 4) -
The number of threads that can be used for parallel clustered index reads.
- innodb_print_all_deadlocks (Default: OFF) -
When this option is enabled, information about all deadlocks in InnoDB user transactions is recorded in the mysqld error log.
- innodb_purge_threads (Default: 4) -
The number of background threads devoted to the InnoDB purge operation.
- innodb_random_read_ahead (Default: OFF) -
Enables the random read-ahead technique for optimizing InnoDB I/O.
- innodb_read_io_threads (Default: 4) -
The number of I/O threads for read operations in InnoDB.
- innodb_read_only (Default: OFF) -
Starts InnoDB in read-only mode.
- innodb_rollback_on_timeout (Default: OFF) -
InnoDB rolls back only the last statement on a transaction timeout by default.
- innodb_stats_auto_recalc (Default: ON) -
Causes InnoDB to automatically recalculate persistent statistics after the data in a table is changed substantially.
- innodb_status_output (Default: OFF) -
Enables or disables periodic output for the standard InnoDB Monitor.
- innodb_strict_mode (Default: ON) -
When enabled, InnoDB returns errors rather than warnings for certain conditions.
- innodb_sync_array_size (Default: 1) -
Defines the size of the mutex/lock wait array.
- innodb_table_locks (Default: ON) -
If autocommit = 0, InnoDB honors LOCK TABLES.
- innodb_thread_concurrency (Default: 0 (any)) -
Maximum number of threads permitted inside of InnoDB.
- innodb_write_io_threads (Default: 4) -
The number of I/O threads for write operations in InnoDB.
You can see the all InnoDB related system variables
and their current values using the "SHOW VARIABLES ..." statement:
mysql> show variables like '%innodb%';
...
Table of Contents
About This Book
Introduction of SQL
MySQL Introduction and Installation
Introduction of MySQL Programs
PHP Programs and MySQL Server
Perl Programs and MySQL Servers
Java Programs and MySQL Servers
Datatypes and Data Literals
Operations and Expressions
Character Strings and Bit Strings
Commonly Used Functions
Table Column Types for Different Types of Values
Using DDL to Create Tables and Indexes
Using DML to Insert, Update and Delete Records
Using SELECT to Query Database
Window Functions for Statistical Analysis
Use Index for Better Performance
Transaction Management and Isolation Levels
Locks Used in MySQL
Defining and Calling Stored Procedures
Variables, Loops and Cursors Used in Stored Procedures
System, User-Defined and Stored Procedure Variables
MySQL Server Administration
►Storage Engines in MySQL Server
What Are Storage Engines
What Is InnoDB Storage Engine
Convert Table to InnoDB Storage Engine
Clustered Index Used by InnoDB Engine
Statistic Information on InnoDB Tables
MySQL Status Variables for InnoDB Engine
►MySQL System Variables for InnoDB Engine
InnoDB Storage Engine - Primary and Secondary Indexes
Performance Tuning and Optimization
Bulk Changes on Large Tables
MySQL Server on macOS
Installing MySQL Server on Linux
Connection, Performance and Second Instance on Linux
Archived Tutorials
References
Full Version in PDF/EPUB