5.1.6 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 (see Section 13.7.5.32, “SHOW STATUS Syntax”). The optional GLOBAL keyword aggregates the values over all connections, and SESSION shows the values for the current connection.

mysql> SHOW GLOBAL STATUS;
+-----------------------------------+------------+
| Variable_name                     | Value      |
+-----------------------------------+------------+
| Aborted_clients                   | 0          |
| Aborted_connects                  | 0          |
| Bytes_received                    | 155372598  |
| Bytes_sent                        | 1176560426 |
...
| Connections                       | 30023      |
| Created_tmp_disk_tables           | 0          |
| Created_tmp_files                 | 3          |
| Created_tmp_tables                | 2          |
...
| Threads_created                   | 217        |
| Threads_running                   | 88         |
| Uptime                            | 1389872    |
+-----------------------------------+------------+

Note

Before MySQL 5.0.2, SHOW STATUS returned global status values. Because the default as of 5.0.2 is to return session values, this is incompatible with previous versions. To issue a SHOW STATUS statement that will retrieve global status values for all versions of MySQL, write it like this:

SHOW /*!50002 GLOBAL */ STATUS;

Many status variables are reset to 0 by the FLUSH STATUS statement.

The following table lists all available server status variables:

Table 5.4 Status Variable Summary

Variable NameVariable TypeVariable Scope
Aborted_clientsintegerGLOBAL
Aborted_connectsintegerGLOBAL
Binlog_cache_disk_useintegerGLOBAL
Binlog_cache_useintegerGLOBAL
Bytes_receivedintegerGLOBAL | SESSION
Bytes_sentintegerGLOBAL | SESSION
Com_admin_commandsintegerGLOBAL | SESSION
Com_alter_dbintegerGLOBAL | SESSION
Com_alter_eventintegerGLOBAL | SESSION
Com_alter_tableintegerGLOBAL | SESSION
Com_analyzeintegerGLOBAL | SESSION
Com_backup_tableintegerGLOBAL | SESSION
Com_beginintegerGLOBAL | SESSION
Com_call_procedureintegerGLOBAL | SESSION
Com_change_dbintegerGLOBAL | SESSION
Com_change_masterintegerGLOBAL | SESSION
Com_checkintegerGLOBAL | SESSION
Com_checksumintegerGLOBAL | SESSION
Com_commitintegerGLOBAL | SESSION
Com_create_dbintegerGLOBAL | SESSION
Com_create_eventintegerGLOBAL | SESSION
Com_create_functionintegerGLOBAL | SESSION
Com_create_indexintegerGLOBAL | SESSION
Com_create_tableintegerGLOBAL | SESSION
Com_create_userintegerGLOBAL | SESSION
Com_dealloc_sqlintegerGLOBAL | SESSION
Com_deleteintegerGLOBAL | SESSION
Com_delete_multiintegerGLOBAL | SESSION
Com_dointegerGLOBAL | SESSION
Com_drop_dbintegerGLOBAL | SESSION
Com_drop_eventintegerGLOBAL | SESSION
Com_drop_functionintegerGLOBAL | SESSION
Com_drop_indexintegerGLOBAL | SESSION
Com_drop_tableintegerGLOBAL | SESSION
Com_drop_userintegerGLOBAL | SESSION
Com_execute_sqlintegerGLOBAL | SESSION
Com_flushintegerGLOBAL | SESSION
Com_grantintegerGLOBAL | SESSION
Com_ha_closeintegerGLOBAL | SESSION
Com_ha_openintegerGLOBAL | SESSION
Com_ha_readintegerGLOBAL | SESSION
Com_helpintegerGLOBAL | SESSION
Com_insertintegerGLOBAL | SESSION
Com_insert_selectintegerGLOBAL | SESSION
Com_killintegerGLOBAL | SESSION
Com_loadintegerGLOBAL | SESSION
Com_lock_tablesintegerGLOBAL | SESSION
Com_optimizeintegerGLOBAL | SESSION
Com_preload_keysintegerGLOBAL | SESSION
Com_prepare_sqlintegerGLOBAL | SESSION
Com_purgeintegerGLOBAL | SESSION
Com_purge_before_dateintegerGLOBAL | SESSION
Com_rename_tableintegerGLOBAL | SESSION
Com_repairintegerGLOBAL | SESSION
Com_replaceintegerGLOBAL | SESSION
Com_replace_selectintegerGLOBAL | SESSION
Com_resetintegerGLOBAL | SESSION
Com_restore_tableintegerGLOBAL | SESSION
Com_revokeintegerGLOBAL | SESSION
Com_revoke_allintegerGLOBAL | SESSION
Com_rollbackintegerGLOBAL | SESSION
Com_savepointintegerGLOBAL | SESSION
Com_selectintegerGLOBAL | SESSION
Com_set_optionintegerGLOBAL | SESSION
Com_show_binlog_eventsintegerGLOBAL | SESSION
Com_show_binlogsintegerGLOBAL | SESSION
Com_show_charsetsintegerGLOBAL | SESSION
Com_show_collationsintegerGLOBAL | SESSION
Com_show_column_typesintegerGLOBAL | SESSION
Com_show_create_dbintegerGLOBAL | SESSION
Com_show_create_eventintegerGLOBAL | SESSION
Com_show_create_tableintegerGLOBAL | SESSION
Com_show_databasesintegerGLOBAL | SESSION
Com_show_engine_logsintegerGLOBAL | SESSION
Com_show_engine_mutexintegerGLOBAL | SESSION
Com_show_engine_statusintegerGLOBAL | SESSION
Com_show_errorsintegerGLOBAL | SESSION
Com_show_eventsintegerGLOBAL | SESSION
Com_show_fieldsintegerGLOBAL | SESSION
Com_show_grantsintegerGLOBAL | SESSION
Com_show_innodb_statusintegerGLOBAL | SESSION
Com_show_keysintegerGLOBAL | SESSION
Com_show_logsintegerGLOBAL | SESSION
Com_show_master_statusintegerGLOBAL | SESSION
Com_show_ndb_statusintegerGLOBAL | SESSION
Com_show_new_masterintegerGLOBAL | SESSION
Com_show_open_tablesintegerGLOBAL | SESSION
Com_show_pluginsintegerGLOBAL | SESSION
Com_show_privilegesintegerGLOBAL | SESSION
Com_show_processlistintegerGLOBAL | SESSION
Com_show_slave_hostsintegerGLOBAL | SESSION
Com_show_slave_statusintegerGLOBAL | SESSION
Com_show_statusintegerGLOBAL | SESSION
Com_show_storage_enginesintegerGLOBAL | SESSION
Com_show_tablesintegerGLOBAL | SESSION
Com_show_triggersintegerGLOBAL | SESSION
Com_show_variablesintegerGLOBAL | SESSION
Com_show_warningsintegerGLOBAL | SESSION
Com_slave_startintegerGLOBAL | SESSION
Com_slave_stopintegerGLOBAL | SESSION
Com_stmt_closeintegerGLOBAL | SESSION
Com_stmt_executeintegerGLOBAL | SESSION
Com_stmt_fetchintegerGLOBAL | SESSION
Com_stmt_prepareintegerGLOBAL | SESSION
Com_stmt_resetintegerGLOBAL | SESSION
Com_stmt_send_long_dataintegerGLOBAL | SESSION
Com_truncateintegerGLOBAL | SESSION
Com_unlock_tablesintegerGLOBAL | SESSION
Com_updateintegerGLOBAL | SESSION
Com_update_multiintegerGLOBAL | SESSION
Com_xa_commitintegerGLOBAL | SESSION
Com_xa_endintegerGLOBAL | SESSION
Com_xa_prepareintegerGLOBAL | SESSION
Com_xa_recoverintegerGLOBAL | SESSION
Com_xa_rollbackintegerGLOBAL | SESSION
Com_xa_startintegerGLOBAL | SESSION
CompressionintegerSESSION
ConnectionsintegerGLOBAL
Created_tmp_disk_tablesintegerGLOBAL | SESSION
Created_tmp_filesintegerGLOBAL
Created_tmp_tablesintegerGLOBAL | SESSION
Delayed_errorsintegerGLOBAL
Delayed_insert_threadsintegerGLOBAL
Delayed_writesintegerGLOBAL
Flush_commandsintegerGLOBAL
Handler_commitintegerGLOBAL | SESSION
Handler_deleteintegerGLOBAL | SESSION
Handler_discoverintegerGLOBAL | SESSION
Handler_prepareintegerGLOBAL | SESSION
Handler_read_firstintegerGLOBAL | SESSION
Handler_read_keyintegerGLOBAL | SESSION
Handler_read_nextintegerGLOBAL | SESSION
Handler_read_previntegerGLOBAL | SESSION
Handler_read_rndintegerGLOBAL | SESSION
Handler_read_rnd_nextintegerGLOBAL | SESSION
Handler_rollbackintegerGLOBAL | SESSION
Handler_savepointintegerGLOBAL | SESSION
Handler_savepoint_rollbackintegerGLOBAL | SESSION
Handler_updateintegerGLOBAL | SESSION
Handler_writeintegerGLOBAL | SESSION
Innodb_buffer_pool_pages_dataintegerGLOBAL
Innodb_buffer_pool_pages_dirtyintegerGLOBAL
Innodb_buffer_pool_pages_flushedintegerGLOBAL
Innodb_buffer_pool_pages_freeintegerGLOBAL
Innodb_buffer_pool_pages_latchedintegerGLOBAL
Innodb_buffer_pool_pages_miscintegerGLOBAL
Innodb_buffer_pool_pages_totalintegerGLOBAL
Innodb_buffer_pool_read_ahead_rndintegerGLOBAL
Innodb_buffer_pool_read_ahead_seqintegerGLOBAL
Innodb_buffer_pool_read_requestsintegerGLOBAL
Innodb_buffer_pool_readsintegerGLOBAL
Innodb_buffer_pool_wait_freeintegerGLOBAL
Innodb_buffer_pool_write_requestsintegerGLOBAL
Innodb_data_fsyncsintegerGLOBAL
Innodb_data_pending_fsyncsintegerGLOBAL
Innodb_data_pending_readsintegerGLOBAL
Innodb_data_pending_writesintegerGLOBAL
Innodb_data_readintegerGLOBAL
Innodb_data_readsintegerGLOBAL
Innodb_data_writesintegerGLOBAL
Innodb_data_writtenintegerGLOBAL
Innodb_dblwr_pages_writtenintegerGLOBAL
Innodb_dblwr_writesintegerGLOBAL
Innodb_log_waitsintegerGLOBAL
Innodb_log_write_requestsintegerGLOBAL
Innodb_log_writesintegerGLOBAL
Innodb_os_log_fsyncsintegerGLOBAL
Innodb_os_log_pending_fsyncsintegerGLOBAL
Innodb_os_log_pending_writesintegerGLOBAL
Innodb_os_log_writtenintegerGLOBAL
Innodb_page_sizeintegerGLOBAL
Innodb_pages_createdintegerGLOBAL
Innodb_pages_readintegerGLOBAL
Innodb_pages_writtenintegerGLOBAL
Innodb_row_lock_current_waitsintegerGLOBAL
Innodb_row_lock_timeintegerGLOBAL
Innodb_row_lock_time_avgintegerGLOBAL
Innodb_row_lock_time_maxintegerGLOBAL
Innodb_row_lock_waitsintegerGLOBAL
Innodb_rows_deletedintegerGLOBAL
Innodb_rows_insertedintegerGLOBAL
Innodb_rows_readintegerGLOBAL
Innodb_rows_updatedintegerGLOBAL
Key_blocks_not_flushedintegerGLOBAL
Key_blocks_unusedintegerGLOBAL
Key_blocks_usedintegerGLOBAL
Key_read_requestsintegerGLOBAL
Key_readsintegerGLOBAL
Key_write_requestsintegerGLOBAL
Key_writesintegerGLOBAL
Last_query_costnumericSESSION
Max_used_connectionsintegerGLOBAL
Ndb_cluster_node_idintegerGLOBAL | SESSION
Ndb_config_from_hostintegerGLOBAL | SESSION
Ndb_config_from_portintegerGLOBAL | SESSION
Ndb_cluster_node_idintegerGLOBAL
Not_flushed_delayed_rowsintegerGLOBAL
Open_filesintegerGLOBAL
Open_streamsintegerGLOBAL
Open_tablesintegerGLOBAL | SESSION
Opened_tablesintegerGLOBAL | SESSION
Prepared_stmt_countintegerGLOBAL
Qcache_free_blocksintegerGLOBAL
Qcache_free_memoryintegerGLOBAL
Qcache_hitsintegerGLOBAL
Qcache_insertsintegerGLOBAL
Qcache_lowmem_prunesintegerGLOBAL
Qcache_not_cachedintegerGLOBAL
Qcache_queries_in_cacheintegerGLOBAL
Qcache_total_blocksintegerGLOBAL
QueriesintegerGLOBAL | SESSION
QuestionsintegerGLOBAL | SESSION
Rpl_statusstringGLOBAL
Select_full_joinintegerGLOBAL | SESSION
Select_full_range_joinintegerGLOBAL | SESSION
Select_rangeintegerGLOBAL | SESSION
Select_range_checkintegerGLOBAL | SESSION
Select_scanintegerGLOBAL | SESSION
Slave_open_temp_tablesintegerGLOBAL
Slave_retried_transactionsintegerGLOBAL
Slave_runningbooleanGLOBAL
Slow_launch_threadsintegerGLOBAL | SESSION
Slow_queriesintegerGLOBAL | SESSION
Sort_merge_passesintegerGLOBAL | SESSION
Sort_rangeintegerGLOBAL | SESSION
Sort_rowsintegerGLOBAL | SESSION
Sort_scanintegerGLOBAL | SESSION
Ssl_accept_renegotiatesintegerGLOBAL
Ssl_acceptsintegerGLOBAL
Ssl_callback_cache_hitsintegerGLOBAL
Ssl_cipherstringGLOBAL | SESSION
Ssl_cipher_liststringGLOBAL | SESSION
Ssl_client_connectsintegerGLOBAL
Ssl_connect_renegotiatesintegerGLOBAL
Ssl_ctx_verify_depthintegerGLOBAL
Ssl_ctx_verify_modeintegerGLOBAL
Ssl_default_timeoutintegerGLOBAL | SESSION
Ssl_finished_acceptsintegerGLOBAL
Ssl_finished_connectsintegerGLOBAL
Ssl_session_cache_hitsintegerGLOBAL
Ssl_session_cache_missesintegerGLOBAL
Ssl_session_cache_modestringGLOBAL
Ssl_session_cache_overflowsintegerGLOBAL
Ssl_session_cache_sizeintegerGLOBAL
Ssl_session_cache_timeoutsintegerGLOBAL
Ssl_sessions_reusedintegerGLOBAL | SESSION
Ssl_used_session_cache_entriesintegerGLOBAL
Ssl_verify_depthintegerGLOBAL | SESSION
Ssl_verify_modeintegerGLOBAL | SESSION
Ssl_versionstringGLOBAL | SESSION
Table_locks_immediateintegerGLOBAL
Table_locks_waitedintegerGLOBAL
Tc_log_max_pages_usedintegerGLOBAL
Tc_log_page_sizeintegerGLOBAL
Tc_log_page_waitsintegerGLOBAL
Threads_cachedintegerGLOBAL
Threads_connectedintegerGLOBAL
Threads_createdintegerGLOBAL
Threads_runningintegerGLOBAL
UptimeintegerGLOBAL
Uptime_since_flush_statusintegerGLOBAL

The status variables have the following meanings. For meanings of status variables specific to MySQL Cluster, see Section 17.3.4.4, “MySQL Cluster Status Variables”.