Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tidb-dashboard: add doc for creating SQL binding from statement history #12388

Merged
merged 5 commits into from
Feb 16, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
47 changes: 45 additions & 2 deletions dashboard/dashboard-statement-details.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,54 @@ aliases: ['/docs/dev/dashboard/dashboard-statement-details/']

Click any item in the list to enter the detail page of the SQL statement to view more detailed information. This information includes the following parts:

- The overview of SQL statements, which includes the SQL template, the SQL template ID, the current time range of displayed SQL executions, the number of execution plans and the database in which the SQL statement is executed (area 1 in the following figure).
- The overview of SQL statements, which includes the SQL template, the SQL template ID, the current time range of displayed SQL executions, the number of execution plans, the database in which the SQL statement is executed, and the fast plan binding feature (area 1 in the following figure).
- The execution plan list: If a SQL statement has multiple execution plans, this list is displayed. Besides text information of execution plans, TiDB v6.2.0 introduces visual execution plans, through which you can learn each operator of a statement and detailed information more intuitively. You can select different execution plans, and the details of the selected plans are displayed below the list (area 2 in the following figure).
- Execution detail of plans, which displays the detailed information of the selected execution plans. See [Execution plan in details](#execution-details-of-plans) (area 3 in the following figure).

![Details](/media/dashboard/dashboard-statement-detail-v620.png)
![Details](/media/dashboard/dashboard-statement-detail-v660.png)

## Fast plan binding

Starting from v6.6.0, TiDB introduces the fast plan binding feature. You can quickly bind a SQL statement to a specific execution plan in TiDB Dashboard.

### Usage

#### Bind an execution plan

1. Click **Plan Binding**. The **Plan Binding** dialog box is displayed.

![Fast plan binding - not bound - entry](/media/dashboard/dashboard-quick-binding-entry-notbound.png)

2. Select a plan that you want to bind and click **Bind**.

![Fast plan binding - popup](/media/dashboard/dashboard-quick-binding-popup-notbound.png)

3. After the binding is completed, you can see the **Bound** label.

![Fast plan binding - popup - binding completed](/media/dashboard/dashboard-quick-binding-popup-bound.png)

#### Drop an existing binding

1. On the page of a SQL statement that has an existing binding, click **Plan Binding**. The **Plan Binding** dialog box is displayed.

![Fast plan binding - bound - entry](/media/dashboard/dashboard-quick-binding-entry-bound.png)

2. Click **Drop**.

![Fast plan binding - popup - bound](/media/dashboard/dashboard-quick-binding-popup-bound.png)

3. After the binding is dropped, you can see the **Not bound** label.

![Fast plan binding - popup](/media/dashboard/dashboard-quick-binding-popup-notbound.png)

### Limitation

Currently, the fast plan binding feature does not support the following types of SQL statements:

ran-huang marked this conversation as resolved.
Show resolved Hide resolved
- Statements that are not `SELECT`, `DELETE`, `UPDATE`, `INSERT`, or `REPLACE`
ran-huang marked this conversation as resolved.
Show resolved Hide resolved
- Queries with subqueries
- Queries that access TiFlash
- Queries that join three or more tables

## Execution details of plans

Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.