0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

AuroraMySQLでPerformance Insightsを自動管理したい

Posted at

はじめに

  • 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"
    }
]
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?