优化SQL语句的一般步骤①
2016-10-03 20:57
183 查看
1.通过show status命令了解各种sql执行的频率。
格式:mysql>show [session|global] status;
其中:session(默认)表示当前连接
global 表示自数据库启动至今
相关操作:
mysql>show status;
mysql>show global status;
mysql>show status like 'Com_%';
mysql>show global status like 'Com_%';
截图:展示数据库的各种状态
一般查看以Com_开头的
查看增删改查的总数
show global status like 'Com_insert';
show global status like 'Com_update';
show global status like 'Com_select';
show global status like 'Com_delete';
截图:
查看Innodb引擎表受影响的行数:
mysql> show global status like 'innodb_rows%';
+----------------------+-------+
| Variable_name | Value |
+----------------------+-------+
| Innodb_rows_deleted | 0 |
| Innodb_rows_inserted | 12 |
| Innodb_rows_read | 78 |
| Innodb_rows_updated | 0 |
+----------------------+-------+
4 rows in set (0.00 sec)
查看连接总次数
mysql> show global status like 'connections';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Connections | 2865 |
+---------------+-------+
1 row in set (0.00 sec)
服务器已经工作的秒数:
mysql> show global status like 'uptime';
+---------------+--------+
| Variable_name | Value |
+---------------+--------+
| Uptime | 515199 |
+---------------+--------+
1 row in set (0.00 sec)
查询慢查询的总次数:
mysql> show global status like 'slow_queries';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Slow_queries | 0 |
+---------------+-------+
1 row in set (0.00 sec)
格式:mysql>show [session|global] status;
其中:session(默认)表示当前连接
global 表示自数据库启动至今
相关操作:
mysql>show status;
mysql>show global status;
mysql>show status like 'Com_%';
mysql>show global status like 'Com_%';
截图:展示数据库的各种状态
一般查看以Com_开头的
查看增删改查的总数
show global status like 'Com_insert';
show global status like 'Com_update';
show global status like 'Com_select';
show global status like 'Com_delete';
截图:
查看Innodb引擎表受影响的行数:
mysql> show global status like 'innodb_rows%';
+----------------------+-------+
| Variable_name | Value |
+----------------------+-------+
| Innodb_rows_deleted | 0 |
| Innodb_rows_inserted | 12 |
| Innodb_rows_read | 78 |
| Innodb_rows_updated | 0 |
+----------------------+-------+
4 rows in set (0.00 sec)
查看连接总次数
mysql> show global status like 'connections';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Connections | 2865 |
+---------------+-------+
1 row in set (0.00 sec)
服务器已经工作的秒数:
mysql> show global status like 'uptime';
+---------------+--------+
| Variable_name | Value |
+---------------+--------+
| Uptime | 515199 |
+---------------+--------+
1 row in set (0.00 sec)
查询慢查询的总次数:
mysql> show global status like 'slow_queries';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Slow_queries | 0 |
+---------------+-------+
1 row in set (0.00 sec)
相关文章推荐
- sql语句优化的一般步骤详解
- 优化SQL语句的一般步骤
- Mysql优化SQL语句的一般步骤
- 优化SQL语句的一般步骤②
- 优化SQL语句一般的步骤
- 优化SQL语句的一般步骤
- mysql优化sql语句步骤
- 优化 sql 语句步骤
- Mysql下优化SQL的一般步骤
- 自己实现一个SQL解析引擎 功能:将用户输入的SQL语句序列转换为一个可执行的操作序列,并返回查询的结果集。 SQL的解析引擎包括查询编译与查询优化和查询的运行,主要包括3个步骤: 查询分析
- Mysql下优化SQL的一般步骤
- Mysql下优化SQL的一般步骤
- 优化SQL的一般步骤
- SQL语句优化的一般方法(一)
- Mysql下优化SQL的一般步骤
- Mysql优化SQL语句的步骤
- oralce数据库中的SQL语句的优化
- [ORACLE] SQL语句的优化方法
- ORACLE SQL语句优化技术分析