はじめに
- Performance Insightsで以下のエラーが発生したので、自動管理する必要がありました。
Performance Insights is unable to collect SQL Digest statistics on new queries because the table events_statements_summary_by_digest is full.
Please truncate events_statements_summary_by_digest table to clear the issue. Check the User Guide for more details.
AWS公式ドキュメント
- AWS公式ドキュメントをみると、対応策が書いてあります。
自動管理の場合、performance_schema パラメータを 0 に設定する必要があります。
けど、このパラメータを 0
っていうのが曲者です。
ダメな設定
resource "aws_db_parameter_group" "default" {
name = "sample"
family = "mysql8"
parameter {
name = "performance_schema"
value = "0" # 明示的に0にしてしまっている。
}
}
正しい設定
resource "aws_db_parameter_group" "default" {
name = "sample"
family = "mysql8"
# performance_schemaの設定をしないっていうのが正解です。要はデフォルト値にしろってことです。
}
確認
- AWS CLIで確認して、
Source: system
になっていることを確認できました。
$aws rds describe-db-parameters \
--profile xorder_stg \
--db-parameter-group-name xorder-aurora-mysql8 \
--query "Parameters[?ParameterName=='performance_schema']"
[
{
"ParameterName": "performance_schema",
"ParameterValue": "0",
"Description": "Enables or disables the Performance Schema",
"Source": "system",
"ApplyType": "static",
"DataType": "boolean",
"AllowedValues": "0,1",
"IsModifiable": true,
"ApplyMethod": "pending-reboot"
}
]