SHOW Syntax
SHOW has many forms that provide information about
databases, tables, columns, or status information about the server. This
section describes those following:
1 | SHOW {BINARY | MASTER} LOGS |
If the syntax for a given SHOW statement includes a
LIKE '*pattern*' part,
'*pattern*' is a string that can contain the
SQL % and _ wildcard characters. The pattern
is useful for restricting statement output to matching values.
Several SHOW statements also accept a WHERE
clause that provides more flexibility in specifying which rows to
display.
In addition, you can work in SQL with results from queries on tables
in the INFORMATION_SCHEMA database, which you cannot easily
do with results from SHOW statements.
SHOW STATUS Syntax
1 | SHOW [GLOBAL | SESSION] STATUS |
SHOW STATUS provides server status information. This
statement does not require any privilege. It requires only the ability
to connect to the server.
Status variable information is also available from these sources:
- Performance Schema tables.
- The mysqladmin extended-status command.
For SHOW STATUS, a LIKE clause, if present,
indicates which variable names to match. A WHERE clause can
be given to select rows using more general conditions.
SHOW STATUS accepts an optional GLOBAL or
SESSION variable scope modifier:
- With a
GLOBALmodifier, the statement displays the global status values. A global status variable may represent status for some aspect of the server itself (for example,Aborted_connects), or the aggregated status over all connections to MySQL (for example,Bytes_receivedandBytes_sent). If a variable has no global value, the session value is displayed. - With a
SESSIONmodifier, the statement displays the status variable values for the current connection. If a variable has no session value, the global value is displayed.LOCALis a synonym forSESSION. - If no modifier is present, the default is
SESSION.
Each invocation of the SHOW STATUS statement uses an
internal temporary table and increments the
globalCreated_tmp_tables value.
Partial output is shown here. The list of names and values may differ for your server.
1 | mysql> SHOW STATUS; |
With a LIKE clause, the statement displays only rows for
those variables with names that match the pattern:
1 | mysql> SHOW STATUS LIKE 'Key%'; |
Performance Schema Status Variable Tables
The MySQL server maintains many status variables that provide information about its operation. Status variable information is available in these Performance Schema tables:
global_status: Global status variables. An application that wants only global values should use this table.session_status: Status variables for the current session. An application that wants all status variable values for its own session should use this table. It includes the session variables for its session, as well as the values of global variables that have no session counterpart.status_by_thread: Session status variables for each active session. An application that wants to know the session variable values for specific sessions should use this table. It includes session variables only, identified by thread ID.
There are also summary tables that provide status variable information aggregated by account, host name, and user name.
The session variable tables (session_status,
status_by_thread) contain information only for active
sessions, not terminated sessions.
The Performance Schema collects statistics for global status
variables only for threads for which the INSTRUMENTEDvalue
is YES in the threads table. Statistics for
session status variables are always collected, regardless of the
INSTRUMENTED value.
The Performance Schema does not collect statistics for
Com_*xxx* status variables in the status
variable tables. To obtain global and per-session statement execution
counts, use
theevents_statements_summary_global_by_event_name
andevents_statements_summary_by_thread_by_event_name
tables, respectively. For example:
1 | SELECT EVENT_NAME, COUNT_STAR |
The global_status and session_status tables
have these columns:
VARIABLE_NAMEThe status variable name.
VARIABLE_VALUEThe status variable value. For
global_status, this column contains the global value. Forsession_status, this column contains the variable value for the current session.
The global_status and session_status tables
have these indexes:
- Primary key on (
VARIABLE_NAME)
The status_by_thread table contains the status of each
active thread. It has these columns:
THREAD_IDThe thread identifier of the session in which the status variable is defined.
VARIABLE_NAMEThe status variable name.
VARIABLE_VALUEThe session variable value for the session named by the
THREAD_IDcolumn.
The status_by_thread table has these indexes:
- Primary key on (
THREAD_ID,VARIABLE_NAME)
The status_by_thread table contains status variable
information only about foreground threads. If
theperformance_schema_max_thread_instances system variable
is not autoscaled (signified by a value of −1) and the maximum permitted
number of instrumented thread objects is not greater than the number of
background threads, the table will be empty.
The Performance Schema supports TRUNCATE TABLE for
status variable tables as follows:
global_status: Resets thread, account, host, and user status. Resets global status variables except those that the server never resets.session_status: Not supported.status_by_thread: Aggregates status for all threads to the global status and account status, then resets thread status. If account statistics are not collected, the session status is added to host and user status, if host and user status are collected.Account, host, and user statistics are not collected if the
performance_schema_accounts_size,performance_schema_hosts_size, andperformance_schema_users_sizesystem variables, respectively, are set to 0.
FLUSH STATUS adds the session status from all active
sessions to the global status variables, resets the status of all active
sessions, and resets account, host, and user status values aggregated
from disconnected sessions.
Server Status Variables
The MySQL server maintains many status variables that provide
information about its operation. You can view these variables and their
values by using the SHOW [GLOBAL | SESSION] STATUS
statement. The optional GLOBAL keyword aggregates the
values over all connections, and SESSIONshows the values
for the current connection.
1 | mysql> SHOW GLOBAL STATUS; |
Many status variables are reset to 0 by the FLUSH STATUS
statement.
This section provides a description of each status variable. For a status variable summary.
The status variables have the following meanings.
Aborted_clientsThe number of connections that were aborted because the client died without closing the connection properly.
Aborted_connectsThe number of failed attempts to connect to the MySQL server.
For additional connection-related information, check the
Connection_errors_*xxx*status variables and thehost_cachetable.Binlog_cache_disk_useThe number of transactions that used the temporary binary log cache but that exceeded the value of
binlog_cache_sizeand used a temporary file to store statements from the transaction.The number of nontransactional statements that caused the binary log transaction cache to be written to disk is tracked separately in the
Binlog_stmt_cache_disk_usestatus variable.Acl_cache_items_countThe number of cached privilege objects. Each object is the privilege combination of a user and its active roles.
Binlog_cache_useThe number of transactions that used the binary log cache.
Binlog_stmt_cache_disk_useThe number of nontransaction statements that used the binary log statement cache but that exceeded the value of
binlog_stmt_cache_sizeand used a temporary file to store those statements.Binlog_stmt_cache_useThe number of nontransactional statements that used the binary log statement cache.
Bytes_receivedThe number of bytes received from all clients.
Bytes_sentThe number of bytes sent to all clients.
Caching_sha2_password_rsa_public_keyThe public key used by the
caching_sha2_passwordauthentication plugin for RSA key pair-based password exchange. The value is nonempty only if the server successfully initializes the private and public keys in the files named by thecaching_sha2_password_private_key_pathandcaching_sha2_password_public_key_pathsystem variables. The value ofCaching_sha2_password_rsa_public_keycomes from the latter file.Com_*xxx*The
Com_*xxx*statement counter variables indicate the number of times eachxxxstatement has been executed. There is one status variable for each type of statement. For example,Com_deleteandCom_updatecountDELETEandUPDATEstatements, respectively.Com_delete_multiandCom_update_multiare similar but apply toDELETEandUPDATEstatements that use multiple-table syntax.The discussion at the beginning of this section indicates how to relate these statement-counting status variables to other such variables.
All of the
Com_stmt_*xxx*variables are increased even if a prepared statement argument is unknown or an error occurred during execution. In other words, their values correspond to the number of requests issued, not to the number of requests successfully completed.The
Com_stmt_*xxx*status variables are as follows:Com_stmt_prepareCom_stmt_executeCom_stmt_fetchCom_stmt_send_long_dataCom_stmt_resetCom_stmt_close
Those variables stand for prepared statement commands. Their names refer to the
COM_*xxx*command set used in the network layer. In other words, their values increase whenever prepared statement API calls such asmysql_stmt_prepare(), mysql_stmt_execute(), and so forth are executed. However,Com_stmt_prepare,Com_stmt_executeandCom_stmt_closealso increase forPREPARE,EXECUTE, orDEALLOCATE PREPARE, respectively. Additionally, the values of the older statement counter variablesCom_prepare_sql,Com_execute_sql, andCom_dealloc_sqlincrease for thePREPARE,EXECUTE, andDEALLOCATE PREPAREstatements.Com_stmt_fetchstands for the total number of network round-trips issued when fetching from cursors.Com_stmt_reprepareindicates the number of times statements were automatically reprepared by the server, for example, after metadata changes to tables or views referred to by the statement. A reprepare operation incrementsCom_stmt_reprepare, and alsoCom_stmt_prepare.Com_explain_otherindicates the number ofEXPLAIN FOR CONNECTIONstatements executed.Com_change_repl_filterindicates the number ofCHANGE REPLICATION FILTERstatements executed.CompressionWhether the client connection uses compression in the client/server protocol.
As of MySQL 8.0.18, this status variable is deprecated. It will be removed in a future MySQL version. See Legacy Connection Compression Configuration.
Compression_algorithmThe name of the compression algorithm in use for the current connection to the server. The value can be any algorithm permitted in the value of the
protocol_compression_algorithmssystem variable. For example, the value isuncompressedif the connection does not use compression, orzlibif the connection uses thezlibalgorithm.This variable was added in MySQL 8.0.18.
Compression_levelThe compression level in use for the current connection to the server. The value is 6 for
zlibconnections (the defaultzlibalgorithm compression level), 1 to 22 forzstdconnections, and 0 foruncompressedconnections.This variable was added in MySQL 8.0.18.
Connection_errors_*xxx*These variables provide information about errors that occur during the client connection process. They are global only and represent error counts aggregated across connections from all hosts. These variables track errors not accounted for by the host cache, such as errors that are not associated with TCP connections, occur very early in the connection process (even before an IP address is known), or are not specific to any particular IP address (such as out-of-memory conditions).
Connection_errors_acceptThe number of errors that occurred during calls to
accept()on the listening port.Connection_errors_internalThe number of connections refused due to internal errors in the server, such as failure to start a new thread or an out-of-memory condition.
Connection_errors_max_connectionsThe number of connections refused because the server
max_connectionslimit was reached.Connection_errors_peer_addressThe number of errors that occurred while searching for connecting client IP addresses.
Connection_errors_selectThe number of errors that occurred during calls to
select()orpoll()on the listening port. (Failure of this operation does not necessarily means a client connection was rejected.)Connection_errors_tcpwrapThe number of connections refused by the
libwraplibrary.
ConnectionsThe number of connection attempts (successful or not) to the MySQL server.
Created_tmp_disk_tablesThe number of internal on-disk temporary tables created by the server while executing statements.
If an internal temporary table is created initially as an in-memory table but becomes too large, MySQL automatically converts it to an on-disk table. The maximum size for in-memory temporary tables is the minimum of the
tmp_table_sizeandmax_heap_table_sizevalues. IfCreated_tmp_disk_tablesis large, you may want to increase thetmp_table_sizeormax_heap_table_sizevalue to lessen the likelihood that internal temporary tables in memory will be converted to on-disk tables.You can compare the number of internal on-disk temporary tables created to the total number of internal temporary tables created by comparing the values of the
Created_tmp_disk_tablesandCreated_tmp_tablesvariables.Created_tmp_filesHow many temporary files mysqld has created.
Created_tmp_tablesThe number of internal temporary tables created by the server while executing statements.
You can compare the number of internal on-disk temporary tables created to the total number of internal temporary tables created by comparing the values of the
Created_tmp_disk_tablesandCreated_tmp_tablesvariables.Each invocation of the
SHOW STATUSstatement uses an internal temporary table and increments the globalCreated_tmp_tablesvalue.Current_tls_caThe active
ssl_cavalue in the SSL context that the server uses for new connections. This context value may differ from the currentssl_casystem variable value if the system variable has been changed butALTER INSTANCE RELOAD TLShas not subsequently been executed to reconfigure the SSL context from the context-related system variable values and update the corresponding status variables. (This potential difference in values applies to each corresponding pair of context-related system and status variables.This variable was added in MySQL 8.0.16.
Current_tls_capathThe active
ssl_capathvalue in the SSL context that the server uses for new connections. For notes about the relationship between this status variable and its corresponding system variable, see the description ofCurrent_tls_ca.This variable was added in MySQL 8.0.16.
Current_tls_certThe active
ssl_certvalue in the SSL context that the server uses for new connections. For notes about the relationship between this status variable and its corresponding system variable, see the description ofCurrent_tls_ca.This variable was added in MySQL 8.0.16.
Current_tls_cipherThe active
ssl_ciphervalue in the SSL context that the server uses for new connections. For notes about the relationship between this status variable and its corresponding system variable, see the description ofCurrent_tls_ca.This variable was added in MySQL 8.0.16.
Current_tls_ciphersuitesThe active
tls_ciphersuitesvalue in the SSL context that the server uses for new connections. For notes about the relationship between this status variable and its corresponding system variable, see the description ofCurrent_tls_ca.This variable was added in MySQL 8.0.16.
Current_tls_crlThe active
ssl_crlvalue in the SSL context that the server uses for new connections. For notes about the relationship between this status variable and its corresponding system variable, see the description ofCurrent_tls_ca.This variable was added in MySQL 8.0.16.
Current_tls_crlpathThe active
ssl_crlpathvalue in the SSL context that the server uses for new connections. For notes about the relationship between this status variable and its corresponding system variable, see the description ofCurrent_tls_ca.This variable was added in MySQL 8.0.16.
Current_tls_keyThe active
ssl_keyvalue in the SSL context that the server uses for new connections. For notes about the relationship between this status variable and its corresponding system variable, see the description ofCurrent_tls_ca.This variable was added in MySQL 8.0.16.
Current_tls_versionThe active
tls_versionvalue in the SSL context that the server uses for new connections. For notes about the relationship between this status variable and its corresponding system variable, see the description ofCurrent_tls_ca.This variable was added in MySQL 8.0.16.
Delayed_errorsThis status variable is deprecated (because
DELAYEDinserts are not supported), and will be removed in a future release.Delayed_insert_threadsThis status variable is deprecated (because
DELAYEDinserts are not supported), and will be removed in a future release.Delayed_writesThis status variable is deprecated (because
DELAYEDinserts are not supported), and will be removed in a future release.dragnet.StatusThe result of the most recent assignment to the
dragnet.log_error_filter_rulessystem variable, empty if no such assignment has occurred.This variable was added in MySQL 8.0.12.
Flush_commandsThe number of times the server flushes tables, whether because a user executed a
FLUSH TABLESstatement or due to internal server operation. It is also incremented by receipt of aCOM_REFRESHpacket. This is in contrast toCom_flush, which indicates how manyFLUSHstatements have been executed, whetherFLUSH TABLES,FLUSH LOGS, and so forth.group_replication_primary_memberShows the primary member's UUID when the group is operating in single-primary mode. If the group is operating in multi-primary mode, shows an empty string.
The
group_replication_primary_memberstatus variable has been deprecated and is scheduled to be removed in a future version.Handler_commitThe number of internal
COMMITstatements.Handler_deleteThe number of times that rows have been deleted from tables.
Handler_external_lockThe server increments this variable for each call to its
external_lock()function, which generally occurs at the beginning and end of access to a table instance. There might be differences among storage engines. This variable can be used, for example, to discover for a statement that accesses a partitioned table how many partitions were pruned before locking occurred: Check how much the counter increased for the statement, subtract 2 (2 calls for the table itself), then divide by 2 to get the number of partitions locked.Handler_mrr_initThe number of times the server uses a storage engine's own Multi-Range Read implementation for table access.
Handler_prepareA counter for the prepare phase of two-phase commit operations.
Handler_read_firstThe number of times the first entry in an index was read. If this value is high, it suggests that the server is doing a lot of full index scans (for example,
SELECT col1 FROM foo, assuming thatcol1is indexed).Handler_read_keyThe number of requests to read a row based on a key. If this value is high, it is a good indication that your tables are properly indexed for your queries.
Handler_read_lastThe number of requests to read the last key in an index. With
ORDER BY, the server will issue a first-key request followed by several next-key requests, whereas withORDER BY DESC, the server will issue a last-key request followed by several previous-key requests.Handler_read_nextThe number of requests to read the next row in key order. This value is incremented if you are querying an index column with a range constraint or if you are doing an index scan.
Handler_read_prevThe number of requests to read the previous row in key order. This read method is mainly used to optimize
ORDER BY ... DESC.Handler_read_rndThe number of requests to read a row based on a fixed position. This value is high if you are doing a lot of queries that require sorting of the result. You probably have a lot of queries that require MySQL to scan entire tables or you have joins that do not use keys properly.
Handler_read_rnd_nextThe number of requests to read the next row in the data file. This value is high if you are doing a lot of table scans. Generally this suggests that your tables are not properly indexed or that your queries are not written to take advantage of the indexes you have.
Handler_rollbackThe number of requests for a storage engine to perform a rollback operation.
Handler_savepointThe number of requests for a storage engine to place a savepoint.
Handler_savepoint_rollbackThe number of requests for a storage engine to roll back to a savepoint.
Handler_updateThe number of requests to update a row in a table.
Handler_writeThe number of requests to insert a row in a table.
Innodb_available_undo_logsInnodb_available_undo_logswas removed in MySQL 8.0.2. The number of available rollback segments per tablespace may be retrieved usingSHOW VARIABLES LIKE 'innodb_rollback_segments';Innodb_buffer_pool_dump_statusThe progress of an operation to record the pages held in the
InnoDBbuffer pool, triggered by the setting ofinnodb_buffer_pool_dump_at_shutdownorinnodb_buffer_pool_dump_now.Innodb_buffer_pool_load_statusThe progress of an operation to warm up the
InnoDBbuffer pool by reading in a set of pages corresponding to an earlier point in time, triggered by the setting ofinnodb_buffer_pool_load_at_startuporinnodb_buffer_pool_load_now. If the operation introduces too much overhead, you can cancel it by settinginnodb_buffer_pool_load_abort.Innodb_buffer_pool_bytes_dataThe total number of bytes in the
InnoDBbuffer pool containing data. The number includes both dirty and clean pages. For more accurate memory usage calculations than withInnodb_buffer_pool_pages_data, when compressed tables cause the buffer pool to hold pages of different sizes.Innodb_buffer_pool_pages_dataThe number of pages in the
InnoDBbuffer pool containing data. The number includes both dirty and clean pages. When using compressed tables, the reportedInnodb_buffer_pool_pages_datavalue may be larger thanInnodb_buffer_pool_pages_total(Bug #59550).Innodb_buffer_pool_bytes_dirtyThe total current number of bytes held in dirty pages in the
InnoDBbuffer pool. For more accurate memory usage calculations than withInnodb_buffer_pool_pages_dirty, when compressed tables cause the buffer pool to hold pages of different sizes.Innodb_buffer_pool_pages_dirtyThe current number of dirty pages in the
InnoDBbuffer pool.Innodb_buffer_pool_pages_flushedThe number of requests to flush pages from the
InnoDBbuffer pool.Innodb_buffer_pool_pages_freeThe number of free pages in the
InnoDBbuffer pool.Innodb_buffer_pool_pages_latchedThe number of latched pages in the
InnoDBbuffer pool. These are pages currently being read or written, or that cannot be flushed or removed for some other reason. Calculation of this variable is expensive, so it is available only when theUNIV_DEBUGsystem is defined at server build time.Innodb_buffer_pool_pages_miscThe number of pages in the
InnoDBbuffer pool that are busy because they have been allocated for administrative overhead, such as row locks or the adaptive hash index. This value can also be calculated asInnodb_buffer_pool_pages_total−Innodb_buffer_pool_pages_free−Innodb_buffer_pool_pages_data. When using compressed tables,Innodb_buffer_pool_pages_miscmay report an out-of-bounds value (Bug #59550).Innodb_buffer_pool_pages_totalThe total size of the
InnoDBbuffer pool, in pages. When using compressed tables, the reportedInnodb_buffer_pool_pages_datavalue may be larger thanInnodb_buffer_pool_pages_total(Bug #59550)Innodb_buffer_pool_read_aheadThe number of pages read into the
InnoDBbuffer pool by the read-ahead background thread.Innodb_buffer_pool_read_ahead_evictedThe number of pages read into the
InnoDBbuffer pool by the read-ahead background thread that were subsequently evicted without having been accessed by queries.Innodb_buffer_pool_read_ahead_rndThe number of “random” read-aheads initiated by
InnoDB. This happens when a query scans a large portion of a table but in random order.Innodb_buffer_pool_read_requestsThe number of logical read requests.
Innodb_buffer_pool_readsThe number of logical reads that
InnoDBcould not satisfy from the buffer pool, and had to read directly from disk.Innodb_buffer_pool_resize_statusThe status of an operation to resize the
InnoDBbuffer pool dynamically, triggered by setting theinnodb_buffer_pool_sizeparameter dynamically. Theinnodb_buffer_pool_sizeparameter is dynamic, which allows you to resize the buffer pool without restarting the server. See Configuring InnoDB Buffer Pool Size Online for related information.Innodb_buffer_pool_wait_freeNormally, writes to the
InnoDBbuffer pool happen in the background. WhenInnoDBneeds to read or create a pageand no clean pages are available,InnoDBflushes some dirty pages first and waits for that operation to finish. This counter counts instances of these waits. Ifinnodb_buffer_pool_sizehas been set properly, this value should be small.Innodb_buffer_pool_write_requestsThe number of writes done to the
InnoDBbuffer pool.Innodb_data_fsyncsThe number of
fsync()operations so far. The frequency offsync()calls is influenced by the setting of theinnodb_flush_methodconfiguration option.Innodb_data_pending_fsyncsThe current number of pending
fsync()operations. The frequency offsync()calls is influenced by the setting of theinnodb_flush_methodconfiguration option.Innodb_data_pending_readsThe current number of pending reads.
Innodb_data_pending_writesThe current number of pending writes.
Innodb_data_readThe amount of data read since the server was started (in bytes).
Innodb_data_readsThe total number of data reads (OS file reads).
Innodb_data_writesThe total number of data writes.
Innodb_data_writtenThe amount of data written so far, in bytes.
Innodb_dblwr_pages_writtenThe number of pages that have been written to the doublewrite buffer.
Innodb_dblwr_writesThe number of doublewrite operations that have been performed.
Innodb_have_atomic_builtinsIndicates whether the server was built with atomic instructions.
Innodb_log_waitsThe number of times that the log buffer was too small and a wait was required for it to be flushed before continuing.
Innodb_log_write_requestsThe number of write requests for the
InnoDBredo log.Innodb_log_writesThe number of physical writes to the
InnoDBredo log file.Innodb_num_open_filesThe number of files
InnoDBcurrently holds open.Innodb_os_log_fsyncsThe number of
fsync()writes done to theInnoDBredo log files.Innodb_os_log_pending_fsyncsThe number of pending
fsync()operations for theInnoDBredo log files.Innodb_os_log_pending_writesThe number of pending writes to the
InnoDBredo log files.Innodb_os_log_writtenThe number of bytes written to the
InnoDBredo log files.Innodb_page_sizeInnoDBpage size (default 16KB). Many values are counted in pages; the page size enables them to be easily converted to bytes.Innodb_pages_createdThe number of pages created by operations on
InnoDBtables.Innodb_pages_readThe number of pages read from the
InnoDBbuffer pool by operations onInnoDBtables.Innodb_pages_writtenThe number of pages written by operations on
InnoDBtables.Innodb_row_lock_current_waitsThe number of row locks currently being waited for by operations on
InnoDBtables.Innodb_row_lock_timeThe total time spent in acquiring row locks for
InnoDBtables, in milliseconds.Innodb_row_lock_time_avgThe average time to acquire a row lock for
InnoDBtables, in milliseconds.Innodb_row_lock_time_maxThe maximum time to acquire a row lock for
InnoDBtables, in milliseconds.Innodb_row_lock_waitsThe number of times operations on
InnoDBtables had to wait for a row lock.Innodb_rows_deletedThe number of rows deleted from
InnoDBtables.Innodb_rows_insertedThe number of rows inserted into
InnoDBtables.Innodb_rows_readThe number of rows read from
InnoDBtables.Innodb_rows_updatedThe number of rows updated in
InnoDBtables.Innodb_truncated_status_writesThe number of times output from the
SHOW ENGINE INNODB STATUSstatement has been truncated.Key_blocks_not_flushedThe number of key blocks in the
MyISAMkey cache that have changed but have not yet been flushed to disk.Key_blocks_unusedThe number of unused blocks in the
MyISAMkey cache. You can use this value to determine how much of the key cache is in use; see the discussion ofkey_buffer_sizein Section “Server System Variables”.Key_blocks_usedThe number of used blocks in the
MyISAMkey cache. This value is a high-water mark that indicates the maximum number of blocks that have ever been in use at one time.Key_read_requestsThe number of requests to read a key block from the
MyISAMkey cache.Key_readsThe number of physical reads of a key block from disk into the
MyISAMkey cache. IfKey_readsis large, then yourkey_buffer_sizevalue is probably too small. The cache miss rate can be calculated asKey_reads/Key_read_requests.Key_write_requestsThe number of requests to write a key block to the
MyISAMkey cache.Key_writesThe number of physical writes of a key block from the
MyISAMkey cache to disk.Last_query_costThe total cost of the last compiled query as computed by the query optimizer. This is useful for comparing the cost of different query plans for the same query. The default value of 0 means that no query has been compiled yet. The default value is 0.
Last_query_costhas session scope.In MySQL 8.0.16 and later, this variable shows the cost of queries that have multiple query blocks, summing the cost estimates of each query block, estimating how many times non-cacheable subqueries are executed, and multiplying the cost of those query blocks by the number of subquery executions. (Bug #92766, Bug #28786951) Prior to MySQL 8.0.16,
Last_query_costwas computed accurately only for simple, “flat” queries, but not for complex queries such as those containing subqueries orUNION. (For the latter, the value was set to 0.)Last_query_partial_plansThe number of iterations the query optimizer made in execution plan construction for the previous query.
Last_query_costhas session scope.Locked_connectsThe number of attempts to connect to locked user accounts. For information about account locking and unlocking.
Max_execution_time_exceededThe number of
SELECTstatements for which the execution timeout was exceeded.Max_execution_time_setThe number of
SELECTstatements for which a nonzero execution timeout was set. This includes statements that include a nonzeroMAX_EXECUTION_TIMEoptimizer hint, and statements that include no such hint but execute while the timeout indicated by themax_execution_timesystem variable is nonzero.Max_execution_time_set_failedThe number of
SELECTstatements for which the attempt to set an execution timeout failed.Max_used_connectionsThe maximum number of connections that have been in use simultaneously since the server started.
Max_used_connections_timeThe time at which
Max_used_connectionsreached its current value.Not_flushed_delayed_rowsThis status variable is deprecated (because
DELAYEDinserts are not supported), and will be removed in a future release.mecab_charsetThe character set currently used by the MeCab full-text parser plugin.
Ongoing_anonymous_transaction_countShows the number of ongoing transactions which have been marked as anonymous. This can be used to ensure that no further transactions are waiting to be processed.
Ongoing_anonymous_gtid_violating_transaction_countThis status variable is only available in debug builds. Shows the number of ongoing transactions which use
gtid_next=ANONYMOUSand that violate GTID consistency.Ongoing_automatic_gtid_violating_transaction_countThis status variable is only available in debug builds. Shows the number of ongoing transactions which use
gtid_next=AUTOMATICand that violate GTID consistency.Open_filesThe number of files that are open. This count includes regular files opened by the server. It does not include other types of files such as sockets or pipes. Also, the count does not include files that storage engines open using their own internal functions rather than asking the server level to do so.
Open_streamsThe number of streams that are open (used mainly for logging).
Open_table_definitionsThe number of cached table definitions.
Open_tablesThe number of tables that are open.
Opened_filesThe number of files that have been opened with
my_open()(amysyslibrary function). Parts of the server that open files without using this function do not increment the count.Opened_table_definitionsThe number of table definitions that have been cached.
Opened_tablesThe number of tables that have been opened. If
Opened_tablesis big, yourtable_open_cachevalue is probably too small.Performance_schema_*xxx*Performance Schema status variables are listed in Section “Performance Schema Status Variables”. These variables provide information about instrumentation that could not be loaded or created due to memory constraints.
Prepared_stmt_countThe current number of prepared statements. (The maximum number of statements is given by the
max_prepared_stmt_countsystem variable.)Qcache_free_blocksThis status variable was removed in MySQL 8.0.3.
Qcache_free_memoryThis status variable was removed in MySQL 8.0.3.
Qcache_hitsThis status variable was removed in MySQL 8.0.3.
Qcache_insertsThis status variable was removed in MySQL 8.0.3.
Qcache_lowmem_prunesThis status variable was removed in MySQL 8.0.3.
Qcache_not_cachedThis status variable was removed in MySQL 8.0.3.
Qcache_queries_in_cacheThis status variable was removed in MySQL 8.0.3.
Qcache_total_blocksThis status variable was removed in MySQL 8.0.3.
QueriesThe number of statements executed by the server. This variable includes statements executed within stored programs, unlike the
Questionsvariable. It does not countCOM_PINGorCOM_STATISTICScommands.The discussion at the beginning of this section indicates how to relate this statement-counting status variable to other such variables.
QuestionsThe number of statements executed by the server. This includes only statements sent to the server by clients and not statements executed within stored programs, unlike the
Queriesvariable. This variable does not countCOM_PING,COM_STATISTICS,COM_STMT_PREPARE,COM_STMT_CLOSE, orCOM_STMT_RESETcommands.The discussion at the beginning of this section indicates how to relate this statement-counting status variable to other such variables.
Rpl_semi_sync_master_clientsThe number of semisynchronous slaves.
This variable is available only if the master-side semisynchronous replication plugin is installed.
Rpl_semi_sync_master_net_avg_wait_timeThe average time in microseconds the master waited for a slave reply. This variable is always
0, is deprecated and it will be removed in a future version.This variable is available only if the master-side semisynchronous replication plugin is installed.
Rpl_semi_sync_master_net_wait_timeThe total time in microseconds the master waited for slave replies. This variable is always
0, is deprecated and it will be removed in a future version.This variable is available only if the master-side semisynchronous replication plugin is installed.
Rpl_semi_sync_master_net_waitsThe total number of times the master waited for slave replies.
This variable is available only if the master-side semisynchronous replication plugin is installed.
Rpl_semi_sync_master_no_timesThe number of times the master turned off semisynchronous replication.
This variable is available only if the master-side semisynchronous replication plugin is installed.
Rpl_semi_sync_master_no_txThe number of commits that were not acknowledged successfully by a slave.
This variable is available only if the master-side semisynchronous replication plugin is installed.
Rpl_semi_sync_master_statusWhether semisynchronous replication currently is operational on the master. The value is
ONif the plugin has been enabled and a commit acknowledgment has occurred. It isOFFif the plugin is not enabled or the master has fallen back to asynchronous replication due to commit acknowledgment timeout.This variable is available only if the master-side semisynchronous replication plugin is installed.
Rpl_semi_sync_master_timefunc_failuresThe number of times the master failed when calling time functions such as
gettimeofday().This variable is available only if the master-side semisynchronous replication plugin is installed.
Rpl_semi_sync_master_tx_avg_wait_timeThe average time in microseconds the master waited for each transaction.
This variable is available only if the master-side semisynchronous replication plugin is installed.
Rpl_semi_sync_master_tx_wait_timeThe total time in microseconds the master waited for transactions.
This variable is available only if the master-side semisynchronous replication plugin is installed.
Rpl_semi_sync_master_tx_waitsThe total number of times the master waited for transactions.
This variable is available only if the master-side semisynchronous replication plugin is installed.
Rpl_semi_sync_master_wait_pos_backtraverseThe total number of times the master waited for an event with binary coordinates lower than events waited for previously. This can occur when the order in which transactions start waiting for a reply is different from the order in which their binary log events are written.
This variable is available only if the master-side semisynchronous replication plugin is installed.
Rpl_semi_sync_master_wait_sessionsThe number of sessions currently waiting for slave replies.
This variable is available only if the master-side semisynchronous replication plugin is installed.
Rpl_semi_sync_master_yes_txThe number of commits that were acknowledged successfully by a slave.
This variable is available only if the master-side semisynchronous replication plugin is installed.
Rpl_semi_sync_slave_statusWhether semisynchronous replication currently is operational on the slave. This is
ONif the plugin has been enabled and the slave I/O thread is running,OFFotherwise.This variable is available only if the slave-side semisynchronous replication plugin is installed.
Rsa_public_keyThe value of this variable is the public key used by the
sha256_passwordauthentication plugin for RSA key pair-based password exchange. The value is nonempty only if the server successfully initializes the private and public keys in the files named by thesha256_password_private_key_pathandsha256_password_public_key_pathsystem variables. The value ofRsa_public_keycomes from the latter file.Secondary_engine_execution_countFor future use. This variable was added in MySQL 8.0.13.
Select_full_joinThe number of joins that perform table scans because they do not use indexes. If this value is not 0, you should carefully check the indexes of your tables.
Select_full_range_joinThe number of joins that used a range search on a reference table.
Select_rangeThe number of joins that used ranges on the first table. This is normally not a critical issue even if the value is quite large.
Select_range_checkThe number of joins without keys that check for key usage after each row. If this is not 0, you should carefully check the indexes of your tables.
Select_scanThe number of joins that did a full scan of the first table.
Slave_heartbeat_periodThis variable is obsolete and was removed in MySQL 8.0.1. Instead, use the
HEARTBEAT_INTERVALcolumn of thereplication_connection_configurationtable.Slave_last_heartbeatThis variable is obsolete and was removed in MySQL 8.0.1. Instead, use the
LAST_HEARTBEAT_TIMESTAMPcolumn of thereplication_connection_statustable.Slave_open_temp_tablesThe number of temporary tables that the slave SQL thread currently has open. If the value is greater than zero, it is not safe to shut down the slave; “Replication and Temporary Tables”. This variable reports the total count of open temporary tables for all replication channels.
Slave_received_heartbeatsThis variable is obsolete and was removed in MySQL 8.0.1. Instead, use the
COUNT_RECEIVED_HEARTBEATScolumn of thereplication_connection_statustable.Slave_retried_transactionsThis variable is obsolete and was removed in MySQL 8.0.1. Instead, use the
COUNT_TRANSACTIONS_RETRIEScolumn of thereplication_applier_statustable.Slave_rows_last_search_algorithm_usedThe search algorithm that was most recently used by this slave to locate rows for row-based replication. The result shows whether the slave used indexes, a table scan, or hashing as the search algorithm for the last transaction executed on any channel.
The method used depends on the setting for the
slave_rows_search_algorithmssystem variable, and the keys that are available on the relevant table.This variable is available only for debug builds of MySQL.
Slave_runningThis variable is obsolete and was removed in MySQL 8.0.1. Instead, use the
SERVICE_STATEcolumn of thereplication_connection_statusandreplication_applier_statustables.Slow_launch_threadsThe number of threads that have taken more than
slow_launch_timeseconds to create.Slow_queriesThe number of queries that have taken more than
long_query_timeseconds. This counter increments regardless of whether the slow query log is enabled.Sort_merge_passesThe number of merge passes that the sort algorithm has had to do. If this value is large, you should consider increasing the value of the
sort_buffer_sizesystem variable.Sort_rangeThe number of sorts that were done using ranges.
Sort_rowsThe number of sorted rows.
Sort_scanThe number of sorts that were done by scanning the table.
Ssl_accept_renegotiatesThe number of negotiates needed to establish the connection.
Ssl_acceptsThe number of accepted SSL connections.
Ssl_callback_cache_hitsThe number of callback cache hits.
Ssl_cipherThe current encryption cipher (empty for unencrypted connections).
Ssl_cipher_listThe list of possible SSL ciphers (empty for non-SSL connections). If MySQL supports TLSv1.3, the value includes the possible TLSv1.3 ciphersuites.
Ssl_client_connectsThe number of SSL connection attempts to an SSL-enabled master.
Ssl_connect_renegotiatesThe number of negotiates needed to establish the connection to an SSL-enabled master.
Ssl_ctx_verify_depthThe SSL context verification depth (how many certificates in the chain are tested).
Ssl_ctx_verify_modeThe SSL context verification mode.
Ssl_default_timeoutThe default SSL timeout.
Ssl_finished_acceptsThe number of successful SSL connections to the server.
Ssl_finished_connectsThe number of successful slave connections to an SSL-enabled master.
Ssl_server_not_afterThe last date for which the SSL certificate is valid. To check SSL certificate expiration information, use this statement:
1
2
3
4
5
6
7mysql> SHOW STATUS LIKE 'Ssl_server_not%';
+-----------------------+--------------------------+
| Variable_name | Value |
+-----------------------+--------------------------+
| Ssl_server_not_after | Apr 28 14:16:39 2025 GMT |
| Ssl_server_not_before | May 1 14:16:39 2015 GMT |
+-----------------------+--------------------------+Ssl_server_not_beforeThe first date for which the SSL certificate is valid.
Ssl_session_cache_hitsThe number of SSL session cache hits.
Ssl_session_cache_missesThe number of SSL session cache misses.
Ssl_session_cache_modeThe SSL session cache mode.
Ssl_session_cache_overflowsThe number of SSL session cache overflows.
Ssl_session_cache_sizeThe SSL session cache size.
Ssl_session_cache_timeoutsThe number of SSL session cache timeouts.
Ssl_sessions_reusedHow many SSL connections were reused from the cache.
Ssl_used_session_cache_entriesHow many SSL session cache entries were used.
Ssl_verify_depthThe verification depth for replication SSL connections.
Ssl_verify_modeThe verification mode used by the server for a connection that uses SSL. The value is a bitmask; bits are defined in the
openssl/ssl.hheader file:1
2
3
4define SSL_VERIFY_NONE 0x00
define SSL_VERIFY_PEER 0x01
define SSL_VERIFY_FAIL_IF_NO_PEER_CERT 0x02
define SSL_VERIFY_CLIENT_ONCE 0x04SSL_VERIFY_PEERindicates that the server asks for a client certificate. If the client supplies one, the server performs verification and proceeds only if verification is successful.SSL_VERIFY_CLIENT_ONCEindicates that a request for the client certificate will be done only in the initial handshake.Ssl_versionThe SSL protocol version of the connection (for example, TLSv1). If the connection is not encrypted, the value is empty.
Table_locks_immediateThe number of times that a request for a table lock could be granted immediately.
Table_locks_waitedThe number of times that a request for a table lock could not be granted immediately and a wait was needed. If this is high and you have performance problems, you should first optimize your queries, and then either split your table or tables or use replication.
Table_open_cache_hitsThe number of hits for open tables cache lookups.
Table_open_cache_missesThe number of misses for open tables cache lookups.
Table_open_cache_overflowsThe number of overflows for the open tables cache. This is the number of times, after a table is opened or closed, a cache instance has an unused entry and the size of the instance is larger than
table_open_cache/table_open_cache_instances.Tc_log_max_pages_usedFor the memory-mapped implementation of the log that is used by mysqld when it acts as the transaction coordinator for recovery of internal XA transactions, this variable indicates the largest number of pages used for the log since the server started. If the product of
Tc_log_max_pages_usedandTc_log_page_sizeis always significantly less than the log size, the size is larger than necessary and can be reduced. (The size is set by the--log-tc-sizeoption. This variable is unused: It is unneeded for binary log-based recovery, and the memory-mapped recovery log method is not used unless the number of storage engines that are capable of two-phase commit and that support XA transactions is greater than one. (InnoDBis the only applicable engine.)Tc_log_page_sizeThe page size used for the memory-mapped implementation of the XA recovery log. The default value is determined using
getpagesize(). This variable is unused for the same reasons as described forTc_log_max_pages_used.Tc_log_page_waitsFor the memory-mapped implementation of the recovery log, this variable increments each time the server was not able to commit a transaction and had to wait for a free page in the log. If this value is large, you might want to increase the log size (with the
--log-tc-sizeoption). For binary log-based recovery, this variable increments each time the binary log cannot be closed because there are two-phase commits in progress. (The close operation waits until all such transactions are finished.)Threads_cachedThe number of threads in the thread cache.
Threads_connectedThe number of currently open connections.
Threads_createdThe number of threads created to handle connections. If
Threads_createdis big, you may want to increase thethread_cache_sizevalue. The cache miss rate can be calculated asThreads_created/Connections.Threads_runningThe number of threads that are not sleeping.
UptimeThe number of seconds that the server has been up.
Uptime_since_flush_statusThe number of seconds since the most recent
FLUSH STATUSstatement.