Skip to content

Commit

Permalink
Recommend RC instead of SQL Priority (#19605) (#19629)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Dec 9, 2024
1 parent 4b9644d commit 813f10f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 1 deletion.
4 changes: 3 additions & 1 deletion faq/sql-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ In addition, you can also use the [SQL binding](/sql-plan-management.md#sql-bind

## How to prevent the execution of a particular SQL statement?

You can create [SQL bindings](/sql-plan-management.md#sql-binding) with the [`MAX_EXECUTION_TIME`](/optimizer-hints.md#max_execution_timen) hint to limit the execution time of a particular statement to a small value (for example, 1ms). In this way, the statement is terminated automatically by the threshold.
For TiDB v7.5.0 or later versions, you can use the [`QUERY WATCH`](/sql-statements/sql-statement-query-watch.md) statement to terminate specific SQL statements. For more details, see [Manage queries that consume more resources than expected (Runaway Queries)](/tidb-resource-control.md#query-watch-parameters).

For versions earlier than TiDB v7.5.0, you can create [SQL bindings](/sql-plan-management.md#sql-binding) with the [`MAX_EXECUTION_TIME`](/optimizer-hints.md#max_execution_timen) hint to limit the execution time of a particular statement to a small value (for example, 1ms). In this way, the statement is terminated automatically by the threshold.

For example, to prevent the execution of `SELECT * FROM t1, t2 WHERE t1.id = t2.id`, you can use the following SQL binding to limit the execution time of the statement to 1ms:

Expand Down
4 changes: 4 additions & 0 deletions sql-statements/sql-statement-insert.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ OnDuplicateKeyUpdate ::=
( 'ON' 'DUPLICATE' 'KEY' 'UPDATE' AssignmentList )?
```

> **Note:**
>
> Starting from v6.6.0, TiDB supports [Resource Control](/tidb-resource-control.md). You can use this feature to execute SQL statements with different priorities in different resource groups. By configuring proper quotas and priorities for these resource groups, you can gain better scheduling control for SQL statements with different priorities. When resource control is enabled, statement priority (`PriorityOpt`) will no longer take effect. It is recommended that you use [Resource Control](/tidb-resource-control.md) to manage resource usage for different SQL statements.
## Examples

```sql
Expand Down
4 changes: 4 additions & 0 deletions sql-statements/sql-statement-replace.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ InsertValues ::=
| 'SET' ColumnSetValue? ( ',' ColumnSetValue )*
```

> **Note:**
>
> Starting from v6.6.0, TiDB supports [Resource Control](/tidb-resource-control.md). You can use this feature to execute SQL statements with different priorities in different resource groups. By configuring proper quotas and priorities for these resource groups, you can gain better scheduling control for SQL statements with different priorities. When resource control is enabled, statement priority (`PriorityOpt`) will no longer take effect. It is recommended that you use [Resource Control](/tidb-resource-control.md) to manage resource usage for different SQL statements.
## Examples

```sql
Expand Down
4 changes: 4 additions & 0 deletions sql-statements/sql-statement-select.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ TableSampleOpt ::=
|`LOCK IN SHARE MODE` | To guarantee compatibility, TiDB parses these three modifiers, but will ignore them. |
| `TABLESAMPLE` | To get a sample of rows from the table. |

> **Note:**
>
> Starting from v6.6.0, TiDB supports [Resource Control](/tidb-resource-control.md). You can use this feature to execute SQL statements with different priorities in different resource groups. By configuring proper quotas and priorities for these resource groups, you can gain better scheduling control for SQL statements with different priorities. When resource control is enabled, statement priority (`HIGH_PRIORITY`) will no longer take effect. It is recommended that you use [Resource Control](/tidb-resource-control.md) to manage resource usage for different SQL statements.
## Examples

### SELECT
Expand Down
4 changes: 4 additions & 0 deletions sql-statements/sql-statement-update.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ TableRefs ::=
EscapedTableRef ("," EscapedTableRef)*
```

> **Note:**
>
> Starting from v6.6.0, TiDB supports [Resource Control](/tidb-resource-control.md). You can use this feature to execute SQL statements with different priorities in different resource groups. By configuring proper quotas and priorities for these resource groups, you can gain better scheduling control for SQL statements with different priorities. When resource control is enabled, statement priority (`LOW_PRIORITY` and `HIGH_PRIORITY`) will no longer take effect. It is recommended that you use [Resource Control](/tidb-resource-control.md) to manage resource usage for different SQL statements.
## Examples

```sql
Expand Down

0 comments on commit 813f10f

Please sign in to comment.