5.1.6 Server Status Variables

The 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_clientsnumericGLOBAL
Aborted_connectsnumericGLOBAL
Binlog_cache_disk_usenumericGLOBAL
Binlog_cache_usenumericGLOBAL
Bytes_receivednumericGLOBAL | SESSION
Bytes_sentnumericGLOBAL | SESSION
Com_admin_commandsnumericGLOBAL | SESSION
Com_alter_dbnumericGLOBAL | SESSION
Com_alter_eventnumericGLOBAL | SESSION
Com_alter_tablenumericGLOBAL | SESSION
Com_analyzenumericGLOBAL | SESSION
Com_backup_tablenumericGLOBAL | SESSION
Com_beginnumericGLOBAL | SESSION
Com_call_procedurenumericGLOBAL | SESSION
Com_change_dbnumericGLOBAL | SESSION
Com_change_masternumericGLOBAL | SESSION
Com_checknumericGLOBAL | SESSION
Com_checksumnumericGLOBAL | SESSION
Com_commitnumericGLOBAL | SESSION
Com_create_dbnumericGLOBAL | SESSION
Com_create_eventnumericGLOBAL | SESSION
Com_create_functionnumericGLOBAL | SESSION
Com_create_indexnumericGLOBAL | SESSION
Com_create_tablenumericGLOBAL | SESSION
Com_create_usernumericGLOBAL | SESSION
Com_dealloc_sqlnumericGLOBAL | SESSION
Com_deletenumericGLOBAL | SESSION
Com_delete_multinumericGLOBAL | SESSION
Com_donumericGLOBAL | SESSION
Com_drop_dbnumericGLOBAL | SESSION
Com_drop_eventnumericGLOBAL | SESSION
Com_drop_functionnumericGLOBAL | SESSION
Com_drop_indexnumericGLOBAL | SESSION
Com_drop_tablenumericGLOBAL | SESSION
Com_drop_usernumericGLOBAL | SESSION
Com_execute_sqlnumericGLOBAL | SESSION
Com_flushnumericGLOBAL | SESSION
Com_grantnumericGLOBAL | SESSION
Com_ha_closenumericGLOBAL | SESSION
Com_ha_opennumericGLOBAL | SESSION
Com_ha_readnumericGLOBAL | SESSION
Com_helpnumericGLOBAL | SESSION
Com_insertnumericGLOBAL | SESSION
Com_insert_selectnumericGLOBAL | SESSION
Com_killnumericGLOBAL | SESSION
Com_loadnumericGLOBAL | SESSION
Com_lock_tablesnumericGLOBAL | SESSION
Com_optimizenumericGLOBAL | SESSION
Com_preload_keysnumericGLOBAL | SESSION
Com_prepare_sqlnumericGLOBAL | SESSION
Com_purgenumericGLOBAL | SESSION
Com_purge_before_datenumericGLOBAL | SESSION
Com_rename_tablenumericGLOBAL | SESSION
Com_repairnumericGLOBAL | SESSION
Com_replacenumericGLOBAL | SESSION
Com_replace_selectnumericGLOBAL | SESSION
Com_resetnumericGLOBAL | SESSION
Com_restore_tablenumericGLOBAL | SESSION
Com_revokenumericGLOBAL | SESSION
Com_revoke_allnumericGLOBAL | SESSION
Com_rollbacknumericGLOBAL | SESSION
Com_savepointnumericGLOBAL | SESSION
Com_selectnumericGLOBAL | SESSION
Com_set_optionnumericGLOBAL | SESSION
Com_show_binlog_eventsnumericGLOBAL | SESSION
Com_show_binlogsnumericGLOBAL | SESSION
Com_show_charsetsnumericGLOBAL | SESSION
Com_show_collationsnumericGLOBAL | SESSION
Com_show_column_typesnumericGLOBAL | SESSION
Com_show_create_dbnumericGLOBAL | SESSION
Com_show_create_eventnumericGLOBAL | SESSION
Com_show_create_tablenumericGLOBAL | SESSION
Com_show_databasesnumericGLOBAL | SESSION
Com_show_engine_logsnumericGLOBAL | SESSION
Com_show_engine_mutexnumericGLOBAL | SESSION
Com_show_engine_statusnumericGLOBAL | SESSION
Com_show_errorsnumericGLOBAL | SESSION
Com_show_eventsnumericGLOBAL | SESSION
Com_show_fieldsnumericGLOBAL | SESSION
Com_show_grantsnumericGLOBAL | SESSION
Com_show_innodb_statusnumericGLOBAL | SESSION
Com_show_keysnumericGLOBAL | SESSION
Com_show_logsnumericGLOBAL | SESSION
Com_show_master_statusnumericGLOBAL | SESSION
Com_show_ndb_statusnumericGLOBAL | SESSION
Com_show_new_masternumericGLOBAL | SESSION
Com_show_open_tablesnumericGLOBAL | SESSION
Com_show_pluginsnumericGLOBAL | SESSION
Com_show_privilegesnumericGLOBAL | SESSION
Com_show_processlistnumericGLOBAL | SESSION
Com_show_slave_hostsnumericGLOBAL | SESSION
Com_show_slave_statusnumericGLOBAL | SESSION
Com_show_statusnumericGLOBAL | SESSION
Com_show_storage_enginesnumericGLOBAL | SESSION
Com_show_tablesnumericGLOBAL | SESSION
Com_show_triggersnumericGLOBAL | SESSION
Com_show_variablesnumericGLOBAL | SESSION
Com_show_warningsnumericGLOBAL | SESSION
Com_slave_startnumericGLOBAL | SESSION
Com_slave_stopnumericGLOBAL | SESSION
Com_stmt_closenumericGLOBAL | SESSION
Com_stmt_executenumericGLOBAL | SESSION
Com_stmt_fetchnumericGLOBAL | SESSION
Com_stmt_preparenumericGLOBAL | SESSION
Com_stmt_resetnumericGLOBAL | SESSION
Com_stmt_send_long_datanumericGLOBAL | SESSION
Com_truncatenumericGLOBAL | SESSION
Com_unlock_tablesnumericGLOBAL | SESSION
Com_updatenumericGLOBAL | SESSION
Com_update_multinumericGLOBAL | SESSION
Com_xa_commitnumericGLOBAL | SESSION
Com_xa_endnumericGLOBAL | SESSION
Com_xa_preparenumericGLOBAL | SESSION
Com_xa_recovernumericGLOBAL | SESSION
Com_xa_rollbacknumericGLOBAL | SESSION
Com_xa_startnumericGLOBAL | SESSION
CompressionnumericSESSION
ConnectionsnumericGLOBAL
Created_tmp_disk_tablesnumericGLOBAL | SESSION
Created_tmp_filesnumericGLOBAL
Created_tmp_tablesnumericGLOBAL | SESSION
Delayed_errorsnumericGLOBAL
Delayed_insert_threadsnumericGLOBAL
Delayed_writesnumericGLOBAL
Flush_commandsnumericGLOBAL
Handler_commitnumericGLOBAL | SESSION
Handler_deletenumericGLOBAL | SESSION
Handler_discovernumericGLOBAL | SESSION
Handler_preparenumericGLOBAL | SESSION
Handler_read_firstnumericGLOBAL | SESSION
Handler_read_keynumericGLOBAL | SESSION
Handler_read_nextnumericGLOBAL | SESSION
Handler_read_prevnumericGLOBAL | SESSION
Handler_read_rndnumericGLOBAL | SESSION
Handler_read_rnd_nextnumericGLOBAL | SESSION
Handler_rollbacknumericGLOBAL | SESSION
Handler_savepointnumericGLOBAL | SESSION
Handler_savepoint_rollbacknumericGLOBAL | SESSION
Handler_updatenumericGLOBAL | SESSION
Handler_writenumericGLOBAL | SESSION
Innodb_buffer_pool_pages_datanumericGLOBAL
Innodb_buffer_pool_pages_dirtynumericGLOBAL
Innodb_buffer_pool_pages_flushednumericGLOBAL
Innodb_buffer_pool_pages_freenumericGLOBAL
Innodb_buffer_pool_pages_latchednumericGLOBAL
Innodb_buffer_pool_pages_miscnumericGLOBAL
Innodb_buffer_pool_pages_totalnumericGLOBAL
Innodb_buffer_pool_read_ahead_rndnumericGLOBAL
Innodb_buffer_pool_read_ahead_seqnumericGLOBAL
Innodb_buffer_pool_read_requestsnumericGLOBAL
Innodb_buffer_pool_readsnumericGLOBAL
Innodb_buffer_pool_wait_freenumericGLOBAL
Innodb_buffer_pool_write_requestsnumericGLOBAL
Innodb_data_fsyncsnumericGLOBAL
Innodb_data_pending_fsyncsnumericGLOBAL
Innodb_data_pending_readsnumericGLOBAL
Innodb_data_pending_writesnumericGLOBAL
Innodb_data_readnumericGLOBAL
Innodb_data_readsnumericGLOBAL
Innodb_data_writesnumericGLOBAL
Innodb_data_writtennumericGLOBAL
Innodb_dblwr_pages_writtennumericGLOBAL
Innodb_dblwr_writesnumericGLOBAL
Innodb_log_waitsnumericGLOBAL
Innodb_log_write_requestsnumericGLOBAL
Innodb_log_writesnumericGLOBAL
Innodb_os_log_fsyncsnumericGLOBAL
Innodb_os_log_pending_fsyncsnumericGLOBAL
Innodb_os_log_pending_writesnumericGLOBAL
Innodb_os_log_writtennumericGLOBAL
Innodb_page_sizenumericGLOBAL
Innodb_pages_creatednumericGLOBAL
Innodb_pages_readnumericGLOBAL
Innodb_pages_writtennumericGLOBAL
Innodb_row_lock_current_waitsnumericGLOBAL
Innodb_row_lock_timenumericGLOBAL
Innodb_row_lock_time_avgnumericGLOBAL
Innodb_row_lock_time_maxnumericGLOBAL
Innodb_row_lock_waitsnumericGLOBAL
Innodb_rows_deletednumericGLOBAL
Innodb_rows_insertednumericGLOBAL
Innodb_rows_readnumericGLOBAL
Innodb_rows_updatednumericGLOBAL
Key_blocks_not_flushednumericGLOBAL
Key_blocks_unusednumericGLOBAL
Key_blocks_usednumericGLOBAL
Key_read_requestsnumericGLOBAL
Key_readsnumericGLOBAL
Key_write_requestsnumericGLOBAL
Key_writesnumericGLOBAL
Last_query_costnumericSESSION
Max_used_connectionsnumericGLOBAL
Ndb_cluster_node_idnumericGLOBAL | SESSION
Ndb_config_from_hostnumericGLOBAL | SESSION
Ndb_config_from_portnumericGLOBAL | SESSION
ndb-nodeidnumericGLOBAL
Not_flushed_delayed_rowsnumericGLOBAL
Open_filesnumericGLOBAL
Open_streamsnumericGLOBAL
Open_tablesnumericGLOBAL | SESSION
Opened_tablesnumericGLOBAL | SESSION
Prepared_stmt_countnumericGLOBAL
Qcache_free_blocksnumericGLOBAL
Qcache_free_memorynumericGLOBAL
Qcache_hitsnumericGLOBAL
Qcache_insertsnumericGLOBAL
Qcache_lowmem_prunesnumericGLOBAL
Qcache_not_cachednumericGLOBAL
Qcache_queries_in_cachenumericGLOBAL
Qcache_total_blocksnumericGLOBAL
QueriesnumericGLOBAL | SESSION
QuestionsnumericGLOBAL | SESSION
Rpl_statusstringGLOBAL
Select_full_joinnumericGLOBAL | SESSION
Select_full_range_joinnumericGLOBAL | SESSION
Select_rangenumericGLOBAL | SESSION
Select_range_checknumericGLOBAL | SESSION
Select_scannumericGLOBAL | SESSION
Slave_open_temp_tablesnumericGLOBAL
Slave_retried_transactionsnumericGLOBAL
Slave_runningbooleanGLOBAL
Slow_launch_threadsnumericGLOBAL | SESSION
Slow_queriesnumericGLOBAL | SESSION
Sort_merge_passesnumericGLOBAL | SESSION
Sort_rangenumericGLOBAL | SESSION
Sort_rowsnumericGLOBAL | SESSION
Sort_scannumericGLOBAL | SESSION
Ssl_accept_renegotiatesnumericGLOBAL
Ssl_acceptsnumericGLOBAL
Ssl_callback_cache_hitsnumericGLOBAL
Ssl_cipherstringGLOBAL | SESSION
Ssl_cipher_liststringGLOBAL | SESSION
Ssl_client_connectsnumericGLOBAL
Ssl_connect_renegotiatesnumericGLOBAL
Ssl_ctx_verify_depthnumericGLOBAL
Ssl_ctx_verify_modenumericGLOBAL
Ssl_default_timeoutnumericGLOBAL | SESSION
Ssl_finished_acceptsnumericGLOBAL
Ssl_finished_connectsnumericGLOBAL
Ssl_session_cache_hitsnumericGLOBAL
Ssl_session_cache_missesnumericGLOBAL
Ssl_session_cache_modestringGLOBAL
Ssl_session_cache_overflowsnumericGLOBAL
Ssl_session_cache_sizenumericGLOBAL
Ssl_session_cache_timeoutsnumericGLOBAL
Ssl_sessions_reusednumericGLOBAL | SESSION
Ssl_used_session_cache_entriesnumericGLOBAL
Ssl_verify_depthnumericGLOBAL | SESSION
Ssl_verify_modenumericGLOBAL | SESSION
Ssl_versionstringGLOBAL | SESSION
Table_locks_immediatenumericGLOBAL
Table_locks_waitednumericGLOBAL
Tc_log_max_pages_usednumericGLOBAL
Tc_log_page_sizenumericGLOBAL
Tc_log_page_waitsnumericGLOBAL
Threads_cachednumericGLOBAL
Threads_connectednumericGLOBAL
Threads_creatednumericGLOBAL
Threads_runningnumericGLOBAL
UptimenumericGLOBAL
Uptime_since_flush_statusnumericGLOBAL

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”.