# rds-performance

Part of **RDS**

<!-- intent-backlink:auto -->

> 💡 **Path Selection**: This skill is one implementation path for [Optimize database performance using diagnostic tools](../../intent/rds-optimize-performance/SKILL.md). If you're unsure which path to take, check the routing skill first.

# ApsaraDB RDS Performance Optimization Console Guide

## Operations Overview

| Operation | Console Entry | Prerequisites | Description |
|----------|---------------|---------------|-------------|
| Analyze Slow SQL Statements | Console > Database Autonomy Service (DAS) > SQL Analysis | ApsaraDB RDS MySQL instance created, DAS service enabled for the account | Use DAS to analyze real-time and historical slow SQL queries with optimization suggestions |
| Analyze and Optimize SQL | Console > ApsaraDB RDS > Instances > Select Instance > Performance Optimization > SQL Analysis and Optimization | An ApsaraDB RDS instance is created and running, Access to the RDS console with appropriate permissions, Basic understanding of SQL queries and database operations | Review automatically detected inefficient SQL statements and view detailed execution plans and optimization suggestions |
| Enable Automatic SQL Optimization | Console > ApsaraDB RDS > Instances > Autonomous Service > Optimization & Throttling | SQL Explorer and Audit must be enabled for better accuracy in optimization | Configure DAS to automatically create recommended indexes based on SQL analysis |
| Query Governance | Console > RDS > Instances > [Instance ID] > Autonomy Services > Slow Query Logs > Query Governance | A High-availability Edition ApsaraDB RDS for PostgreSQL instance, An instance deployed in the Chinese mainland, China (Hong Kong), or Singapore region | View T+1 analysis results of slow SQL queries categorized by root cause with manual tagging capabilities |
| Slow SQL Statements | Console > RDS > Instances > [Instance ID] > Autonomy Services > Slow Query Logs | An RDS instance running RDS High-availability Edition | Analyze slow query logs with trend charts, statistics, and diagnostic optimization features |
| Identify Missing Indexes | Console > ApsaraDB RDS > Instances > Instance Details > SQL Server CloudDBA > Missing Index | An RDS instance with SQL Server engine must be created and running, SQL Server CloudDBA feature must be enabled for the instance | Identify potential missing indexes based on query execution patterns for SQL Server instances |
| Diagnose Database Performance | Console > ApsaraDB RDS > Instances > Performance Optimization & Diagnosis | RAM user with appropriate permissions, Instance must be running and accessible | Access comprehensive performance diagnostics including real-time metrics, capacity assessment, and diagnostic reports |

## Operation Steps

### Analyze Slow SQL Statements

**Navigation**: Console > Database Autonomy Service (DAS) > SQL Analysis

**Prerequisites**:
- ApsaraDB RDS MySQL instance created
- DAS service enabled for the account

1. Navigate to the DAS console
   - Element: **Database Autonomy Service (DAS)** (link) — left navigation panel

2. Select the SQL Analysis section
   - Element: **SQL Analysis** (menu) — main content area

3. View real-time SQL performance using 10-second SQL analysis
   - Element: **10-second SQL analysis** (button) — top-right corner
   - Notes: Executes SHOW PROCESSLIST at one-second intervals over a 10-second window

4. Check slow SQL statements trends and optimization suggestions
   - Element: **Slow SQL Optimization** (tab) — main content area

5. Enable full SQL analysis if not already enabled
   - Element: **Full SQL analysis** (checkbox) — settings panel
   - Notes: By default disabled; requires manual enablement

### Analyze and Optimize SQL

**Navigation**: Console > ApsaraDB RDS > Instances > Select Instance > Performance Optimization > SQL Analysis and Optimization

**Prerequisites**:
- An ApsaraDB RDS instance is created and running
- Access to the RDS console with appropriate permissions
- Basic understanding of SQL queries and database operations

1. Navigate to the SQL Analysis and Optimization page
   - Element: **Performance Optimization** (menu) — left navigation panel

2. Click on the 'SQL Analysis and Optimization' tab
   - Element: **SQL Analysis and Optimization** (tab) — main content area

3. Review the list of detected slow or inefficient SQL statements
   - Notes: The system automatically identifies and displays SQL statements that exceed performance thresholds.

4. Click on a specific SQL statement to view its execution plan and optimization suggestions
   - Element: **View Details** (button) — row action column
   - Notes: Each row includes a 'View Details' button for deeper inspection.

### Enable Automatic SQL Optimization

**Navigation**: Console > ApsaraDB RDS > Instances > Autonomous Service > Optimization & Throttling

**Prerequisites**:
- SQL Explorer and Audit must be enabled for better accuracy in optimization

1. Navigate to the Autonomous Service section
   - Element: **Autonomous Service** (menu) — left-side navigation pane

2. Go to the Diagnosis & Optimization page
   - Element: **Diagnosis & Optimization** (menu) — left-side navigation pane

3. Click on the Self-Government Center tab
   - Element: **Self-Government Center** (tab) — main content area

4. Turn on the autonomy service switch
   - Element: **autonomy service switch** (toggle) — Autonomous Function Settings tab

5. Select automatic index creation and deletion option
   - Element: **Automatic Index Creation and Deletion** (checkbox) — Optimization and Throttling tab
   - Notes: If selected, DAS automatically creates recommended indexes; if only diagnostics are selected, no auto-creation occurs.

6. Confirm the settings by clicking the Confirm button
   - Element: **Confirm** (button) — bottom of the form

7. Optionally configure an alert template for optimization events
   - Element: **Alert Template** (section) — optional configuration step
   - Notes: Can add new contacts or modify existing ones using provided buttons.

| Parameter | Type | Required | Options/Values | Description |
|-----------|------|----------|----------------|-------------|
| Autonomy Service Switch | toggle | No | — | Enables or disables the autonomous service for SQL optimization. |
| Automatic Index Creation and Deletion | checkbox | No | — | Determines whether DAS automatically creates indexes based on recommendations. |
| Alert Contact Group | dropdown | No | New Contact Group, Add Person | Specifies who receives notifications about optimization events. |

### Query Governance

**Navigation**: Console > RDS > Instances > [Instance ID] > Autonomy Services > Slow Query Logs > Query Governance

**Prerequisites**:
- A High-availability Edition ApsaraDB RDS for PostgreSQL instance
- An instance deployed in the Chinese mainland, China (Hong Kong), or Singapore region

1. Go to the Instances page and select the region where your instance resides
   - Element: **Instances** (link) — top navigation bar

2. Find the instance and click its ID
   - Element: **[Instance ID]** (link) — main content area

3. In the left navigation pane, choose Autonomy Services > Slow Query Logs > Query Governance
   - Element: **Autonomy Services** (menu) — left navigation panel

4. Review the Query governance overview, trend, top rankings, and SQL to be optimized sections
   - Element: **Query Governance** (tab) — main content area

5. Click Suggestions in the Actions column to view optimization suggestions for a SQL template
   - Element: **Suggestions** (button) — Actions column

6. Click Add Tag in the Actions column to manually add a tag to a SQL template
   - Element: **Add Tag** (button) — Actions column

7. Click Sample in the Actions column to view the slow query log sample
   - Element: **Sample** (button) — Actions column

8. Click Trend in the Actions column to view the slow query log analysis for that template
   - Element: **Trend** (button) — Actions column

9. Click Export in the upper-right corner to create a download task for filtered templates
   - Element: **Export** (button) — upper-right corner
   - Notes: Exported files expire after three days

10. Click Share next to Export to generate a URL for filtered results
    - Element: **Share** (button) — next to Export
    - Notes: Anyone with DAS permissions can open the shared URL

### Slow SQL Statements

**Navigation**: Console > RDS > Instances > [Instance ID] > Autonomy Services > Slow Query Logs

**Prerequisites**:
- An RDS instance running RDS High-availability Edition

1. Go to the Instances page and select the region where the instance resides
   - Element: **Instances** (link) — top navigation bar

2. Click on the instance ID to open its details page
   - Element: **[Instance ID]** (link) — main content area

3. In the left-side navigation pane, choose Autonomy Services > Slow Query Logs
   - Element: **Autonomy Services** (menu) — left navigation panel

4. On the Slow Log Analysis tab, set a time range to view trend chart and statistics
   - Element: **Slow Log Analysis** (tab) — main content area
   - Notes: The end time must be later than the start time, and the interval cannot exceed 24 hours. You can query logs from the past month.

5. Click a time point in the trend chart to view statistics and details at that moment
   - Element: **time point in trend chart** (interactive element) — trend chart area

6. Click Export Slow Log to download the slow query logs
   - Element: **Export Slow Log** (button) — top-right corner of the tab

7. On the Slow Log Statistics tab, click Sample to view individual query execution details
   - Element: **Sample** (button) — Actions column

8. On the Slow Log Statistics tab, click Optimize to open the SQL Diagnostic Optimization dialog
   - Element: **Optimize** (button) — Actions column
   - Notes: Optimization suggestions may take more than 20 seconds to appear.

9. After analysis, copy the optimized SQL from the dialog and paste it into your database client or DMS
   - Element: **Copy** (button) — upper-right corner of the dialog

10. On the Slow Log Details tab, click Optimize in the Actions column to run SQL diagnostic optimization
    - Element: **Optimize** (button) — Actions column

### Identify Missing Indexes

**Navigation**: Console > ApsaraDB RDS > Instances > Instance Details > SQL Server CloudDBA > Missing Index

**Prerequisites**:
- An RDS instance with SQL Server engine must be created and running
- SQL Server CloudDBA feature must be enabled for the instance

1. Navigate to the instance details page
   - Element: **Instance Details** (link) — Main content area under the instance list

2. Click on the SQL Server CloudDBA tab
   - Element: **SQL Server CloudDBA** (tab) — Top navigation panel of the instance details page

3. Select the 'Missing Index' section
   - Element: **Missing Index** (link) — Left sidebar menu under SQL Server CloudDBA
   - Notes: This section displays a list of potential missing indexes based on query execution patterns.

### Diagnose Database Performance

**Navigation**: Console > ApsaraDB RDS > Instances > Performance Optimization & Diagnosis

**Prerequisites**:
- RAM user with appropriate permissions
- Instance must be running and accessible

1. Navigate to the DAS console
   - Element: **Performance Optimization & Diagnosis** (link) — left navigation panel

2. View real-time performance trends
   - Element: **Real-time performance** (tab) — main content area

3. Analyze slow SQL statements
   - Element: **Slow Log Analysis** (link) — features list

4. Check capacity assessment
   - Element: **Capacity assessment** (link) — features list

5. Review diagnostic reports
   - Element: **Diagnostic reports** (link) — features list

## FAQ

Q: Where can I find slow SQL analysis for my RDS instance?
A: You can access slow SQL analysis through multiple paths: Console > Database Autonomy Service (DAS) > SQL Analysis, or Console > ApsaraDB RDS > Instances > Select Instance > Performance Optimization > SQL Analysis and Optimization, or Console > RDS > Instances > [Instance ID] > Autonomy Services > Slow Query Logs.

Q: What happens if I enable automatic SQL optimization?
A: When you enable automatic SQL optimization with the "Automatic Index Creation and Deletion" option selected, DAS will automatically create recommended indexes based on SQL analysis without requiring manual intervention. The system uses online DDL operations to avoid table locks during index creation.

Q: Can I modify query governance tags after they are applied?
A: Yes, you can manually add tags to SQL templates using the "Add Tag" button in the Actions column of the Query Governance page. This allows you to track optimization progress and categorize queries according to your own criteria.

Q: What permissions do I need to access performance optimization features?
A: You need appropriate RAM permissions to access the RDS console and DAS features. For some advanced features like SQL throttling, you may need AliyunHDMFullAccess permission for your RAM user.

Q: How long does SQL diagnostic optimization take to complete?
A: SQL diagnostic optimization may take more than 20 seconds to complete and display optimization suggestions. The exact time depends on the complexity of the SQL statement and current system load.

## Pricing & Billing

### Billing Model
- DAS SQL Analysis: per_request billing model with usage-based charges
- SQL analysis and optimization features: included in standard RDS instance pricing (per_instance_hour)
- Basic Edition instances: support viewing and exporting slow query logs but do not support SQL diagnostics or optimization
- Query governance: free feature for eligible RDS MySQL and PostgreSQL instances
- Missing index feature: included at no additional cost with ApsaraDB RDS SQL Server instances

### Price Reference
- DAS SQL Analysis: 

### Free Tier
- New users can enjoy free trial quotas for DAS SQL Analysis (specific terms subject to official announcements)
- Query governance is a free feature provided by DAS for eligible RDS MySQL instances
- The missing index feature is included at no additional cost with ApsaraDB RDS SQL Server instances

### Billing Notes
- Full SQL analysis functionality requires separate activation and is billed based on actual collection volume
- SQL analysis and optimization features are included in standard RDS instance pricing with no additional charges
- Basic Edition instances support viewing and exporting slow query logs but do not support SQL diagnostics or optimization
- Data export tasks are retained for three days with no additional charges for using query governance features