

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 開啟和關閉 Amazon RDS 的 Performance Insights
<a name="USER_PerfInsights.Enabling"></a>

**重要**  
 AWS 已宣布績效詳情的end-of-life：2026 年 6 月 30 日。在此日期之後，Amazon RDS 將不再支援 Performance Insights 主控台體驗、彈性保留期間 (1-24 個月) 及其相關定價。Performance Insights API 將繼續存在，不會有任何定價變更。Performance Insights API 的成本會顯示在您的 AWS 帳單中，其中包含 CloudWatch Database Insights 的成本。  
 我們建議您在 2026 年 6 月 30 日之前，使用已付費的績效詳情方案，將任何資料庫執行個體升級至資料庫詳情的進階模式。如需有關升級至 Database Insights 進階模式的資訊，請參閱 [開啟適用於 Amazon RDS 的 Database Insights 的進階模式](USER_DatabaseInsights.TurningOnAdvanced.md)。  
 如果您不採取任何動作，則使用 Performance Insights 的資料庫執行個體依預設會使用 Database Insights 的標準模式。使用 Database Insights 的標準模式時，您可能會失去超過 7 天的效能資料歷史記錄存取權，而且可能無法在 Amazon RDS 主控台中使用執行計畫和隨需分析功能。2026 年 6 月 30 日之後，只有進階模式的 Database Insights 將支援執行計畫和隨需分析。  
 透過 CloudWatch Database Insights，您可以監控資料庫機群的資料庫負載，以及大規模分析效能和進行疑難排解。如需 Database Insights 的詳細資訊，請參閱 [使用 CloudWatch Database Insights 監控 Amazon RDS 資料庫](USER_DatabaseInsights.md)。如需定價資訊，請參閱 [Amazon CloudWatch 定價](https://aws.amazon.com/cloudwatch/pricing/)。

您可在建立資料庫執行個體或多可用區域資料庫叢集時為其開啟 Performance Insights。如有需要，您可以稍後從主控台修改資料庫執行個體來將其關閉。開啟和關閉績效詳情不會造成停機、重新開機或容錯移轉。

**注意**  
效能結構描述為 Amazon RDS for MariaDB 或 MySQL 使用的選用效能工具。若您開啟或關閉「效能架構」，則需要重新開機。然而，如果您開啟或關閉績效詳情，則無需重新開機。如需詳細資訊，請參閱[Amazon RDS for MariaDB 或 MySQL 上 Performance Insights 的效能結構描述概觀](USER_PerfInsights.EnableMySQL.md)。

績效詳情代理程式會耗用資料庫主機上有限的 CPU 和記憶體。當資料庫負載過高時，代理程式會減少收集資料的頻率來限制效能影響。

------
#### [ Console ]

在主控台中，您可以在建立或修改資料庫執行個體時或多可用區域資料庫叢集時啟用或關閉 Performance Insights。

**在建立資料庫執行個體或多可用區域資料庫叢集時，開啟或關閉 Performance Insights**

建立新的資料庫執行個體或多可用區域資料庫叢集之後，Amazon RDS 預設會啟用 Performance Insights。若要關閉的 Performance Insights，請選擇**Database Insights – 標準**選項，然後取消選取**啟用 Performance Insights** 選項。

如需詳細資訊，請參閱下列主題。
+ 若要建立資料庫執行個體，請遵循 [建立 Amazon RDS 資料庫執行個體](USER_CreateDBInstance.md) 中關於資料庫引擎的指示。
+ 若要建立多可用區域資料庫叢集，請遵循 [為 Amazon RDS 建立多可用區域資料庫叢集](create-multi-az-db-cluster.md) 中的資料庫引擎指示。

下列螢幕擷取畫面顯示 **Performance Insights (績效詳情)** 區段。

![\[在使用主控台建立資料庫執行個體或多可用區域資料庫叢集期間啟用 Performance Insights\]](http://docs.aws.amazon.com/zh_tw/AmazonRDS/latest/UserGuide/images/perf_insights_enabling.png)


若您選擇 **Enable Performance Insights (啟用績效詳情)**，會有下列選項：
+ **保留** (僅適用於 Database Insights 的標準模式) – 保留 Performance Insights 資料的時間長度。保留設定為**預設值 (7 天)**。若要更長時間保留績效資料，請指定 1 - 24 個月。如需保留期間的詳細資訊，請參閱 [Performance Insights 的定價和資料保留](USER_PerfInsights.Overview.cost.md)。
+ **AWS KMS key** – 指定您的 AWS KMS key。績效詳情使用您的 KMS 金鑰來加密所有可能的敏感資料。將會對傳輸中與靜態資料進行加密。如需詳細資訊，請參閱[變更績效詳情 AWS KMS 的政策](USER_PerfInsights.access-control.cmk-policy.md)。

**在修改資料庫執行個體或多可用區域資料庫叢集時，開啟或關閉 Performance Insights**

在主控台中，您可以修改資料庫執行個體或多可用區域資料庫叢集，以管理 Performance Insights。

**使用主控台為資料庫執行個體或多可用區域資料庫叢集管理 Performance Insights**

1. 登入 AWS 管理主控台 ，並在 https：//[https://console.aws.amazon.com/rds/](https://console.aws.amazon.com/rds/) 開啟 Amazon RDS 主控台。

1. 選擇 **Databases** (資料庫)。

1. 選擇資料庫執行個體或多可用區域資料庫叢集，然後選擇**修改**。

1. 若要開啟 Performance Insights，請選取**啟用 Performance Insights**。若要關閉的 Performance Insights，請選擇**Database Insights – 標準**選項，然後取消選取**啟用 Performance Insights** 選項。

   若您選擇 **Enable Performance Insights (啟用績效詳情)**，會有下列選項：
   + **保留** (僅適用於 Database Insights 的標準模式) – 保留 Performance Insights 資料的時間長度。保留設定為**預設值 (7 天)**。若要更長時間保留績效資料，請指定 1 - 24 個月。如需保留期間的詳細資訊，請參閱 [Performance Insights 的定價和資料保留](USER_PerfInsights.Overview.cost.md)。
   + **AWS KMS key** – 指定您的 KMS 金鑰。績效詳情使用您的 KMS 金鑰來加密所有可能的敏感資料。將會對傳輸中與靜態資料進行加密。如需詳細資訊，請參閱[加密 Amazon RDS 資源](Overview.Encryption.md)。

1. 選擇 **Continue** (繼續)。

1. 在 **Scheduling of Modifications** (修改排程) 中，選擇 Apply immediately (立即套用)。如果您選擇 Apply during the next scheduled maintenance window (在下一個排定的維護時段套用)，則執行個體會忽略此設定，並立即開啟 Performance Insights。

1. 選擇 **Modify instance (修改執行個體)**。

------
#### [ AWS CLI ]

當您使用 [create-db-instance](https://docs.aws.amazon.com/cli/latest/reference/rds/create-db-instance.html) AWS CLI 命令時，請指定 `--enable-performance-insights`並`--database-insights-mode`設定為 `advanced`或 以開啟績效詳情`standard`。若要關閉 Performance Insights，請指定 `--no-enable-performance-insights` 並將 `database-insights-mode` 設定為 `standard`。

您也可以使用下列 AWS CLI 命令來指定這些值：
+  [create-db-cluster](https://docs.aws.amazon.com/cli/latest/reference/rds/create-db-cluster.html) 
+  [modify-db-cluster](https://docs.aws.amazon.com/cli/latest/reference/rds/modify-db-cluster.html) 
+  [create-db-instance-read-replica](https://docs.aws.amazon.com/cli/latest/reference/rds/create-db-instance-read-replica.html) 
+  [modify-db-instance](https://docs.aws.amazon.com/cli/latest/reference/rds/modify-db-instance.html) 
+  [restore-db-instance-from-s3](https://docs.aws.amazon.com/cli/latest/reference/rds/restore-db-instance-from-s3.html) 

當您開啟績效詳情時，可選擇使用 `--performance-insights-retention-period` 選項指定保留績效詳情資料的天數。您可指定為 `7`、*月* \$1 31 (其中*月*是指 1 - 23) 的數字，或 `731`。例如，如果您想要保留效能資料 3 個月，請指定 `93`，也就是 3 個 \$1 31。預設值是 `7` 天。如需保留期間的詳細資訊，請參閱 [Performance Insights 的定價和資料保留](USER_PerfInsights.Overview.cost.md)。

下列範例會開啟 `sample-db-cluster` 的 Performance Insights，並指定 Performance Insights 資料保留 93 天 (3 個月)。

針對 Linux、macOS 或 Unix：

```
aws rds modify-db-cluster \
	--database-insights-mode standard \
    --db-cluster-identifier sample-db-instance \
    --enable-performance-insights \
    --performance-insights-retention-period 93
```

在 Windows 中：

```
aws rds modify-db-cluster ^
	--database-insights-mode standard ^
    --db-cluster-identifier sample-db-instance ^
    --enable-performance-insights ^
    --performance-insights-retention-period 93
```

如果您指定保留期間 (例如 94 天)，這不是有效值，RDS 就會發出錯誤。

```
An error occurred (InvalidParameterValue) when calling the CreateDBInstance operation: 
Invalid Performance Insights retention period. Valid values are: [7, 31, 62, 93, 124, 155, 186, 217, 
248, 279, 310, 341, 372, 403, 434, 465, 496, 527, 558, 589, 620, 651, 682, 713, 731]
```

**注意**  
您只能在 Performance Insights 不在叢集層級進行管理的資料庫叢集中，切換執行個體的 Performance Insights。

------
#### [ RDS API ]

當您使用 [CreateDBInstance](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBInstance.html) 作業 Amazon RDS API 作業來建立新的資料庫執行個體時，請將 `EnablePerformanceInsights` 設為 `True` 以開啟績效詳情。若要關閉 Performance Insights，請將 `EnablePerformanceInsights` 設定為 `False`，以及將 `DatabaseInsightsMode` 設定為 `standard`。

您也可以使用下列 API 操作來指定 `EnablePerformanceInsights` 值：
+  [CreateDBCluster](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBCluster.html) (多可用區域資料庫叢集) 
+  [ModifyDBCluster](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_ModifyDBCluster.html) (多可用區域資料庫叢集) 
+  [ModifyDBInstance](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_ModifyDBInstance.html) 
+  [CreateDBInstanceReadReplica](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBInstanceReadReplica.html) 
+  [RestoreDBInstanceFromS3](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_RestoreDBInstanceFromS3.html) 

當您開啟 Performance Insights 時，可以使用 `PerformanceInsightsRetentionPeriod` 參數來選擇保留 Performance Insights 資料的時間 (以天數為單位)。您可指定為 `7`、*月* \$1 31 (其中*月*是指 1 - 23) 的數字，或 `731`。例如，如果您想要保留效能資料 3 個月，請指定 `93`，也就是 3 個 \$1 31。預設值是 `7` 天。如需保留期間的詳細資訊，請參閱 [Performance Insights 的定價和資料保留](USER_PerfInsights.Overview.cost.md)。

------