MySQL SHOW STATUS命令介紹
SHOW STATUS提供MySQL服務的狀態資訊,執行這個語句只需要連線到MySQL資料庫的許可權。
這些服務狀態資訊來源於以下:
① 效能使用者的表。
② INFORMATION_SCHEMA使用者下的GLOBAL_STATUS和SESSION_STATUS表。
MariaDB [test]> desc information_schema.global_status;
+----------------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+---------------+------+-----+---------+-------+
| VARIABLE_NAME | varchar(64) | NO | | | |
| VARIABLE_VALUE | varchar(2048) | NO | | | |
+----------------+---------------+------+-----+---------+-------+
2 rows in set (0.12 sec)
MariaDB [test]> select * from information_schema.global_status where variable_name like 'Com_insert%';
+-------------------+----------------+
| VARIABLE_NAME | VARIABLE_VALUE |
+-------------------+----------------+
| COM_INSERT | 106 |
| COM_INSERT_SELECT | 10 |
+-------------------+----------------+
2 rows in set (0.00 sec)
MariaDB [test]> desc information_schema.session_status;
+----------------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+---------------+------+-----+---------+-------+
| VARIABLE_NAME | varchar(64) | NO | | | |
| VARIABLE_VALUE | varchar(2048) | NO | | | |
+----------------+---------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
MariaDB [test]> select * from information_schema.session_status where variable_name like 'Com_insert%';
+-------------------+----------------+
| VARIABLE_NAME | VARIABLE_VALUE |
+-------------------+----------------+
| COM_INSERT | 19 |
| COM_INSERT_SELECT | 0 |
+-------------------+----------------+
2 rows in set (0.00 sec)
③ mysqladmin的extended-status命令
[root@localhost 20160630]# /maria/bin/mysqladmin -uroot -p extended-status|grep Com|more
Enter password:
| Com_admin_commands | 0 |
| Com_alter_db | 0 |
| Com_alter_db_upgrade | 0 |
| Com_alter_event | 0 |
| Com_alter_function | 0 |
| Com_alter_procedure | 0 |
| Com_alter_server | 0 |
| Com_alter_table | 40 |
| Com_alter_tablespace | 0 |
| Com_analyze | 3 |
| Com_assign_to_keycache | 0 |
| Com_begin | 0 |
| Com_binlog | 0 |
| Com_call_procedure | 3 |
| Com_change_db | 43 |
| Com_change_master | 0 |
| Com_check | 0 |
| Com_checksum | 0 |
| Com_commit | 0 |
| Com_compound_sql | 0 |
| Com_create_db | 1 |
| Com_create_event | 0 |
| Com_create_function | 0 |
| Com_create_index | 4 |
| Com_create_procedure | 4 |
SHOW STATUS接受GLOBAL或SESSION引數,分別顯示全域性或當前連線會話資訊,如果不帶引數則顯示的是當前會話的資訊。
每次呼叫SHOW STATUS語句會使用一個臨時表,並會增加Created_tmp_tables全域性引數的值。
MariaDB [test]> show global status like 'Created_tmp_tables';
+--------------------+-------+
| Variable_name | Value |
+--------------------+-------+
| Created_tmp_tables | 894 |
+--------------------+-------+
1 row in set (0.00 sec)
MariaDB [test]> show global status like 'Created_tmp_tables';
+--------------------+-------+
| Variable_name | Value |
+--------------------+-------+
| Created_tmp_tables | 895 |
+--------------------+-------+
1 row in set (0.00 sec)
--常用的統計引數
Com_select 執行SELECT操作的次數
Com_insert 執行INSERT操作的次數
Com_update 執行UPDATE操作的次數
Com_delete 執行DELETE操作的次數
Innodb_rows_read InnoDB儲存引擎SELECT查詢返回的行數
Innodb_rows_inserted InnoDB儲存引擎執行INSERT操作插入的行數
Innodb_rows_updated InnoDB儲存引擎執行UPDATE操作更新的行數
Innodb_rows_deleted InnoDB儲存引擎執行DELETE操作刪除的行數
Connections 連線數
Uptime 伺服器工作時間
Slow_queries 慢查詢的次數
MariaDB [test]> show global status like 'Innodb_rows%';
+----------------------+-------+
| Variable_name | Value |
+----------------------+-------+
| Innodb_rows_deleted | 512 |
| Innodb_rows_inserted | 1662 |
| Innodb_rows_read | 4557 |
| Innodb_rows_updated | 4 |
+----------------------+-------+
4 rows in set (0.00 sec)
MariaDB [test]> show global status like 'Connection%';
+-----------------------------------+-------+
| Variable_name | Value |
+-----------------------------------+-------+
| Connection_errors_accept | 0 |
| Connection_errors_internal | 0 |
| Connection_errors_max_connections | 0 |
| Connection_errors_peer_address | 0 |
| Connection_errors_select | 0 |
| Connection_errors_tcpwrap | 0 |
| Connections | 15 |
+-----------------------------------+-------+
7 rows in set (0.00 sec)
MariaDB [test]> show global status like 'Uptime%';
+---------------------------+---------+
| Variable_name | Value |
+---------------------------+---------+
| Uptime | 1285789 |
| Uptime_since_flush_status | 1285789 |
+---------------------------+---------+
2 rows in set (0.00 sec)
MariaDB [test]> show global status like 'Slow_queries%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Slow_queries | 0 |
+---------------+-------+
1 row in set (0.00 sec)
這些服務狀態資訊來源於以下:
① 效能使用者的表。
② INFORMATION_SCHEMA使用者下的GLOBAL_STATUS和SESSION_STATUS表。
MariaDB [test]> desc information_schema.global_status;
+----------------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+---------------+------+-----+---------+-------+
| VARIABLE_NAME | varchar(64) | NO | | | |
| VARIABLE_VALUE | varchar(2048) | NO | | | |
+----------------+---------------+------+-----+---------+-------+
2 rows in set (0.12 sec)
MariaDB [test]> select * from information_schema.global_status where variable_name like 'Com_insert%';
+-------------------+----------------+
| VARIABLE_NAME | VARIABLE_VALUE |
+-------------------+----------------+
| COM_INSERT | 106 |
| COM_INSERT_SELECT | 10 |
+-------------------+----------------+
2 rows in set (0.00 sec)
MariaDB [test]> desc information_schema.session_status;
+----------------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+---------------+------+-----+---------+-------+
| VARIABLE_NAME | varchar(64) | NO | | | |
| VARIABLE_VALUE | varchar(2048) | NO | | | |
+----------------+---------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
MariaDB [test]> select * from information_schema.session_status where variable_name like 'Com_insert%';
+-------------------+----------------+
| VARIABLE_NAME | VARIABLE_VALUE |
+-------------------+----------------+
| COM_INSERT | 19 |
| COM_INSERT_SELECT | 0 |
+-------------------+----------------+
2 rows in set (0.00 sec)
③ mysqladmin的extended-status命令
[root@localhost 20160630]# /maria/bin/mysqladmin -uroot -p extended-status|grep Com|more
Enter password:
| Com_admin_commands | 0 |
| Com_alter_db | 0 |
| Com_alter_db_upgrade | 0 |
| Com_alter_event | 0 |
| Com_alter_function | 0 |
| Com_alter_procedure | 0 |
| Com_alter_server | 0 |
| Com_alter_table | 40 |
| Com_alter_tablespace | 0 |
| Com_analyze | 3 |
| Com_assign_to_keycache | 0 |
| Com_begin | 0 |
| Com_binlog | 0 |
| Com_call_procedure | 3 |
| Com_change_db | 43 |
| Com_change_master | 0 |
| Com_check | 0 |
| Com_checksum | 0 |
| Com_commit | 0 |
| Com_compound_sql | 0 |
| Com_create_db | 1 |
| Com_create_event | 0 |
| Com_create_function | 0 |
| Com_create_index | 4 |
| Com_create_procedure | 4 |
SHOW STATUS接受GLOBAL或SESSION引數,分別顯示全域性或當前連線會話資訊,如果不帶引數則顯示的是當前會話的資訊。
每次呼叫SHOW STATUS語句會使用一個臨時表,並會增加Created_tmp_tables全域性引數的值。
MariaDB [test]> show global status like 'Created_tmp_tables';
+--------------------+-------+
| Variable_name | Value |
+--------------------+-------+
| Created_tmp_tables | 894 |
+--------------------+-------+
1 row in set (0.00 sec)
MariaDB [test]> show global status like 'Created_tmp_tables';
+--------------------+-------+
| Variable_name | Value |
+--------------------+-------+
| Created_tmp_tables | 895 |
+--------------------+-------+
1 row in set (0.00 sec)
--常用的統計引數
Com_select 執行SELECT操作的次數
Com_insert 執行INSERT操作的次數
Com_update 執行UPDATE操作的次數
Com_delete 執行DELETE操作的次數
Innodb_rows_read InnoDB儲存引擎SELECT查詢返回的行數
Innodb_rows_inserted InnoDB儲存引擎執行INSERT操作插入的行數
Innodb_rows_updated InnoDB儲存引擎執行UPDATE操作更新的行數
Innodb_rows_deleted InnoDB儲存引擎執行DELETE操作刪除的行數
Connections 連線數
Uptime 伺服器工作時間
Slow_queries 慢查詢的次數
MariaDB [test]> show global status like 'Innodb_rows%';
+----------------------+-------+
| Variable_name | Value |
+----------------------+-------+
| Innodb_rows_deleted | 512 |
| Innodb_rows_inserted | 1662 |
| Innodb_rows_read | 4557 |
| Innodb_rows_updated | 4 |
+----------------------+-------+
4 rows in set (0.00 sec)
MariaDB [test]> show global status like 'Connection%';
+-----------------------------------+-------+
| Variable_name | Value |
+-----------------------------------+-------+
| Connection_errors_accept | 0 |
| Connection_errors_internal | 0 |
| Connection_errors_max_connections | 0 |
| Connection_errors_peer_address | 0 |
| Connection_errors_select | 0 |
| Connection_errors_tcpwrap | 0 |
| Connections | 15 |
+-----------------------------------+-------+
7 rows in set (0.00 sec)
MariaDB [test]> show global status like 'Uptime%';
+---------------------------+---------+
| Variable_name | Value |
+---------------------------+---------+
| Uptime | 1285789 |
| Uptime_since_flush_status | 1285789 |
+---------------------------+---------+
2 rows in set (0.00 sec)
MariaDB [test]> show global status like 'Slow_queries%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Slow_queries | 0 |
+---------------+-------+
1 row in set (0.00 sec)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26506993/viewspace-2121658/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL show status 命令詳解MySql
- MySQL show status命令輸出結果詳解MySql
- Mysql---show table statusMySql
- MySQL show status命令常用輸出欄位詳解MySql
- MySQL 5.5 SHOW PROFILE、SHOW PROFILES語句介紹MySql
- MySQL的show engine innodb statusMySql
- MySQL pt-show-grants用法介紹MySql
- MySQL show engine innodb status 詳解MySql
- 【Mysql】show engine innodb status詳解MySql
- mysql show命令MySql
- mysql檢視儲存過程show procedure status;MySql儲存過程
- [MySQL進階之路][No.0002] SHOW SLAVE STATUSMySql
- MySQL執行狀態show status中文詳解MySql
- MySQL中的show命令MySql
- MYSQL SHOW VARIABLES簡介MySql
- SHOW SLAVE STATUS 詳解
- show master logs 和 show master status 區別AST
- mysql show命令用法大全MySql
- mysql show processlist命令詳解MySql
- show engine innodb status 詳解
- MySQL:5.6 大事務show engine innodb status故障一例MySql
- mysql 優化:使用show status檢視MySQL伺服器狀態資訊MySql優化伺服器
- MySQL:show slave status 關鍵值和MGRrelay log的清理策略MySql
- MySQL中show命令用法大全MySql
- MySQL Show命令的用法大全MySql
- SHOW ENGINE INNODB STATUS資訊詳解
- MySQL主從複製中的“show slave status”詳細含義MySql
- MySQL show status關鍵結果釋義和提升效能建議MySql
- MySQL show 命令使用大全 未完待續MySql
- show engine innodb status操作解析之一
- [原創] How to show chinese character in Git StatusGit
- 介紹一些有趣的MySQL pager命令MySql
- MySQL Utilities工具介紹和命令列總結MySql命令列
- MySql介紹MySql
- mysql學習之-show table status(獲取表的資訊)引數說明MySql
- SRVCTL命令介紹
- docker 命令介紹Docker
- tar命令介紹