AWS RDS for MySQL 基本维护
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了AWS RDS for MySQL 基本维护相关的知识,希望对你有一定的参考价值。
1、AWS查询慢日志
select count(1) ,user_host from mysql.slow_log group by user_host;
select count(*) from mysql.slow_log ;
mysql> desc mysql.slow_log ;
+----------------+---------------------+------+-----+-------------------+-----------------------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+---------------------+------+-----+-------------------+-----------------------------+
| start_time | timestamp | NO | | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
| user_host | mediumtext | NO | | NULL | |
| query_time | time | NO | | NULL | |
| lock_time | time | NO | | NULL | |
| rows_sent | int(11) | NO | | NULL | |
| rows_examined | int(11) | NO | | NULL | |
| db | varchar(512) | NO | | NULL | |
| last_insert_id | int(11) | NO | | NULL | |
| insert_id | int(11) | NO | | NULL | |
| server_id | int(10) unsigned | NO | | NULL | |
| sql_text | mediumtext | NO | | NULL | |
| thread_id | bigint(21) unsigned | NO | | NULL | |
+----------------+---------------------+------+-----+-------------------+-----------------------------+
mysql> select query_time,sql_text from mysql.slow_log order by query_time desc limit 30; -- 慢查询安装时间排序
mysql> select query_time,sql_text from mysql.slow_log where query_time >'00:00:10'; --查询大于10s的慢查询
以上是关于AWS RDS for MySQL 基本维护的主要内容,如果未能解决你的问题,请参考以下文章
使用 for_each 的多个 aws_rds_cluster_instance