Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions TOC-tidb-cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@
- [Overview](/tidb-cloud/tidb-cloud-tune-performance-overview.md)
- Analyze Performance
- [Use the Diagnosis Tab](/tidb-cloud/tune-performance.md)
- [Use Index Insight (Beta)](/tidb-cloud/index-insight.md)
- [Use Statement Summary Tables](/statement-summary-tables.md)
- SQL Tuning
- [Overview](/tidb-cloud/tidb-cloud-sql-tuning-overview.md)
Expand Down
170 changes: 170 additions & 0 deletions tidb-cloud/index-insight.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
---
title: Index Insight (Beta)
summary: Learn how to use the Index Insight feature in TiDB Cloud and obtain index recommendations for slow queries.
---

# Index Insight (Beta)

The Index Insight (beta) feature in TiDB Cloud provides powerful capabilities to optimize query performance by offering index recommendations for slow queries that are not using indexes effectively. This document walks you through the steps to enable and utilize the Index Insight feature effectively.

> **Note:**
>
> Index Insight is currently in beta and only available for [TiDB Dedicated](/tidb-cloud/select-cluster-tier.md#tidb-dedicated) clusters.

## Introduction

The Index Insight feature provides you with the following benefits:

- Enhanced query performance: Index Insight identifies slow queries and suggests appropriate indexes for them, thereby speeding up query execution, reducing response time, and improving user experience.
- Cost efficiency: By using Index Insight to optimize query performance, the need for extra computing resources is reduced, enabling you to use existing infrastructure more effectively. This can potentially lead to operational cost savings.
- Simplified optimization process: Index Insight simplifies the identification and implementation of index improvements, eliminating the need for manual analysis and guesswork. As a result, you can save time and effort with accurate index recommendations.
- Improved application efficiency: By using Index Insight to optimize database performance, applications running on TiDB Cloud can handle larger workloads and serve more users concurrently, which makes scaling operations of applications more efficient.

## Usage

This section introduces how to enable the Index Insight feature and obtain recommended indexes for slow queries.

### Before you begin

Before enabling the Index Insight feature, make sure that you have created a TiDB Dedicated cluster. If you do not have one, follow the steps in [Create a cluster](/tidb-cloud/create-tidb-cluster.md) to create one.

### Step 1: Enable Index Insight

1. In the [TiDB Cloud console](https://tidbcloud.com), navigate to the cluster overview page of your TiDB Dedicated cluster, and then click **Diagnosis** in the left navigation pane.

2. Click the **Index Insight BETA** tab. The **Index Insight overview** page is displayed.

3. To use the Index Insight feature, you need to create a dedicated SQL user, which is used to trigger the feature and receive index recommendations. The following SQL statements create a new SQL user with required privileges, including read privilege for `information_schema` and `mysql`, and `PROCESS` and `REFERENCES` privileges for all databases. Replace `'index_insight_user'` and `'random_password'` with your values.

```sql
CREATE user 'index_insight_user'@'%' IDENTIFIED by 'random_password';
GRANT SELECT ON information_schema.* TO 'index_insight_user'@'%';
GRANT SELECT ON mysql.* TO 'index_insight_user'@'%';
GRANT PROCESS, REFERENCES ON *.* TO 'index_insight_user'@'%';
FLUSH PRIVILEGES;
```

> **Note:**
>
> To connect to your TiDB Dedicated cluster, see [Connect to a TiDB cluster](/tidb-cloud/connect-to-tidb-cluster.md).

4. Enter the username and password of the SQL user created in the preceding step. Then, click **Activate** to initiate the activation process.

### Step 2: Manually trigger Index Insight

To obtain index recommendations for slow queries, you can manually trigger the Index Insight feature by clicking **Check Up** in the upper-right corner of the **Index Insight overview** page.

Then, the feature begins scanning slow queries from the past three hours. After the scan finishes, it provides a list of index recommendations based on its analysis.

### Step 3: View index recommendations

To view the details of a specific index recommendation, click the insight from the list. The **Index Insight Details** page is displayed.

On this page, you can find the index recommendations, related slow queries, execution plans, and relevant metrics. This information helps you better understand the performance issues and evaluate the potential impact of implementing the index recommendations.

### Step 4: Implement index recommendations

Before implementing the index recommendations, you need to first review and evaluate the recommendations from the **Index Insight Details** page.

To implement the index recommendations, follow these steps:

1. Evaluate the impact of the proposed index on existing queries and workload.
2. Consider the storage requirements and potential trade-offs associated with the index implementation.
3. Use appropriate database management tools to create the index recommendations on the relevant tables.
4. Monitor the performance after implementing the indexes to assess the improvements.

## Best practices

This section introduces some best practices for using the Index Insight feature.

### Regularly trigger Index Insight

To maintain optimized indexes, it is recommended to trigger the Index Insight feature periodically, such as every day, or whenever substantial changes occur in your queries or database schema.

### Analyze impact before implementing indexes

Before implementing the index recommendations, analyze the potential impact on query execution plans, disk space, and any trade-offs involved. Prioritize implementing indexes that provide the most significant performance improvements.

### Monitor performance

Regularly monitor query performance after implementing the index recommendations. This helps you confirm the improvements and make further adjustments if necessary.

## FAQ

This section lists some frequently asked questions about the Index Insight feature.

### How to deactivate Index Insight?

To deactivate the Index Insight feature, perform the following steps:

1. In the upper-right corner of the **Index Insight overview** page, click **Settings**. The **Index Insight settings** page is displayed.
2. Click **Deactivate**. A confirmation dialog box is displayed.
3. Click **OK** to confirm the deactivation.

After you deactivate the Index Insight feature, all index recommendations are removed from the **Index Insight overview** page. However, the SQL user created for the feature is not deleted. You can delete the SQL user manually.

### How to delete the SQL user after deactivating Index Insight?

After you deactivate the Index Insight feature, you can execute the `DROP USER` statement to delete the SQL user created for the feature. The following is an example. Replace `'username'` with your value.

```sql
DROP USER 'username';
```

### Why does the `invalid user or password` message show up during activation or check-up?

The `invalid user or password` message typically prompts when the system cannot authenticate the credentials you provided. This issue might occur due to various reasons, such as incorrect username or password, or an expired or locked user account.

To resolve this issue, perform the following steps:

1. Verify your credentials: Make sure that the username and password you provided are correct. Pay attention to case sensitivity.
2. Check account status: Make sure that your user account is in active status and not expired or locked. You can confirm this by contacting the system administrator or the relevant support channel.
3. Create a new SQL user: If this issue is not resolved by the preceding steps, you can create a new SQL user using the following statements. Replace `'index_insight_user'` and `'random_password'` with your values.

```sql
CREATE user 'index_insight_user'@'%' IDENTIFIED by 'random_password';
GRANT SELECT ON information_schema.* TO 'index_insight_user'@'%';
GRANT SELECT ON mysql.* TO 'index_insight_user'@'%';
GRANT PROCESS, REFERENCES ON *.* TO 'index_insight_user'@'%';
FLUSH PRIVILEGES;
```

If you are still facing the issue after following the preceding steps, it is recommended to contact [PingCAP support team](/tidb-cloud/tidb-cloud-support.md).

### Why does the `no sufficient privileges` message show up during activation or check-up?

The `no sufficient privileges` message typically prompts when the SQL user you provided lacks the required privileges to request index recommendations from Index Insight.

To resolve this issue, perform the following steps:

1. Check the user privileges: Confirm if your user account has been granted the required privileges, including read privilege for `information_schema` and `mysql`, and `PROCESS` and `REFERENCES` privileges for all databases.

2. Create a new SQL user: If this issue is not resolved by the preceding steps, you can create a new SQL user using the following statements. Replace `'index_insight_user'` and `'random_password'` with your values.

```sql
CREATE user 'index_insight_user'@'%' IDENTIFIED by 'random_password';
GRANT SELECT ON information_schema.* TO 'index_insight_user'@'%';
GRANT SELECT ON mysql.* TO 'index_insight_user'@'%';
GRANT PROCESS, REFERENCES ON *.* TO 'index_insight_user'@'%';
FLUSH PRIVILEGES;
```

If you are still facing the issue after following the preceding steps, it is recommended to contact [PingCAP support team](/tidb-cloud/tidb-cloud-support.md).

### Why does the `operations may be too frequent` message show up during using Index Insight?

The `operations may be too frequent` message typically prompts when you have exceeded the rate or usage limit set by Index Insight.

To resolve this issue, perform the following steps:

1. Slow down operations: If you receive this message, you need to decrease your operation frequency on Index Insight.
2. Contact support: If the issue persists, contact [PingCAP support team](/tidb-cloud/tidb-cloud-support.md) and provide details of the error message, your actions, and any other relevant information.

### Why does the `internal error` message show up during using Index Insight?

The `internal error` message typically prompts when the system encounters an unexpected error or issue. This error message is general and does not provide details about the underlying cause.

To resolve this issue, perform the following steps:

1. Retry the operation: Refresh the page or try the operation again. The error might be temporary and can be resolved by a simple retry.
2. Contact support: If the issue persists, contact [PingCAP support team](/tidb-cloud/tidb-cloud-support.md) and provide details of the error message, your actions, and any other relevant information.
23 changes: 23 additions & 0 deletions tidb-cloud/tidb-cloud-release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,29 @@ aliases: ['/tidbcloud/supported-tidb-versions','/tidbcloud/release-notes']

This page lists the release notes of [TiDB Cloud](https://www.pingcap.com/tidb-cloud/) in 2023.

## June 6, 2023

- Introduce [Index Insight (beta)](/tidb-cloud/index-insight.md) for [TiDB Dedicated](/tidb-cloud/select-cluster-tier.md#tidb-dedicated) clusters, which optimizes query performance by providing index recommendations for slow queries.

With Index Insight, you can improve the overall application performance and efficiency of your database operations in the following ways:

- Enhanced query performance: Index Insight identifies slow queries and suggests appropriate indexes for them, thereby speeding up query execution, reducing response time, and improving user experience.
- Cost efficiency: By using Index Insight to optimize query performance, the need for extra computing resources is reduced, enabling you to use existing infrastructure more effectively. This can potentially lead to operational cost savings.
- Simplified optimization process: Index Insight simplifies the identification and implementation of index improvements, eliminating the need for manual analysis and guesswork. As a result, you can save time and effort with accurate index recommendations.
- Improved application efficiency: By using Index Insight to optimize database performance, applications running on TiDB Cloud can handle larger workloads and serve more users concurrently, which makes scaling operations of applications more efficient.

To use Index Insight, navigate to the **Diagnosis** page of your TiDB Dedicated cluster and click the **Index Insight BETA** tab.

For more information, see [Use Index Insight (beta)](/tidb-cloud/index-insight.md).

- Introduce [TiDB Playground](https://play.tidbcloud.com/?utm_source=docs&utm_medium=tidb_cloud_release_notes), an interactive platform for experiencing the full capabilities of TiDB, without registration or installation.

TiDB Playground is an interactive platform designed to provide a one-stop-shop experience for exploring the capabilities of TiDB, such as scalability, MySQL compatibility, and real-time analytics.

With TiDB Playground, you can try out TiDB features in a controlled environment free from complex configurations in real-time, making it ideal to understand the features in TiDB.

To get started with TiDB Playground, go to the [**TiDB Playground**](https://play.tidbcloud.com/?utm_source=docs&utm_medium=tidb_cloud_release_notes) page, select a feature you want to explore, and begin your exploration.

## June 5, 2023

- Support connecting your [Data App](/tidb-cloud/tidb-cloud-glossary.md#data-app) to GitHub.
Expand Down
18 changes: 15 additions & 3 deletions tidb-cloud/tune-performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ summary: Learn how to analyze and tune performance of your TiDB Cloud cluster.

# Analyze and Tune Performance

TiDB Cloud provides [Slow Query](#slow-query), [Statement Analysis](#statement-analysis), and [Key Visualizer](#key-visualizer) to analyze performance.
TiDB Cloud provides [Slow Query](#slow-query), [Statement Analysis](#statement-analysis), [Key Visualizer](#key-visualizer), and [Index Insight (beta)](#index-insight-beta) to analyze performance.

- Slow Query lets you search and view all slow queries in your TiDB cluster, and explore the bottlenecks of each slow query by viewing its execution plan, SQL execution information, and other details.

- Statement Analysis enables you to directly observe the SQL execution on the page, and easily locate performance problems without querying the system tables.

- Key Visualizer helps you observe TiDB's data access patterns and data hotspots.

- Index Insight provides you with meaningful and actionable index recommendations.

> **Note:**
>
> Currently, **Key Visualizer** is unavailable for [TiDB Serverless clusters](/tidb-cloud/select-cluster-tier.md#tidb-serverless-beta).
> Currently, **Key Visualizer** and **Index Insight (beta)** are unavailable for [TiDB Serverless](/tidb-cloud/select-cluster-tier.md#tidb-serverless-beta) clusters.

## Slow Query

Expand Down Expand Up @@ -59,7 +61,7 @@ For more information, see [Statement Execution Details in TiDB Dashboard](https:

> **Note:**
>
> Key Visualizer is only available for [TiDB Dedicated clusters](/tidb-cloud/select-cluster-tier.md#tidb-dedicated).
> Key Visualizer is only available for [TiDB Dedicated](/tidb-cloud/select-cluster-tier.md#tidb-dedicated) clusters.

To view the key analytics, perform the following steps:

Expand All @@ -72,3 +74,13 @@ To view the key analytics, perform the following steps:
On the **Key Visualizer** page, a large heat map shows changes on access traffic over time. The average values ​​along each axis of the heat map are shown below and on the right side. The left side is the table name, index name and other information.

For more information, see [Key Visualizer](https://docs.pingcap.com/tidb/stable/dashboard-key-visualizer).

## Index Insight (beta)

The Index Insight feature in TiDB Cloud provides powerful capabilities to optimize query performance by offering recommended indexes for slow queries that are not utilizing indexes effectively.

> **Note:**
>
> Index Insight is currently in beta and only available for [TiDB Dedicated](/tidb-cloud/select-cluster-tier.md#tidb-dedicated) clusters.

For more information, see [Index Insight](/tidb-cloud/index-insight.md).