

# Overview of the Performance Schema for Performance Insights on Aurora MySQL
<a name="USER_PerfInsights.EnableMySQL"></a>

The Performance Schema is an optional feature for monitoring Aurora MySQL runtime performance at a low level of detail. The Performance Schema is designed to have minimal impact on database performance. Performance Insights is a separate feature that you can use with or without the Performance Schema.

**Topics**
+ [Overview of the Performance Schema](#USER_PerfInsights.EnableMySQL.overview)
+ [Performance Insights and the Performance Schema](#USER_PerfInsights.effect-of-pfs)
+ [Automatic management of the Performance Schema by Performance Insights](#USER_PerfInsights.EnableMySQL.options)
+ [Effect of a reboot on the Performance Schema](#USER_PerfInsights.EnableMySQL.reboot)
+ [Determining whether Performance Insights is managing the Performance Schema](USER_PerfInsights.EnableMySQL.determining-status.md)
+ [Turn on the Performance Schema for Aurora MySQL](USER_PerfInsights.EnableMySQL.RDS.md)

## Overview of the Performance Schema
<a name="USER_PerfInsights.EnableMySQL.overview"></a>

The Performance Schema monitors events in Aurora MySQL databases. An *event* is a database server action that consumes time and has been instrumented so that timing information can be collected. Examples of events include the following:
+ Function calls
+ Waits for the operating system
+ Stages of SQL execution
+ Groups of SQL statements

The `PERFORMANCE_SCHEMA` storage engine is a mechanism for implementing the Performance Schema feature. This engine collects event data using instrumentation in the database source code. The engine stores events in memory-only tables in the `performance_schema` database. You can query `performance_schema` just as you can query any other tables. For more information, see [MySQL Performance Schema](https://dev.mysql.com/doc/refman/8.0/en/performance-schema.html) in the *MySQL Reference Manual*.

## Performance Insights and the Performance Schema
<a name="USER_PerfInsights.effect-of-pfs"></a>

Performance Insights and the Performance Schema are separate features, but they are connected. The behavior of Performance Insights for Aurora MySQL depends on whether the Performance Schema is turned on, and if so, whether Performance Insights manages the Performance Schema automatically. The following table describes the behavior.


| Performance Schema turned on | Performance Insights management mode | Performance Insights behavior | 
| --- | --- | --- | 
|  Yes  |  Automatic  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_PerfInsights.EnableMySQL.html)  | 
|  Yes  |  Manual  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_PerfInsights.EnableMySQL.html)  | 
|  No  |  N/A  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_PerfInsights.EnableMySQL.html)  | 

## Automatic management of the Performance Schema by Performance Insights
<a name="USER_PerfInsights.EnableMySQL.options"></a>

When you create an Aurora MySQL DB instance with Performance Insights turned on, the Performance Schema is also turned on. In this case, Performance Insights automatically manages your Performance Schema parameters. This is the recommended configuration.

When Performance Insights manages the Performance Schema automatically, the **Source** of `performance_schema` is `System default`.

**Note**  
Automatic management of the Performance Schema isn't supported for the t4g.medium instance class.

You can also manage the Performance Schema manually. If you choose this option, set the parameters according to the values in the following table.


| Parameter name | Parameter value | 
| --- | --- | 
|  `performance_schema`  |  `1` (**Source** column has the value `Modified`)  | 
|  `performance-schema-consumer-events-waits-current`  |  `ON`  | 
|  `performance-schema-instrument`  |  `wait/%=ON`  | 
|  `performance_schema_consumer_global_instrumentation`  |  `1`  | 
|  `performance_schema_consumer_thread_instrumentation`  |  `1`  | 

If you change the `performance_schema` parameter value manually, and then later want to change to automatic management, see [Turn on the Performance Schema for Aurora MySQL](USER_PerfInsights.EnableMySQL.RDS.md).

**Important**  
When Performance Insights turns on the Performance Schema, it doesn't change the parameter group values. However, the values are changed on the DB instances that are running. The only way to see the changed values is to run the `SHOW GLOBAL VARIABLES` command.

## Effect of a reboot on the Performance Schema
<a name="USER_PerfInsights.EnableMySQL.reboot"></a>

Performance Insights and the Performance Schema differ in their requirements for DB instance reboots:

**Performance Schema**  
To turn this feature on or off, you must reboot the DB instance.

**Performance Insights**  
To turn this feature on or off, you don't need to reboot the DB instance.

If the Performance Schema isn't currently turned on, and you turn on Performance Insights without rebooting the DB instance, the Performance Schema won't be turned on.

# Determining whether Performance Insights is managing the Performance Schema
<a name="USER_PerfInsights.EnableMySQL.determining-status"></a>

To find out whether Performance Insights is currently managing the Performance Schema for all supported major engine versions, review the following table.


| Setting of performance\$1schema parameter | Setting of the Source column | Performance Insights is managing the Performance Schema? | 
| --- | --- | --- | 
| 0 | System default | Yes | 
| 0 or 1 | Modified | No | 

In the following procedure, you determine whether Performance Insights is managing the Performance Schema automatically.

**To determine whether Performance Insights is managing the Performance Schema automatically**

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

1. Choose **Parameter groups**.

1. Select the name of the parameter group for your DB instance.

1. Enter **performance\$1schema** in the search bar.

1. Check whether **Source** is the system default and **Value** is **0**. If so, Performance Insights is managing the Performance Schema automatically.

   In the example shown here, Performance Insights isn't managing the Performance Schema automatically.  
![\[Shows that the settings for the performance_schema parameter are modified.\]](http://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/images/perf_schema_user.png)

# Turn on the Performance Schema for Aurora MySQL
<a name="USER_PerfInsights.EnableMySQL.RDS"></a>

Assume that Performance Insights is turned on for your DB instance but isn't currently managing the Performance Schema. If you want to allow Performance Insights to manage the Performance Schema automatically, complete the following steps.

**To configure the Performance Schema for automatic management**

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

1. Choose **Parameter groups**.

1. Select the name of the parameter group for your DB instance.

1. Choose **Edit**.

1. Enter **performance\$1schema** in the search bar.

1. Select the `performance_schema` parameter.

1. Choose **Set to default value**.

1. Confirm by choosing **Set values to default**.

1. Choose **Save Changes**.

1. Reboot the DB instance.
**Important**  
Whenever you turn the Performance Schema on or off, make sure to reboot the DB instance.

For more information about modifying instance parameters, see [Modifying parameters in a DB parameter group in Amazon Aurora](USER_WorkingWithParamGroups.Modifying.md). For more information about the dashboard, see [Analyzing metrics with the Performance Insights dashboard](USER_PerfInsights.UsingDashboard.md). For more information about the MySQL performance schema, see [MySQL Performance Schema](https://dev.mysql.com/doc/refman/8.0/en/performance-schema.html) (for 8.0) and [MySQL Performance Schema](https://dev.mysql.com/doc/refman/8.4/en/performance-schema.html) (for 8.4) in the MySQL documentation.