

# CloudWatch Database Insights
<a name="Database-Insights"></a>

Use CloudWatch Database Insights to monitor and troubleshoot Amazon Aurora MySQL, Amazon Aurora PostgreSQL, Amazon Aurora PostgreSQL Limitless, Amazon RDS for SQL Server, RDS for MySQL, RDS for PostgreSQL, RDS for Oracle, and RDS for MariaDB databases at scale.

With Database Insights, you can monitor your database fleet with pre-built, opinionated dashboards. To help you analyze the performance of your fleet, the Database Insights dashboards display curated metrics and visualizations, and you can customize these dashboards. By presenting metrics in a single dashboard for all databases in your fleet, Database Insights allows you to monitor your databases simultaneously.

For example, you can use Database Insights to find a database that is performing poorly within a fleet of hundreds of database instances. You can then choose that instance and use Database Insights to troubleshoot issues.

For information about engine, AWS Region, and instance class support, see [Aurora DB engine, Region, and instance class support for Database Insights](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_DatabaseInsights.Engines.html) and [Amazon RDS DB engine, Region, and instance class support for Database Insights](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_DatabaseInsights.Engines.html).

Database Insights supports monitoring workloads across multiple accounts and regions. To learn more about the cross-account cross-region monitoring feauture of Database Insights see [Set up cross-account cross-region monitoring for CloudWatch Database Insights ](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Database-Insights-Cross-Account-Cross-Region.html)

To get started with Database Insights, see the following topics.

**Topics**
+ [Get started with CloudWatch Database Insights](Database-Insights-Get-Started.md)
+ [Viewing the Fleet Health Dashboard for CloudWatch Database Insights](Database-Insights-Fleet-Health-Dashboard.md)
+ [Viewing the Database Instance Dashboard for CloudWatch Database Insights](Database-Insights-Database-Instance-Dashboard.md)
+ [Troubleshooting for CloudWatch Database Insights](Database-Insights-Troubleshooting.md)

## Modes for Database Insights
<a name="Database-Insights-modes"></a>

Database Insights has an Advanced mode and a Standard mode. Standard mode is the default for Database Insights, and you can turn on the Advanced mode for your database. 

The following table shows which features CloudWatch supports for the Advanced mode and Standard mode of Database Insights.


| Feature | Standard mode | Advanced mode | 
| --- | --- | --- | 
| Analyze the top contributors to DB Load by dimension | Supported | Supported | 
| Query, graph, and set alarms on database metrics with up to 7 days of retention | Supported | Supported | 
| Define fine‐grained access control policies to restrict access to potentially sensitive dimensions such as SQL text | Supported | Supported | 
| Analyze operating system processes happening in your databases with detailed metrics per running process [Amazon RDS Enhanced Monitoring](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_PerfInsights_Counters.html) is required for this feature to work. | Not supported | Supported | 
| Define and save fleet‐wide monitoring views to assess database health at scale | Not supported | Supported | 
| Analyze SQL locks with 15 months of retention and a guided UX | Not supported | Supported only for Aurora PostgreSQL | 
| Analyze SQL execution plans with 15 months of retention and guided UX | Not supported | Supported only for Aurora PostgreSQL, RDS for Oracle, and RDS for SQL Server | 
| Visualize per‐query statistics | Not supported | Supported | 
| Analyze slow SQL queriesExport of database logs to CloudWatch Logs is required for this feature to work. | Not supported | Supported | 
| View calling services with CloudWatch Application Signals | Not supported | Supported | 
| View a consolidated dashboard for all database telemetry, including metrics, logs, events, and applicationsExport of database logs to CloudWatch Logs is required to view database logs in the Database Insights console. | Not supported | Supported | 
| Import Performance Insights counter metrics into CloudWatch automatically | Not supported | Supported | 
| View Amazon RDS events in CloudWatch | Not supported | Supported | 
| Analyze database performance for a time period of your choice with on‐demand analysis | Not supported | Supported | 

**Note**  
Database Insights feature availability differs in different AWS Regions, because not all Advanced Mode features are available in all Regions.

## Data retention
<a name="Database-Insights-retention"></a>

The Advanced mode of Database Insights retains 15 months of metrics collected by Performance Insights.

If Performance Insights is enabled for the Standard mode, Amazon RDS retains 7 days of Performance Insights counter metrics.

For information about counter metrics for Performance Insights, see [Performance Insights counter metrics](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_PerfInsights_Counters.html).

For information about the retention period for CloudWatch metrics collected by Database Insights, see the following topics.
+ [Amazon CloudWatch metrics for Amazon Aurora](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.AuroraMonitoring.Metrics.html) in the *Amazon Aurora User Guide*
+ [Amazon CloudWatch metrics for Amazon Relational Database Service](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-metrics.html) in the *Amazon RDS User Guide*
+ [Amazon CloudWatch metrics for Amazon RDS Performance Insights](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_PerfInsights.Cloudwatch.html) in the *Amazon Aurora User Guide*
+ [Amazon CloudWatch metrics for Amazon RDS Performance Insights](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.Cloudwatch.html) in the *Amazon Aurora User Guide*

## How Database Insights integrates with Performance Insights
<a name="Database-Insights-pi"></a>

Performance Insights is a database performance monitoring service.

Database Insights builds upon and extends the capabilities of Performance Insights. Database Insights adds monitoring, analysis, and optimization features.

To enable the Advanced mode of Database Insights, you must enable Performance Insights. 

Database Insights imports Performance Insights counter metrics into CloudWatch automatically. The Advanced mode of Database Insights automatically retains 15 months of all metrics collected by Database Insights, including Performance Insights metrics and CloudWatch metrics. This automatically happens for you when you enable Advanced mode in an instance, with no further configuration needed. For information about Performance Insights counter metrics, see [Performance Insights counter metrics](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights_Counters.html) in the *Amazon Aurora User Guide*.

## Pricing
<a name="Database-Insights-pricing"></a>

For information about pricing, see [Amazon CloudWatch Pricing](https://aws.amazon.com/cloudwatch/pricing/).

# Get started with CloudWatch Database Insights
<a name="Database-Insights-Get-Started"></a>

The Standard mode of Database Insights is enabled by default for your Amazon RDS and Aurora databases. To get started with the Advanced mode of Database Insights, you can create a new database or modify a database.

For information about enabling the Advanced mode or the Standard mode of Database Insights for an Amazon RDS database, see the following topics.
+ [Turning on the Advanced mode of Database Insights for Amazon RDS](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_DatabaseInsights.TurningOnAdvanced.html) in the *Amazon RDS User Guide*
+ [Turning on the Standard mode of Database Insights for Amazon RDS](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_DatabaseInsights.TurningOnStandard.html) in the *Amazon RDS User Guide*
+ [Turning CloudWatch Database Insights on or off when creating a DB instance or Multi-AZ DB cluster for Amazon RDS](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_DatabaseInsights.TurnOnCreateDatabase.html) in the *Amazon RDS User Guide*

For information about enabling the Advanced mode or the Standard mode of Database Insights for an Amazon Aurora database, see the following topics.
+ [Turning on the Advanced mode of Database Insights for Amazon Aurora](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_DatabaseInsights.TurningOnAdvanced.html) in the *Amazon Aurora User Guide*
+ [Turning on the Standard mode of Database Insights for Amazon Aurora](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_DatabaseInsights.TurningOnStandard.html) in the *Amazon Aurora User Guide*

For information about enabling the Advanced mode or the Standard mode of Database Insights for an Aurora PostgreSQL Limitless Database, see the following topics.
+ [Turning on the Advanced mode of Database Insights for Aurora PostgreSQL Limitless Database](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/limitless-monitoring.cwdbi.advanced.html) in the *Amazon Aurora User Guide*
+ [Turning on the Standard mode of Database Insights for Aurora PostgreSQL Limitless Database](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/limitless-monitoring.cwdbi.standard.html) in the *Amazon Aurora User Guide*

## Required permissions for Database Insights
<a name="w2aac26c13c31c17"></a>

Certain IAM permissions are required to use Database Insights. Database Insights requires permissions for CloudWatch, CloudWatch Logs, Amazon RDS, and Amazon RDS Performance Insights. You might not need to provide these permissions to your user or role if you have broader permissions.

The following CloudWatch permissions are required to use Database Insights.
+ `cloudwatch:BatchGetServiceLevelIndicatorReport`
+ `cloudwatch:DescribeAlarms`
+ `cloudwatch:GetDashboard`
+ `cloudwatch:GetMetricData`
+ `cloudwatch:ListMetrics`
+ `cloudwatch:PutDashboard`

The following CloudWatch Logs permissions are required to use Database Insights.
+ `logs:DescribeLogGroups`
+ `logs:GetQueryResults`
+ `logs:StartQuery`
+ `logs:StopQuery`

The following Amazon RDS permissions are required to use Database Insights.
+ `rds:DescribeDBClusters`
+ `rds:DescribeDBInstances`
+ `rds:DescribeEvents`
+ `rds:DescribeDBShardGroups` (if you are monitoring Aurora PostgreSQL Limitless Databases

The following Performance Insights permissions are required to use Database Insights.
+ `pi:ListAvailableResourceMetrics`
+ `pi:ListAvailableResourceDimensions`
+ `pi:DescribeDimensionKeys`
+ `pi:GetDimensionKeyDetails`
+ `pi:GetResourceMetrics`
+ `pi:ListPerformanceAnalysisReports`
+ `pi:GetResourceMetadata`
+ `pi:GetPerformanceAnalysisReport`
+ `pi:CreatePerformanceAnalysisReport`
+ `pi:DeletePerformanceAnalysisReport`
+ `pi:ListTagsForResource`
+ `pi:TagResource`
+ `pi:UntagResource`

The following sample policy contains the permissions required for full access to Database Insights.

### Sample policy for full access
<a name="Database-Insights-permissions-sample"></a>

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [{
    "Effect" : "Allow",
      "Action" : [
        "cloudwatch:BatchGetServiceLevelIndicatorReport",
        "cloudwatch:DescribeAlarms",
        "cloudwatch:GetMetricStatistics",
        "cloudwatch:GetMetricData",
        "cloudwatch:ListMetrics",
        "cloudwatch:PutDashboard"
      ],
      "Resource" : "*"
    },
    {
    "Effect" : "Allow",
      "Action" : [
        "logs:DescribeLogGroups",
        "logs:GetQueryResults",
        "logs:StartQuery",
        "logs:StopQuery"
      ],
      "Resource" : "*"
    },
    {
    "Effect" : "Allow",
      "Action" : [
        "pi:DescribeDimensionKeys",
        "pi:GetDimensionKeyDetails",
        "pi:GetResourceMetadata",
        "pi:GetResourceMetrics",
        "pi:ListAvailableResourceDimensions",
        "pi:ListAvailableResourceMetrics",
        "pi:CreatePerformanceAnalysisReport",
        "pi:GetPerformanceAnalysisReport",
        "pi:ListPerformanceAnalysisReports",
        "pi:DeletePerformanceAnalysisReport",
        "pi:TagResource",
        "pi:UntagResource",
        "pi:ListTagsForResource"
      ],
      "Resource" : "arn:aws:pi:*:*:*/rds/*"
    },
    {
    "Effect" : "Allow",
      "Action" : [
        "rds:DescribeDBInstances",
        "rds:DescribeDBClusters",
        "rds:DescribeEvents"
      ],
      "Resource" : "*"
    }
  ]
}
```

------

# Set up cross-account cross-region monitoring for CloudWatch Database Insights
<a name="Database-Insights-Cross-Account-Cross-Region"></a>

 CloudWatch Database Insights supports cross-account and cross-region database fleet monitoring, enabling centralized observability across your entire database AWS infrastructure. It allows you to monitor, troubleshoot, and optimize databases spanning multiple AWS accounts and regions from a single unified console experience. 

**Topics**
+ [Prerequisites](#Database-Insights-Cross-Account-Cross-Region-Prereq)
+ [Set-up your monitoring and source accounts for Database Insights cross-account access](#Database-Insights-Cross-Account-Cross-Region-MonitoringSourceAccountSetup)
+ [Set-up Database Insights for cross-account cross-region console](#Database-Insights-Cross-Account-Cross-Region-setup)
+ [Using Database Insights cross-account cross-region dashboards](#Database-Insights-Cross-Account-Cross-Region-Using)

## Prerequisites
<a name="Database-Insights-Cross-Account-Cross-Region-Prereq"></a>
+ Database Insights cross-account cross-region requires both **CloudWatch cross-account observability** and the **cross-account cross-region CloudWatch console** to be setup first. See instructions below on how to enable both.
+ If you have already enabled them, you might still need to configure additional data sharing for Database Insights to work across accounts and regions in your environment. See instructions below and make sure you have selected the right data sharing configuration.

## Set-up your monitoring and source accounts for Database Insights cross-account access
<a name="Database-Insights-Cross-Account-Cross-Region-MonitoringSourceAccountSetup"></a>

1. Follow the step-by-step guide in [CloudWatch cross-account observability](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account-Setup.html). CloudFormation templates are provided for infrastructure as code deployments. 

1. In **Step 1: Set up a monitoring account** you need to at least select the following data types to share with your monitoring account for Database Insights to work across accounts and regions: **Logs**, **Metrics**, **Traces**, and **Application Signals - Services, Service Level Objectives (SLOs)**.

1. You need to do this process for **all regions** where you want to setup Database Insights with cross-account cross-region support.

## Set-up Database Insights for cross-account cross-region console
<a name="Database-Insights-Cross-Account-Cross-Region-setup"></a>

1. Follow the step-by-step guide in [Cross-account cross-Region CloudWatch console](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Cross-Account-Cross-Region.html). 

1. In **Step 5: Permissions**, you need to at least select the following data types to share with your monitoring account: **Include CloudWatch automatic dashboards**, and **Include read-only access for Database Insights.** Otherwise, you can also opt for **Full read-only access to everything in your account**, which will include all data sources available. 

1.  CloudWatch cross-region console is a global setting, so you only need to do this step once and it will work for all regions. 

## Using Database Insights cross-account cross-region dashboards
<a name="Database-Insights-Cross-Account-Cross-Region-Using"></a>

 After you set up Database Insights for cross-account cross-region support, you can enable "Cross-account cross-region mode" in the **Filters** section of the left panel, right under **Database Views**. You will see a toggle button located on the top left corner, like in the screenshot below. 

![\[alt text not found\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/database-insights-enable-cross-account-toggle.png)


 Once cross-account cross-region mode is enabled, new Filters are available, which allow you to select multiple regions and to filter by AWS Account IDs and labels, database resource types, and database resource identifiers. 

 By default, your current region and all accounts are selected. If you change your selection of regions and accounts, the Fleet Health Dashboard updates automatically to show resources that match the selected region and account filters. 

 From the Fleet Health Dashboard, you can easily navigate to the Database Instance Dashboard for instances that belong to other AWS accounts and regions. 

 There is a few aspects you must take into consideration when working with Database Insights cross-account cross-region monitoring: 
+  Alarms must be created in the monitoring account only. Alarms can be configured on metrics from source accounts, but they need to be created in the monitoring account. 
+  Fleet monitoring views must be defined and saved in the monitoring account only. 
+  Custom metrics dashboards in Database Insights Instance Dashboard must be customised in the monitoring account only. 
+  The maximum number of regions allowed in the Database Insights Fleet Health Dashboard at a given time is 3. 
+  Only read operations are allowed from the Monitoring account. This means you cannot create performance analysis reports from the Monitoring account. 
+  When cross-account cross-region mode is enabled in the Fleet Health Dashboard, filtering by AWS Resource Tags and resource properties is not available. 

# Viewing the Fleet Health Dashboard for CloudWatch Database Insights
<a name="Database-Insights-Fleet-Health-Dashboard"></a>

You can use the Fleet Health Dashboard to view a snapshot of the health of your database fleet.

![\[Fleet Health Dashboard\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbi_fhd.png)


## Fleet health views
<a name="Database-Insights-fleet-views"></a>

A *database fleet* in Database Insights is a group of databases that you want to monitor. You can create a monitoring view for a database fleet by choosing filters in the **Filters** component. This component allows you to apply filters on properties, such as cluster or instance names and tags. In the Fleet Health Dashboard, CloudWatch shows databases that match at least one of the filter conditions for the fleet health view.

![\[Filter by properties and tags\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbi_filter.png)


To create, modify, or delete views for database fleets, use the procedures in the following topics.
+ [Create a fleet health view for CloudWatch Database Insights](Database-Insights-fleet-views-create.md)
+ [Edit a fleet health view for CloudWatch Database Insights](Database-Insights-fleet-views-edit.md)
+ [Delete a fleet health view for CloudWatch Database Insights](Database-Insights-fleet-views-delete.md)

## RDS instances overview table
<a name="Database-Insights-instances"></a>

Use the **RDS instances overview** table to view the alarm state, max DB Load percentage, and the time of the last state update for each instance in your fleet.

![\[Amazon RDS resources table\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbi_fhd-resources.png)


## Instances state summary
<a name="Database-Insights-Instances-State-Summary"></a>

Use the **Instances state summary** to view the health of all instances in your fleet. The Instances state summary provides two views based on **Alarms** and the DB Load metric. By default, CloudWatch displays the **Alarms** view.

![\[Instances state summary\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbi_iss.png)


Each node in the honeycomb represents an instance. For more information about an instance, you can choose the corresponding node and choose **Filter view by this instance**. 

![\[Instances state summary selected\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbi_iss-selected.png)


The honeycomb component summarizes the alarm state for instances in your fleet with the number of nodes in each state at the top of the honeycomb. CloudWatch displays the time of the last refresh of the data shown in the honeycomb.

When you switch to the **DB Load** view, you can see the overall health of the fleet from the point of view of the DB Load metric. Database load (DB Load) measures the number of active sessions in your database. DB Load is the key metric in Database Insights and is collected every second. CloudWatch categorizes DB instances into the following states based on thresholds for DB Load. 
+ High
+ Warning
+ Ok
+ Idle

You can see the thresholds for DB Load by choosing the corresponding state icons.

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

By default, CloudWatch displays the average DB Load. Choose **Max** to monitor the maximum DB Load for each instance.

Choose a node from the Instances state summary to display alarms and DB Load for the instance.

## Top 10 charts
<a name="Database-Insights-Top-Ten"></a>

Use the **Top 10 instances per relative DB Load** chart to view the DB Load trend over time for the 10 instances with the highest DB Load. The chart also provides the top queries and top wait events for the instance with the highest DB Load.

![\[Top 10 instances by DB Load chart\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbi_top10.png)


Use the **Top 10 instances per metric** charts to compare two key metrics for the top 10 instances in your fleet. You can select the following metrics.
+ CPU Utilization (%)
+ Freeable Memory (%)
+ DB Connections (%)
+ Network throughput
+ Read IOPS
+ Write IOPS
+ Read Latency
+ Write Latency

![\[Top 10 instances per metrics charts\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbi_fhd-top10per.png)


## Amazon RDS events
<a name="Database-Insights-Events"></a>

Use the **Events** summary and table to view RDS events for instances in your fleet.

![\[Events summary\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbi_events.png)


To view the **Events** table, choose **Details**.

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


For a list of events for Amazon RDS and Amazon Aurora, see the following topics.
+ [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*
+ [Amazon RDS event categories and event messages](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Events.Messages.html) in the *Amazon RDS User Guide*

## Calling services table
<a name="Database-Insights-Calling-Services"></a>

Use the **Calling services** table to view CloudWatch Application Signals services that are calling your database endpoints and related application-level metrics such as latency or errors.

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


Database Insights shows the services that are calling your top 10 instances by DB Load. To view calling services for another instance, choose the instance in the database instance dashboard.

When the endpoint called by the application is an Aurora cluster, Database Insights will display 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.

For more information about CloudWatch Application Signals, see [Application Signals](CloudWatch-Application-Monitoring-Sections.md).

# Create a fleet health view for CloudWatch Database Insights
<a name="Database-Insights-fleet-views-create"></a>

To create a fleet health view, use the following procedure.

**To create a fleet health view**

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 filters for the fleet of databases you want to monitor.

1. Choose **Save filter as fleet**.

1. In the **Save filter set (fleet)** window, enter a name for your fleet.

1. Choose the **Save** button.

To access the saved fleet, choose the **Saved fleets** dropdown. Then, choose a fleet.

# Edit a fleet health view for CloudWatch Database Insights
<a name="Database-Insights-fleet-views-edit"></a>

To edit a fleet health view, use the following procedure.

**To edit a fleet health view**

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 **Saved fleets** dropdown.

1. Choose the vertical ellipsis for a fleet health view you want to edit.

1. In the **Edit filter set (fleet)** window, you can edit the name of the fleet and the filters for the fleet.

1. Choose the **Save** button.

# Delete a fleet health view for CloudWatch Database Insights
<a name="Database-Insights-fleet-views-delete"></a>

To delete a fleet health view, use the following procedure.

**To delete a fleet health view**

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 **Saved fleets** dropdown.

1. Choose the vertical ellipsis for a fleet health view you want to delete.

1. In the **Delete filter set (fleet)** window, choose the **Delete** button.

# Viewing the Database Instance Dashboard for CloudWatch Database Insights
<a name="Database-Insights-Database-Instance-Dashboard"></a>

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
<a name="Database-Insights-database-load"></a>

*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
<a name="Database-Insights-DB-load-analysis"></a>

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
<a name="Database-Insights-sql-stats"></a>

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
<a name="Database-Insights-database-telemetry"></a>

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

### Metrics section for database telemetry
<a name="Database-Insights-metrics-tel"></a>

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
<a name="Database-Insights-logs-tel"></a>

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
<a name="Database-Insights-OS-processes"></a>

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
<a name="Database-Insights-slow-sql-tel"></a>

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
<a name="Database-Insights-events-tel"></a>

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
<a name="Database-Insights-calling"></a>

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
<a name="Database-Insights-On-demand-Analysis"></a>

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
<a name="Database-Insights-Integration-Application-Signals"></a>

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
<a name="Database-Insights-Lock-Analysis"></a>

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
<a name="Database-Insights-Lock-Analysis-snapshot-data"></a>

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
<a name="Database-Insights-Execution-Plans"></a>

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
<a name="Database-Insights-Execution-Plans-prereqs"></a>

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
<a name="Database-Insights-Execution-Plans-analyze"></a>

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)

# Monitoring Aurora Limitless databases with Database Insights
<a name="database-insights-limitless"></a>

Database Insights supports monitoring [Aurora PostgreSQL Limitless Databases](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_DatabaseInsights.Engines.html) at both the fleet and instance levels. Your Aurora PostgreSQL Limitless Databases are discoverable in both the Database Instance Dashboard and the Fleet Health Dashboard.

Aurora PostgreSQL Limitless Databases use *shard groups*. Each shard group consists of multiple database instances that work together to process distributed workloads. Database Insights helps you understand the load distribution among the instances within a shard group.

In the Fleet Health Dashboard, Database Insights provides monitoring of your Limitless shard groups together with the rest of databases that make up your database fleets. You can get an opinionated view of health and DBLoad utlilization for your Limitless shard groups in the same way you do for other databases in the fleet. In the Instance Dashboard, Database Insights provides monitoring at both the shard group level and for individual instances within the group. Database Insights provides a new view per shard group where you can see database load distributed across the instances in the shard group. From there, you can navigate to the specific instance dashboard within a shard group.

## Available features for Aurora Limitless
<a name="database-insights-limitless-features"></a>

The following table displays the features available for Aurora PostgreSQL Limitless databases. They indicate whether each feature is supported in the Standard and Advanced monitoring modes, and whether they are available at the Shard Group level, the instance level, and whether they are available in the Fleet or the Instance Dashboard of Database Insights.


| Feature | Standard | Advanced | ShardGroup | Instance | Database Insights dashboard | 
| --- | --- | --- | --- | --- | --- | 
| Analyze the top contributors to DB Load by dimension | Supported | Supported | Yes | Yes | Instance | 
| Query, graph, and set alarms on database metrics with up to 7 days of retention | Supported | Supported | Yes | Yes | Instance | 
| Define fine‐grained access control policies to restrict access to potentially sensitive dimensions such as SQL text | Supported | Supported | Yes | Yes | Instance | 
| Use the Load Distribution component to analyze load distribution across instances within the same shard group | Supported | Supported | Yes | No | Instance | 
|  Analyze operating system processes happening in your databases with detailed metrics per running process [Amazon RDS Enhanced Monitoring](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_PerfInsights_Counters.html) is required for this feature to work.  | Not supported | Supported | No | Yes | Instance | 
| Create and save fleet‐wide monitoring views to assess health across hundreds of databases | Not supported | Supported | Yes | No | Fleet | 
| Analyze SQL locks with 15 months of retention and a guided UX | Not supported | Not supported | No | No | Instance | 
| Analyze SQL execution plans with 15 months of retention and guided UX | Not supported | Not supported | No | No | Instance | 
| Visualize per‐query statistics | Not supported | Supported | No | Yes | Instance | 
| Analyze slow SQL queries Export of database logs to CloudWatch Logs is required for this feature to work. | Not supported | Supported | No | Yes | Instance | 
| View calling services with CloudWatch Application Signals | Not supported | Supported | Yes | No | Both | 
| View a consolidated dashboard for all database telemetry, including metrics, logs, events, and applicationsExport of database logs to CloudWatch Logs is required to view database logs in the Database Insights console. | Not supported | Supported | No | Yes | Instance | 
| Import Performance Insights counter metrics into CloudWatch automatically | Not supported | Supported | N/A | N/A | Instance | 
| View Amazon RDS events in CloudWatch | Not supported | Supported | Yes | No | Both | 
| Analyze database performance for a time period of your choice with on‐demand analysis | Not supported | Not supported | No | No | Instance | 

**Note**  
Enhanced Monitoring is automatically enabled for Aurora PostgreSQL Limitless Databases. 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).   
For Aurora PostgreSQL Limitless Databases, logs are automatically published to CloudWatch Logs and are discoverable in the Database Insights console. This incurs additional charges, following standard CloudWatch Logs pricing. For details about how CloudWatch Logs and Database Insights are priced and pricing examples, see [Amazon CloudWatch pricing](https://aws.amazon.com/cloudwatch/pricing/?nc1=h_ls).

## Monitoring Aurora Limitless shard groups in the Fleet Health Dashboard
<a name="database-insights-limitless-fleet"></a>

 Database Insights supports monitoring Aurora Limitless shard groups in the Fleet Health Dashboard.

In this view, you can see your Limitless shard groups alongside other databases that make up your database fleets. The Fleet Health Dashboard provides an opinionated view of health and DBLoad utilization for your Limitless shard groups, similar to how it presents information for other databases in the fleet. 

![\[Database Insights Fleet Health Dashboard. The main panel shows a hexagonal grid representing database instances, with one highlighted for 'shardgroup2'. It displays DB Load Utilization for Routers and Shards. The top right shows a graph of 'Top 10 instances per DB Load Utilization' over time. Below are details for 'db-microsoftsqlserver-enterprise-1-dbi-advanced' including top queries and wait events. The bottom sections show no critical events and no calling services. The left sidebar indicates 44 total instances with 2 in alarm state, and an average DB Load Utilization of 25.1%.\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbi_fhd.png)


 When viewing Aurora Limitless databases in the Fleet Health Dashboard: 
+ Only shard groups are visible, not individual instances
+ Shard groups appear in the following widgets:
  + The honeycomb chart
  + The top 10 by DBLoad
  + Events
  + Calling Services
  + The table list
+ DBLoad utilization is provided for both routers and shards

This fleet-level view allows you to monitor and compare the performance of your Aurora Limitless shard groups with other databases in your fleet, providing a comprehensive overview of your entire database fleet.

![\[Database Insights dashboard showing a list of database instances. The table displays 7 instances with their DB Identifier, Alarm state, Engine type, DB Load Utilization, Last state update, and Database version. Engines include PostgreSQL, SQL Server Enterprise, Oracle Standard, Aurora MySQL, and Aurora PostgreSQL. The SQL Server instance has the highest load at 25.21%. Two Aurora PostgreSQL instances are labeled as 'Limitless' and show separate utilization for Shards and Routers. The interface includes options for filtering, sorting, and viewing additional details.\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbi_fhd-limitless-list-view.png)


## Monitoring Aurora PostgreSQL Limitless Databases in the Instance Dashboard
<a name="database-insights-limitless-monitor"></a>

Database Insights works similarly for Aurora PostgreSQL Limitless Database as it does for standard Aurora DB clusters. However, you track metrics at the shard group level for Aurora PostgreSQL Limitless Database. The two main metrics to track are the following:
+ **Database load** – Measures the level of activity in your database. The key metric is `DBLoad`, which is collected every second. The unit for the `DBLoad` metric is average active sessions (AAS). To get the average active sessions, Database Insights samples the number of sessions concurrently running a query. The AAS is the total number of sessions divided by the total number of samples for a specific time period.
+ **Maximum CPU** – The maximum computational power available to your database. To see whether active sessions are exceeding the maximum CPU, look at their relationship to the `Max vCPU` line. The `Max vCPU` value is determined by the number of vCPU (virtual CPU) cores for your DB instance.

You can also "slice" the `DBLoad` metric into dimensions, which are subcategories of the metric. The most useful dimensions are the following:
+ **Top instances** – Shows the relative DB load for your instances (shards and routers) in descending order.
+ **Wait events** – Cause SQL statements to wait for specific events to happen before they can continue running. Wait events indicate where work is impeded.
+ **Top SQL** – Shows which queries contribute the most to DB load.

![\[Database Insights dashboard showing database performance metrics. The top section displays a line graph tracking database activity from 12:00 to 14:45 on July 14. Below, the DB Load Analysis tab shows a "Top instances" view listing 4 database instances (DTR-3-757, DTR-2-903, DAS-4-112, and DAS-5-992) with their load utilization metrics, all showing values less than 0.01 AAS (Average Active Sessions). The interface includes options for alarm states, filters, and various analysis views.\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbi_limitless-top-instances.png)


## Analyze DB load for Aurora PostgreSQL Limitless Databases with Database Insights
<a name="database-insights-limitless-dbload"></a>

With Database Insights, you can track metrics at the shard group level and at the instance level for an Aurora PostgreSQL Limitless Database. When analyzing DB load for an Aurora PostgreSQL Limitless Database, you might want to compare the DB load for each shard and router to the maximum vCPU.

The Absolute view shows the number of Average active sessions (AAS) and the estimated vCPU. The Relative view shows the ratio of AAS to the estimated vCPU.

![\[Database Insights dashboard showing database load distribution for a shardgroup1 Aurora PostgreSQL cluster. The interface displays a time series graph of average active sessions (AAS) and a pie chart showing load distribution across 5 database instances. The pie chart indicates a total of 261 AAS with percentages split between instances DTR-2-103, DTR-3-650, DAS-4-659, DAS-5-784, and DAS-6-336. The dashboard includes filters, alarm states, and database telemetry options."\]](http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/dbi_limitless-doughnut.png)


### Analyzing relative DB load using the Database Insights dashboard
<a name="analyzing-relative-db-load"></a>

You might want to improve the performance of your Aurora PostgreSQL Limitless Database by tracking relative DB load. To analyze relative DB load by instance for your Aurora PostgreSQL Limitless Database, use the following procedure.

**To analyze relative DB load using the console**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. In the navigation pane, choose Database Insights.

1. Choose an Aurora PostgreSQL Limitless Database. The Database Insights dashboard is displayed for that Aurora PostgreSQL Limitless Database.

1. In the Database load (DB load) section, choose *Instances* for *Sliced by*. To see the ratio of Average active sessions (AAS) to vCPU cores for all of the instances in your Aurora PostgreSQL Limitless Database, choose *Relative* for *Viewed as*.

   The Average active sessions chart shows the DB load for instances in yourAurora PostgreSQL Limitless Database.

1. To view the top instances, choose the *Top instances* tab.

1. (Optional) To analyze DB load for an instance in your Aurora PostgreSQL Limitless Database, choose the instance name in the *Instances* column. 

### Analyzing DB load by waits using the Database Insights dashboard
<a name="analyzing-db-load-waits"></a>

You might want to improve the performance for your Aurora PostgreSQL Limitless Database by tracking wait events. To analyze DB load by wait events for your Aurora PostgreSQL Limitless Database, use the following procedure.

**To analyze DB load by waits for Aurora PostgreSQL Limitless Database using the console**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. In the navigation pane, choose Database Insights.

1. Choose an Aurora PostgreSQL Limitless Database. The Database Insights dashboard is displayed for that Aurora PostgreSQL Limitless Database.

1. In the Database load (DB load) section, choose *Waits* for *Sliced by*. To view the number of AAS and the estimated vCPU, choose *Absolute* for *Viewed as*.

   The Average active sessions chart shows the DB load for instances in your Aurora PostgreSQL Limitless Database.

1. Scroll down to the *Top SQL* tab.

1. Choose the SQL statement to expand it into its component statements.

### Analyzing load distribution using the Database Insights dashboard
<a name="analyzing-db-load-distribution"></a>

You might want to balance the load distribution for instances on your Aurora PostgreSQL Limitless Database. To analyze load distribution of the instances on an Aurora PostgreSQL Limitless Database, use the following procedure.

**To analyze load distribution of the instances on an Aurora PostgreSQL Limitless Database using the console**

1. Open the CloudWatch console at [https://console.aws.amazon.com/cloudwatch/](https://console.aws.amazon.com/cloudwatch/).

1. In the navigation pane, choose Database Insights.

1. Choose an Aurora PostgreSQL Limitless Database. The Database Insights dashboard is displayed for that Aurora PostgreSQL Limitless Database.

1. In the Database load (DB load) section, choose *Instances* for *Sliced by*. To view the number of AAS and the estimated vCPU for all instances in your Aurora PostgreSQL Limitless Database, choose *Absolute* for *Viewed as*.

   The Average active sessions chart shows the DB load for instances in your Aurora PostgreSQL Limitless Database.

1. To see a chart of the load distribution of the instances in your Aurora PostgreSQL Limitless Database, choose the *Load distribution* tab.

# Troubleshooting for CloudWatch Database Insights
<a name="Database-Insights-Troubleshooting"></a>

Use the following information to troubleshoot issues for CloudWatch Database Insights.

## Applying tags to Amazon RDS resources
<a name="Database-Insights-Troubleshooting-tags"></a>

To apply tags to your databases, use the Amazon RDS API, AWS CLI, or Amazon RDS console. For more information, see the following topics.
+ [AddTagsToResource](https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_AddTagsToResource.html) in the *Amazon RDS API Reference*
+ [add-tags-to-resource](https://docs.aws.amazon.com/cli/latest/reference/rds/add-tags-to-resource.html) in the *Amazon RDS Command Line Reference*
+ [Tagging Amazon Aurora and Amazon RDS resources](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_Tagging.html) in the *Amazon Aurora User Guide*

## Maximum DB instances for fleets
<a name="Database-Insights-Troubleshooting-fleet-limit"></a>

You can't monitor more than 500 DB instances in a database fleet. You can use filters to create a fleet health view with less than 500 DB instances.