

# Viewing the Database Instance Dashboard for CloudWatch Database Insights
Viewing the Database Instance Dashboard

Use the Database Instance Dashboard to view a snapshot of the health of a DB instance.

To analyze lock trees and execution plans for Amazon Aurora PostgreSQL, see the following topics.

**Topics**
+ [Analyzing lock trees for Amazon Aurora PostgreSQL and Amazon RDS for PostgreSQL with CloudWatch Database Insights](Database-Insights-Lock-Analysis.md)
+ [Analyzing execution plans with CloudWatch Database Insights](Database-Insights-Execution-Plans.md)

## Database load chart
Database load chart

*Database load (DB Load)* measures the level of session activity in your database. DB Load is the key metric in Database Insights, and Database Insights collects DB Load every second.

![\[Database Instance Dashboard\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbi_did.png)


For more information about DB Load, see [Database load](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.Overview.ActiveSessions.html) in the *Amazon RDS User Guide* or [Database load](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_PerfInsights.Overview.ActiveSessions.html) in the *Amazon Aurora User Guide*.

Use the **Database load** chart to view DB Load sliced (grouped) by the following dimensions for all supported database engines.
+ Blocking object (only for [database engines that support locking analysis](Database-Insights-Lock-Analysis.md))
+ Blocking session (only for [database engines that support locking analysis](Database-Insights-Lock-Analysis.md))
+ Blocking SQL (only for [database engines that support locking analysis](Database-Insights-Lock-Analysis.md))
+ Database
+ Host
+ SQL
+ User
+ Waits
+ Application (only for Amazon Aurora PostgreSQL)
+ Plans (only for [database engines that support execution plan capture](Database-Insights-Execution-Plans.md))
+ Session type (only for Amazon Aurora PostgreSQL)

**Note**  
For information about analyzing Oracle PDB load in Amazon RDS, see [Analyzing top Oracle PDB load](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.UsingDashboard.AnalyzeDBLoad.TopPDB.html) in the *Amazon RDS User Guide*.

![\[DB Load in the Database Instance Dashboard\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbi_did-dbload.png)


By default, CloudWatch displays DB Load with a bar chart. Choose **Line** to display DB Load with a stacked line chart.

![\[Line graph for DB Load in the Database Instance Dashboard\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbi_did-dbload-line.png)


## DB Load analysis tab
DB Load analysis tab

Use the **DB Load analysis** tab to monitor the top contributors to DB Load for each of the following dimensions.
+ Database
+ Host
+ SQL
+ User
+ Waits
+ Lock analysis (only for [database engines that support locking analysis](Database-Insights-Lock-Analysis.md))
+ Application (only for Amazon Aurora PostgreSQL)
+ Session type (only for Amazon Aurora PostgreSQL)

![\[Dashboard showing the DB load analysis tab\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbi_lat.png)


## Analyze statistics for a query
Analyze statistics for a query

You might want to analyze statistics for a query with a high DB Load. To analyze statistics for a query, use the following procedure.

**To analyze statistics for queries**

1. Sign in to the AWS Management Console and open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. Choose **Insights**.

1. Choose **Database Insights**.

1. Choose the **Database Instance** view.

1. Choose a DB instance.

1. Choose the **Top SQL** tab.

1. To view statistics for a query, choose a query.  
![\[The table displayed in the Top SQL tab.\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/DBInsights_LoadTopSQL.png)

## Database telemetry tab
Database telemetry tab

Use the **Database telemetry** tab to view metrics, logs, events, and slow queries for the selected instance.

### Metrics section for database telemetry
Metrics section for database telemetry

The **Metrics** section displays a default metrics dashboard customized for each engine type.

You can customize this dashboard by adding OS metrics, database counter metrics, and CloudWatch metrics to it. You can also remove metrics from the dashboard. You can customize one dashboard for each engine type in a Region in your account. This means that all instances for a specific engine type in that Region in the same account will have the same metrics dashboard.

Users who have edit permissions for your dashboards in your account can edit any dashboard for any engine.

Changes you make to a dashboard are saved automatically, and apply to every instance of the database engine in that Region and account.

![\[Dashboard showing examples of the different types of database metrics.\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbi_dbmetrics.png)


**To customize the dashboard in the Database telemetry tab for an engine type**

1. Sign in to the AWS Management Console and open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. Choose **Insights**, **Database Insights**.

1. For **Database Views**, choose **Database Instance**.

1. In the **Filters** section, find and choose the database instance that you want to view metrics for. 

1. Choose the **Database Telemetry** tab, then choose the **Metrics** tab.

   The default database instance dashboard appears. 

1. To add a widget to the dashboard, do the following:

   1. Choose **Add Create widget**.

   1. In the **Create widget** popup, find the metric or metrics that you want to add, and select the checkbox for each one. If you select multiple metrics in this step, they will all appear in the same new widget on the dashboard. Then choose **Create widget**.

      Remember that any changes you make to this dashboard will apply to all Database Insights dashboards for this engine type in this Region in the account.

1. To delete a graph from the dashboard, choose the vertical ellipsis in the widget, then choose **Delete**.

1. To add more metrics to an existing widget in the dashboard, or change its title, choose the vertical ellipsis in the widget, and choose **Edit**. Then in the **Update widget** popup, find the metric or metrics that you want to add, select their checkboxes, and choose **Update Widget**. You can also change the widget title.

1. After customizing a dashboard, you can reset it to its original default state by choosing **Reset Dashboard**.

### Logs section for database telemetry
Logs section for database telemetry

The **Logs** section provides a view of database logs exported to CloudWatch Logs for the selected DB instance. 

![\[Database telemetry in the Database Instance Dashboard\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbi_did-telemetry-logs.png)


For information about publishing logs to CloudWatch Logs for Amazon RDS, see [Publishing database logs to Amazon CloudWatch Logs](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_LogAccess.Procedural.UploadtoCloudWatch.html) in the *Amazon RDS User Guide*. For information about publishing logs to CloudWatch Logs for Amazon Aurora, see [Publishing database logs to Amazon CloudWatch Logs](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_LogAccess.Procedural.UploadtoCloudWatch.html) in the *Amazon Aurora User Guide*.

For Aurora PostgreSQL Limitless Databases, logs are automatically published to CloudWatch Logs and are discoverable in the Database Insights console.

### OS processes data for database telemetry


You can use the **OS Processes** tab within the **Database telemetry** tab to view metrics for the operating system (OS) that your DB instance runs on. The metrics provide a snapshot of OS processes running on your databases for a given timestamp, as well as key metrics such as memory and CPU utilization for each running process. Database Insights correlates these metrics with the metrics in your database load chart, so if you choose a data point in the database load chart, the OS processes data is updated to display telemetry from the same time stamp.

When you choose a data point, Database Insights automatically select the period to display, depending on the time range you have chosen for the overall page. The farthest back that you can go depends on the retention time that you have configured for the `RDSOSMetrics` log group.

If you haven't chosen a time stamp, by default the table is populated with telemetry for the latest timestamp.

**Note**  
OS process information is available only if you have [Amazon RDS Enhanced Monitoring](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_PerfInsights_Counters.html) enabled. Enhanced Monitoring incurs additional charges. For more information, see [Cost of Enhanced Monitoring](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_Monitoring.OS.html#USER_Monitoring.OS.cost). Enhanced Monitoring is automatically enabled for Aurora PostgreSQL Limitless Databases.

![\[Events table\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbinsights-osprocesses.png)


In the **OS processes** view, the following data is displayed for each process:
+ **Process ID** –The ID of this process.
+ **Virtual memory** –The amount of virtual memory allocated to the process, in Kibibytes.
+ **Residual address** – The actual physical memory being used by the process.
+ **CPU %** – The percentage of the total CPU bandwidth being used by the process.
+ **Memory %** – The percentage of the total memory being used by the process.
+ **VM limit** – The maximum amount of virtual memory that can be allocated to the process.

  If the value in this column is 0, then VM limits are not applicable to that process.

The monitoring data that is displayed is retrieved from Amazon CloudWatch Logs. You can also retrieve these metrics directly from the log stream in CloudWatch Logs. For more information, see [Viewing OS metrics using CloudWatch Logs](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Monitoring.OS.CloudWatchLogs.html).

OS processes metrics are not returned during the following: 
+ A failover of the database instance.
+ Changing the instance class of the database instance (scale compute).

OS processes metrics are returned during a reboot of a database instance because only the database engine is rebooted. Metrics for the operating system are still reported.

### Slow SQL Queries section for database telemetry
Slow SQL Queries section for database telemetry

To view slow SQL queries and query patterns, you must enable log exports to CloudWatch Logs and configure DB parameters for your database. 

For information about publishing Amazon RDS logs to CloudWatch Logs, see [Publishing database logs to Amazon CloudWatch Logs](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_LogAccess.Procedural.UploadtoCloudWatch.html) in the *Amazon RDS User Guide*.

For information about publishing Aurora logs to CloudWatch Logs, see [Publishing database logs to Amazon CloudWatch Logs](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_LogAccess.Procedural.UploadtoCloudWatch.html) in the *Amazon Aurora User Guide*.

For information about configuring DB parameters for your database in Amazon RDS, see [Configuring your database to monitor slow SQL queries with Database Insights for Amazon RDS](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_DatabaseInsights.SlowSQL.html) in the *Amazon RDS User Guide*.

For information about configuring DB parameters for your database in Amazon Aurora, see [Configuring your database to monitor slow SQL queries with Database Insights for Amazon Aurora](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_DatabaseInsights.SlowSQL.html) in the *Amazon Aurora User Guide*.

The **Slow SQL Queries** section provides a list of slow query patterns sorted by frequency. By selecting a pattern, you can view a list of slow queries that match the selected pattern. You can use the slow query list to identify slow queries affecting your DB instance. 

Database Insights displays statistics for slow queries. The statistics represent only queries that exceed the configured slow query duration threshold.

![\[Displays details about an example of a slow SQL query\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbi_slowsql.png)


**Important**  
Slow queries may contain sensitive data. Mask your sensitive data with CloudWatch Logs. For more information about masking log data, see [Help protect sensitive log data with masking](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/mask-sensitive-log-data.html) in the *Amazon CloudWatch Logs User Guide*.

### Events table
Events table

Use the **Events** table to view RDS events for your DB instance. For a list of events for Amazon Aurora, see [Amazon RDS event categories and event messages for Aurora](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_Events.Messages.html) in the *Amazon Aurora User Guide*. For a list of events for Amazon Relational Database Service, see [Amazon RDS event categories and event messages for Aurora](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_Events.Messages.html) in the *Amazon RDS User Guide*.

![\[Events table\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbi_did-events.png)


## Calling services tab
Calling services tab

Database Insights shows the services and operations that are calling your instance. Database Insights integrates with CloudWatch Application Signals to provide metrics for each service and operation, including availability, latency, errors, and volume.

When the endpoint called by the application is an Aurora cluster, Database Insights will show either the writer or the reader endpoint for the Aurora cluster in the **Calling services** table, not the individual database instance. However, when the endpoint called by the application is an Amazon RDS cluster, Database Insights shows the specific database instance the application is calling within the Amazon RDS cluster."

![\[Calling services tab\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbi_did-calling.png)


## Analyze database performance on demand with CloudWatch Database Insights
Analyze database performance on demand

Analyze database performance with on-demand analyses for your Amazon RDS databases with CloudWatch Database Insights.

You can run on-demand performance analysis by selecting **Analyze Performance** on the top right corner of the **Database load ** chart. The report will run for the selected time period. Use the **Performance analysis** tab to view performance analysis reports for databases in your fleet.

![\[Performance Analysis tab\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbi_dl-perfanalysis.png)


For information about performance analysis reports for Amazon Aurora, see [Analyzing database performance for a period of time](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_PerfInsights.UsingDashboard.AnalyzePerformanceTimePeriod.html) in the *Amazon Aurora User Guide*.

## Integrating CloudWatch Database Insights with CloudWatch Application Signals
Integrating with Application Signals

Integrate CloudWatch Database Insights with CloudWatch Application Signals.

Use the **Calling services** tab to view the CloudWatch Application Signals services and operations that called an endpoint of the selected instance. By default, CloudWatch sorts the table by fault rate. Choose values in the **Services**, **Operations**, or **Endpoint address** columns to view the corresponding resource in the CloudWatch Application Signals console.

For more information about supported systems for CloudWatch Application Signals, see [Supported systems](CloudWatch-Application-Signals-supportmatrix.md).

# Analyzing lock trees for Amazon Aurora PostgreSQL and Amazon RDS for PostgreSQL with CloudWatch Database Insights
Analyzing lock trees

To troubleshoot performance issues caused by locks, you can analyze lock trees for Amazon Aurora PostgreSQL and Amazon RDS for PostgreSQL databases with CloudWatch Database Insights using the following.
+ **Sliced by** dropdown – Choose the **Blocking object**, **Blocking session**, or **Blocking SQL** dimensions in the **Database load** chart to view how distinct top blockers contribute to DB Load over time. With the DB load chart, you can analyze if top blockers are constant or change often. Then, you can troubleshoot the blockers.  
![\[The Top SQL table with Blocking Session selected in the Sliced by dropdown\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/DBInsights_TopSQLBlocking.png)
+ **Lock analysis** tab – Choose **DB Load Analysis**, then choose the **Lock analysis** tab to view information about lock contention in your database.  
![\[The Lock trees table in the Database load dashboard\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/DBInsights_LoadLockAnalysis.png)

**Note**  
CloudWatch Database Insights supports lock analysis for all Aurora PostgreSQL versions. To analyze lock trees, you must have Database Insights Advance Mode enabled. For information on how to turn on Advanced mode, see [Turning on the Advanced mode of Database Insights for Amazon Aurora](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_DatabaseInsights.TurningOnAdvanced.html) and [Turning on the Advanced mode of Database Insights for Amazon Relational Database Service](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_DatabaseInsights.TurningOnAdvanced.html)

The lock analysis tab provides information about lock contention for your database. The lock tree visualization shows the relationships and dependencies between lock requests from different sessions.

Database Insights captures snapshots every 15 seconds. Snapshots show the lock data for your database at a point in time.

**Note**  
When CloudWatch detects high locking, CloudWatch displays the **High locking detected** banner for the **Lock analysis** tab. CloudWatch detects high locking if CloudWatch takes a lock snapshot for each 15 second interval for 15 consecutive minutes.

Each node in the tree represents a specific session. The parent node is a session that is blocking its child nodes.

To analyze lock trees, use the following procedure.

**To analyze lock trees**

1. Sign in to the AWS Management Console and open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. Choose **Insights**.

1. Choose **Database Insights**.

1. Choose the **Database Instance** view.

1. Choose a DB instance.

1. Choose the **DB load analysis** tab.

1. Choose the **Lock analysis** tab.

   To view lock data for a DB instance, choose a period of 1 day or less.

1. Choose a snapshot window. By default, Database Insights chooses the snapshot window with the most blocked sessions.  
![\[Lock analysis table\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbi_lock-analysis.png)

1. To view lock data for a snapshot, choose the time Database Insights took the snapshot.

1. To expand a lock tree, choose the arrow next to the session ID.  
![\[Lock tree expanded\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbi_lock-analysis-expand.png)

## Lock snapshot data
Lock snapshot data

Database Insights provides the following information for each lock request. To view columns that aren't enabled by default, choose the **Settings** icon for the **Lock trees** table and enable other columns.


| Column name | Definition  | Default column | Notes | 
| --- | --- | --- | --- | 
|  `session_id`  | The unique session identifier. |  Yes  | The `session_id` is derived from `HEX(pg_stat_activity.backend_start).HEX(pg_locks.pid)`. | 
|  `pid`  | The PID of this backend. |  Yes  | `pg_locks.pid` | 
|  `blocked_sessions_count`  | The number of sessions blocked by this lock. |  Yes  | The `blocked_sessions_count` is derived from the number of session IDs blocked by this lock. | 
|  `last_query_executed`  | The last query executed by this session. For blockers, it may not be the query that holds the blocking lock. |  Yes  | `pg_stat_activity.query` | 
|  `wait_event`  | The wait event name if the backend is currently waiting, otherwise the value is NULL. |  Yes  | `pg_stat_activity.wait_event` | 
|  `blocking_time_(In Seconds)`  | The time (in seconds) since the start of this lock. |  Yes  | The `blocking_time_(In Seconds)` is derived from the start time of the waiting transaction (`pg_locks.waitstart`) for the first waiter. | 
|  `blocking_mode`  | The lock mode held by the blocking session. |  No  | `pg_locks.mode` | 
|  `waiting_mode`  | The lock mode requested by the waiting session. |  No  | `pg_locks.mode` | 
|  `application`  | The name of the application that is connected to this backend. |  No  | `pg_stat_activity.application_name` | 
|  `blocking_txn_start_time`  | The start time of the blocking transaction or null if no transaction is active. |  No  | `pg_stat_activity.xact_start` | 
|  `waiting_start_time`  | The time when a waiting user session started waiting for this lock, or null if the lock is held. |  No  | `pg_locks.waitstart` | 
|  `session_start_time`  | The time when a user session was started. |  No  | `pg_stat_activity.backend_start` | 
|  `state`  | The state of a backend.  |  No  | `pg_stat_activity.state` | 
|  `wait_event_type`  | The type of wait event for which this session is waiting. |  No  | `pg_stat_activity.wait_event_type` | 
|  `last_query_exec_time`  | The time when the last query was started. |  No  | `pg_stat_activity.query_start` | 
|  `user`  | The name of the user logged into this backend. |  No  | `pg_stat_activity.usename` | 
|  `host`  | The host name of the connected client, as reported by a reverse DNS lookup of `client_addr`. This field will only be non-null for IP connections, and only when [log\$1hostname](https://www.postgresql.org/docs/current/runtime-config-logging.html#GUC-LOG-HOSTNAME) is enabled. |  No  | `pg_stat_activity.client_hostname` | 
|  `port`  | The TCP port number that the client is using for communication with this backend, or `-1` if a Unix socket is used. If this field is null, it indicates that this is an internal server process. |  No  | `pg_stat_activity.client_port` | 
|  `client_address`  | The IP address of the client connected to this backend. If this field is null, it indicates either that the client is connected via a Unix socket on the server machine or that this is an internal process such as autovacuum. |  No  | `pg_stat_activity.client_addr` | 
|  `granted`  | The value is true if lock is held and false if lock is awaited. |  No  | `pg_locks.granted` | 
|  `waiting_tuple`  |  The tuple number targeted by the lock within the page, or null if the target is not a tuple.  |  No  | `pg_locks.tuple` | 
|  `waiting_page`  | The page number targeted by the lock within the relation, or null if the target is not a relation page or tuple. |  No  | `pg_locks.page` | 
|  `waiting_transaction_id`  | The ID of the transaction targeted by the lock, or null if the target is not a transaction ID. |  No  | `pg_locks.transactionid` | 
|  `waiting_relation`  | The OID of the relation targeted by the lock, or null if the target is not a relation or part of a relation. |  No  | `pg_locks.relation` | 
|  `waiting_object_id`  | The OID of the lock target within its system catalog, or null if the target is not a general database object. |  No  | `pg_locks.objid` | 
|  `waiting_database_id`  | The OID of the database in which the lock target exists, or zero if the target is a shared object, or null if the target is a transaction ID. |  No  | `pg_locks.database` | 
|  `waiting_database_name`  | The name of the database in which the lock target exists. |  No  | `pg_stat_activity.datname` | 
|  `waiting_locktype`  | The type of the lockable object: relation, extend, frozenid, page, tuple, transactionid, virtualxid, spectoken, object, userlock, advisory, or applytransaction. |  No  | `pg_locks.locktype` | 
|  `is_fastpath`  | The value is true if the lock was taken with the fast path and false if taken from the main lock table. |  No  | `pg_locks.fastpath` | 

For more information about the values in the `pg_stat_activity` and `pg_locks` views, see the following topics in the PostgreSQL documentation.
+ [pg\$1locks](https://www.postgresql.org/docs/current/view-pg-locks.html)
+ [pg\$1stat\$1activity](https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-ACTIVITY-VIEW)

# Analyzing execution plans with CloudWatch Database Insights
Analyzing execution plans

You can analyze execution plans for the Amazon Aurora PostgreSQL, RDS for Microsoft SQL Server and RDS for Oracle databases by using the following methods.
+ **Sliced by** dropdown – Choose the **Plans** dimension in the **Database load** chart to view how different plans contribute to DB Load over time.
+ **Top SQL** tab – Choose **DB Load Analysis**, then choose the **Top SQL** tab to view the number of plans for each digest query.

  To analyze execution plans for a digest query, choose the query and then choose the **Plans** tab. For more information, see the following procedure.

## Prerequisites
Prerequisites

To analyze execution plans, you must be using the Advanced mode of Database Insights. For information on how to turn on Advanced mode, see [Turning on the Advanced mode of Database Insights for Amazon Aurora](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_DatabaseInsights.TurningOnAdvanced.html) and [Turning on the Advanced mode of Database Insights for Amazon Relational Database Service](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_DatabaseInsights.TurningOnAdvanced.html).

If you are using Aurora PostgreSQL, you also have the following prerequisites:
+ Your DB instance must use Aurora PostgreSQL version 14.10, 15.5, or later. For information about upgrading your Aurora PostgreSQL DB cluster, see [Upgrading Amazon Aurora PostgreSQL DB clusters](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_UpgradeDBInstance.PostgreSQL.html) in the *Amazon Aurora User Guide*.
+ You must configure your DB cluster to analyze execution plans by setting the parameter `aurora_compute_plan_id` to `on` with one of the following options.
  + [Creating a DB cluster parameter group in Amazon Aurora](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_WorkingWithParamGroups.CreatingCluster.html) in the *Amazon Aurora User Guide*
  + [Modifying parameters in a DB cluster parameter group in Amazon Aurora](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_WorkingWithParamGroups.ModifyingCluster.html) in the *Amazon Aurora User Guide*

## Analyze execution plans
Analyze execution plans

To analyze execution plans, use the following procedure.

**To analyze execution plans**

1. Sign in to the AWS Management Console and open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. Choose **Insights**.

1. Choose **Database Insights**.

1. Choose the **Database Instance** view.

1. Choose a DB instance.

1. Choose the **Top SQL** tab. The **Plans Count** column shows the number of plans collected for each digest query.

1. (Optional) If the **Plans Count** column doesn't appear, choose the **Settings** icon on the **Top SQL** table to customize the visibility and order of columns.  
![\[Settings for the plan details table\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/DBInsights2.png)

1. Choose a digest query to expand it into its component statements.  
![\[Expand a query into its component statements\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbi_did-dbload-expand.png)

1. Scroll down and view the SQL text. Then, choose the **Plans** tab.

   By default, CloudWatch displays the estimated execution plan. For Aurora PostgreSQL, to view actual execution plans, enable the `aurora_stat_plans.with_analyze` parameter for your DB instance. For more information about the parameter `aurora_stat_plans.with_analyze`, see [Monitoring query execution plans and peak memory for Aurora PostgreSQL](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.Monitoring.Query.Plans.html#aurora.with_analyze) in the *Amazon Aurora User Guide*.

1. To compare plans from the same digest query, choose two **Plans** from the **Plans for digest query** list.

   You can view either one or two plans for a query at a time. In the following example screenshot, both plans are for Aurora PostgreSQL.   
![\[Compare plans\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbi_did-plans.png)

1. You can also view how each plan contributes to DBLoad over time by choosing **Plans** in the **Slice by** drop-down in the DBLoad chart.  
![\[Database load chart showing active sessions over time with plans contribution highlighted.\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/DBInsights_OverTime.png)