mysql 실행 주파수 보기

4430 단어 mysql
7.1 sql의 실행 빈도 보기
show 【session|global】 status;

실험1: 이번 로그인 이래의 데이터베이스 조작을 조회하고 주요 관심치 획득
mysql> show session status like 'Com_insert%';
+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| Com_insert        | 0     |
| Com_insert_select | 0     |
+-------------------+-------+
2 rows in set (0.00 sec)

mysql> show session status like 'Com_select%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Com_select    | 43    |
+---------------+-------+
1 row in set (0.00 sec)

mysql> show session status like 'Com_update%';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| Com_update       | 0     |
| Com_update_multi | 0     |
+------------------+-------+
2 rows in set (0.00 sec)

mysql> show session status like 'Com_delete%';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| Com_delete       | 4     |
| Com_delete_multi | 0     |
+------------------+-------+
2 rows in set (0.00 sec)

실험2: 데이터베이스 서비스가 시작된 이래의 데이터베이스 조작을 조회하고 주요 관심치의 획득
mysql> show global status like 'Com_delete%';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| Com_delete       | 7     |
| Com_delete_multi | 0     |
+------------------+-------+
2 rows in set (0.00 sec)

mysql> show global status like 'Com_insert%';
+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| Com_insert        | 8     |
| Com_insert_select | 7     |
+-------------------+-------+
2 rows in set (0.00 sec)

mysql> show global status like 'Com_update%';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| Com_update       | 0     |
| Com_update_multi | 0     |
+------------------+-------+
2 rows in set (0.00 sec)

mysql> show global status like 'Com_select%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Com_select    | 139   |
+---------------+-------+
1 row in set (0.00 sec)

실험3: 데이터베이스 innodb 엔진의 데이터베이스 조작을 조회하고 주요 관심치의 획득은 영향을 주는 행수이다
mysql> show session status like 'InnoDB_rows%';
+----------------------+-------+
| Variable_name        | Value |
+----------------------+-------+
| Innodb_rows_deleted  | 2     |
| Innodb_rows_inserted | 4     |
| Innodb_rows_read     | 27    |
| Innodb_rows_updated  | 0     |
+----------------------+-------+
4 rows in set (0.00 sec)

mysql> show global status like 'InnoDB_rows%';
+----------------------+-------+
| Variable_name        | Value |
+----------------------+-------+
| Innodb_rows_deleted  | 2     |
| Innodb_rows_inserted | 4     |
| Innodb_rows_read     | 27    |
| Innodb_rows_updated  | 0     |
+----------------------+-------+
4 rows in set (0.00 sec)

실험4: 데이터베이스를 보는 링크 횟수는 성공과 실패를 포함한다.
mysql> show global status like 'connections';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Connections   | 8     |
+---------------+-------+
1 row in set (0.00 sec)

mysql> show session status like 'connections';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Connections   | 8     |
+---------------+-------+
1 row in set (0.00 sec)

실험5: 데이터베이스 보기 작업 시간 초수
mysql> show session status like 'Uptime';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Uptime        | 25002 |
+---------------+-------+
1 row in set (0.00 sec)

mysql> show global status like 'Uptime';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Uptime        | 25014 |
+---------------+-------+
1 row in set (0.00 sec)

실험6: 데이터베이스 조회 횟수 보기
mysql> show global status like 'Slow_queries';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Slow_queries  | 0     |
+---------------+-------+
1 row in set (0.00 sec)

mysql> show session status like 'Slow_queries';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Slow_queries  | 0     |
+---------------+-------+
1 row in set (0.00 sec)

좋은 웹페이지 즐겨찾기