Skip to content

Commit

Permalink
faq, sql: Document tidb_force_priority (#645)
Browse files Browse the repository at this point in the history
Add FAQ, server option docs.
  • Loading branch information
morgo authored Oct 12, 2018
1 parent 1a1b2e5 commit 83ffd2b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ When TiDB is executing a SQL statement, the query will be `EXPENSIVE_QUERY` if e

#### How to control or change the execution priority of SQL commits?

TiDB has the following high priority and low priority syntax:
TiDB supports changing the priority on a [per-session](sql/tidb-specific.md#tidb_force_priority), [global](sql/server-command-option.md#force-priority) or [individual statement basis](sql/dml.md). Priority has the following meaning:

- HIGH_PRIORITY: this statement has a high priority, that is, TiDB gives priority to this statement and executes it first.

Expand Down
8 changes: 8 additions & 0 deletions sql/server-command-option.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,14 @@ Same as the "run-ddl" startup option
- Default: true
- When you execute `join` on tables without any conditions on both sides, the statement can be run by default. But if you set the value to `false`, the server does not run such `join` statement.

### force-priority

- The default priority for statements
- Default: `NO_PRIORITY`
- TiDB supports the priorities `NO_PRIORITY` | `LOW_PRIORITY` | `DELAYED` | `HIGH_PRIORITY` for statements. One use case for changing the priority, is you may choose to dedicate a pool of servers for OLAP queries and set the value to `LOW_PRIORITY` to ensure that TiKV servers will provide priority to OLTP workloads which are routed to a different pool of TiDB servers. This helps ensure more uniform OLTP performance at the risk of slightly slower OLAP performance.

TiDB will automatically set table scans to `LOW_PRIORITY` and overwriting priority on a per-statement basis is possible by using the `HIGH PRIORITY` or `LOW PRIORITY` [DML modifier](dml.md).

### join-concurrency

- The goroutine number when the `join-concurrency` runs `join`
Expand Down
7 changes: 7 additions & 0 deletions sql/tidb-specific.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,13 @@ set @@global.tidb_distsql_scan_concurrency = 10
- This variable is used to set the priority of executing the `ADD INDEX` operation in the `re-organize` phase.
- You can set the value of this variable to `PRIORITY_LOW`, `PRIORITY_NORMAL` or `PRIORITY_HIGH`.

### tidb_force_priority

- Scope: SESSION
- Default value: `NO_PRIORITY`
- This variable is used to change the default priority for statements executed on a TiDB server. A use case is to ensure that a particular user that is performing OLAP queries receives lower priority than users performing OLTP queries.
- You can set the value of this variable to `NO_PRIORITY`, `LOW_PRIORITY`, `DELAYED` or `HIGH_PRIORITY`.

## Optimizer Hint

On the basis of MySQL’s `Optimizer Hint` Syntax, TiDB adds some proprietary `Hint` syntaxes. When using the `Hint` syntax, the TiDB optimizer will try to use the specific algorithm, which performs better than the default algorithm in some scenarios.
Expand Down

0 comments on commit 83ffd2b

Please sign in to comment.