10. GLOBAL_STATUS 与 SESSION_STATUS

10. GLOBAL_STATUS 与 SESSION_STATUS

注意
从MySQL 5.7.6开始,show_compatibility_56系统变量的值会影响此处描述的表中的可用信息。 有关详细信息,请参见“服务器系统变量”中该变量的说明。

注意
从MySQL 5.7.6开始,此处描述的表中提供的信息也可从Performance Schema获得。 不推荐使用INFORMATION_SCHEMA表,并且将在以后的MySQL版本中删除它们,优先使用Performance Schema表。 有关从INFORMATION_SCHEMA表迁移到性能模式表的建议,请参见“迁移到性能模式系统和状态变量表”。

mysql> select * from GLOBAL_STATUS ;
ERROR 3167 (HY000): The 'INFORMATION_SCHEMA.GLOBAL_STATUS' feature is disabled; see the documentation for 'show_compatibility_56'
mysql> select * from session_status;
ERROR 3167 (HY000): The 'INFORMATION_SCHEMA.SESSION_STATUS' feature is disabled; see the documentation for 'show_compatibility_56'

GLOBAL_STATUSSESSION_STATUS表提供有关服务器状态变量的信息。 它们的内容对应于SHOW GLOBAL STATUSSHOW SESSION STATUS语句产生的信息(参见“SHOW STATUS语法”)。

INFORMATION_SCHEMA Name SHOW Name Remarks
VARIABLE_NAME Variable_name
VARIABLE_VALUE Value

每个表的VARIABLE_VALUE列定义为VARCHAR(1024)。

mysql> select * from performance_schema.global_variables LIMIT 1;
+--------------------------+----------------+
| VARIABLE_NAME            | VARIABLE_VALUE |
+--------------------------+----------------+
| auto_increment_increment | 1              |
+--------------------------+----------------+
1 row in set (0.00 sec)


mysql> select * from performance_schema.session_variables limit 2;
+--------------------------+----------------+
| VARIABLE_NAME            | VARIABLE_VALUE |
+--------------------------+----------------+
| auto_increment_increment | 1              |
| auto_increment_offset    | 1              |
+--------------------------+----------------+
2 rows in set (0.00 sec)



mysql> show global status like 'Innodb_data_written';
+---------------------+---------+
| Variable_name       | Value   |
+---------------------+---------+
| Innodb_data_written | 1968128 |
+---------------------+---------+
1 row in set (0.01 sec)


mysql> show status like 'Innodb_data_written';
+---------------------+---------+
| Variable_name       | Value   |
+---------------------+---------+
| Innodb_data_written | 1968128 |
+---------------------+---------+
1 row in set (0.00 sec)
posted @ 2018-08-18 22:12  DB-Engineer  阅读(277)  评论(0编辑  收藏  举报