From 2e5c6c7da2fe637fd2dec8c0808f0fa32035ff44 Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Thu, 4 Oct 2018 23:15:58 +0000 Subject: [PATCH 1/7] Documented force-priority option. --- FAQ.md | 2 +- sql/server-command-option.md | 8 ++++++++ sql/tidb-specific.md | 6 ++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/FAQ.md b/FAQ.md index 2e5b069f999f5..af528cfd35a72 100644 --- a/FAQ.md +++ b/FAQ.md @@ -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. diff --git a/sql/server-command-option.md b/sql/server-command-option.md index ed72ef6022202..e318cc473d1d0 100644 --- a/sql/server-command-option.md +++ b/sql/server-command-option.md @@ -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 `LOW_PRIORITY`, `NO_PRIORITY`, `HIGH_PRIORITY` and `DELAYED` for statements. One use case for changing the priority, is you may choose to dedicated 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. + +Note that 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](sql/dml.md). + ### join-concurrency - The goroutine number when the `join-concurrency` runs `join` diff --git a/sql/tidb-specific.md b/sql/tidb-specific.md index 3e5d8a718d9fc..2337745f2b372 100644 --- a/sql/tidb-specific.md +++ b/sql/tidb-specific.md @@ -282,6 +282,12 @@ 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 | GLOBAL +- 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 (or TiDB server) that is performing OLAP queries receives lower priority than users performing OLTP queries. + ## 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. From 05ce0ac4f32fdfc18ae7c2070d5094c3182b194d Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Thu, 4 Oct 2018 16:20:51 -0700 Subject: [PATCH 2/7] Added possible values --- sql/tidb-specific.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/tidb-specific.md b/sql/tidb-specific.md index 2337745f2b372..48297b712b17e 100644 --- a/sql/tidb-specific.md +++ b/sql/tidb-specific.md @@ -285,8 +285,9 @@ set @@global.tidb_distsql_scan_concurrency = 10 ### tidb_force_priority - Scope: SESSION | GLOBAL -- Default value: NO_PRIORITY +- 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 (or TiDB server) that is performing OLAP queries receives lower priority than users performing OLTP queries. +- You can set the value of this variable to `PRIORITY_LOW`, `NO_PRIORITY` or `PRIORITY_HIGH`. ## Optimizer Hint From 40fdc90729f568a6dae669aa350153f6e54cdf55 Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Thu, 4 Oct 2018 16:24:22 -0700 Subject: [PATCH 3/7] fixed broken link --- sql/server-command-option.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/server-command-option.md b/sql/server-command-option.md index e318cc473d1d0..a541388865def 100644 --- a/sql/server-command-option.md +++ b/sql/server-command-option.md @@ -163,7 +163,7 @@ Same as the "run-ddl" startup option - Default: `NO_PRIORITY` - TiDB supports the priorities `LOW_PRIORITY`, `NO_PRIORITY`, `HIGH_PRIORITY` and `DELAYED` for statements. One use case for changing the priority, is you may choose to dedicated 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. -Note that 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](sql/dml.md). +Note that 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 From 4b78666d325084e569164d343de890a68ad59598 Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Thu, 4 Oct 2018 16:26:07 -0700 Subject: [PATCH 4/7] Fixed broken link --- FAQ.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FAQ.md b/FAQ.md index af528cfd35a72..2373a40907d9f 100644 --- a/FAQ.md +++ b/FAQ.md @@ -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 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: +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. From 0e6a7301c2e72ddf99dfda4fe1077af981c3473e Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Mon, 8 Oct 2018 02:03:07 -0700 Subject: [PATCH 5/7] Update tidb-specific.md --- sql/tidb-specific.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/tidb-specific.md b/sql/tidb-specific.md index 48297b712b17e..e5de9979364c1 100644 --- a/sql/tidb-specific.md +++ b/sql/tidb-specific.md @@ -284,9 +284,9 @@ set @@global.tidb_distsql_scan_concurrency = 10 ### tidb_force_priority -- Scope: SESSION | GLOBAL +- 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 (or TiDB server) that is performing OLAP queries receives lower priority than users performing OLTP queries. +- 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 `PRIORITY_LOW`, `NO_PRIORITY` or `PRIORITY_HIGH`. ## Optimizer Hint From c29e5fd784f8f4fa54c12d1ed62a93a43510aa68 Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Mon, 8 Oct 2018 14:07:20 +0000 Subject: [PATCH 6/7] Addressed reviewer feedback --- FAQ.md | 2 +- sql/server-command-option.md | 4 ++-- sql/tidb-specific.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/FAQ.md b/FAQ.md index 2373a40907d9f..1639390e2f9c8 100644 --- a/FAQ.md +++ b/FAQ.md @@ -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 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: +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. diff --git a/sql/server-command-option.md b/sql/server-command-option.md index a541388865def..dfa501286e7ca 100644 --- a/sql/server-command-option.md +++ b/sql/server-command-option.md @@ -161,9 +161,9 @@ Same as the "run-ddl" startup option - The default priority for statements - Default: `NO_PRIORITY` -- TiDB supports the priorities `LOW_PRIORITY`, `NO_PRIORITY`, `HIGH_PRIORITY` and `DELAYED` for statements. One use case for changing the priority, is you may choose to dedicated 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 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. -Note that 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). +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 diff --git a/sql/tidb-specific.md b/sql/tidb-specific.md index e5de9979364c1..76ed097b27723 100644 --- a/sql/tidb-specific.md +++ b/sql/tidb-specific.md @@ -287,7 +287,7 @@ set @@global.tidb_distsql_scan_concurrency = 10 - 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 `PRIORITY_LOW`, `NO_PRIORITY` or `PRIORITY_HIGH`. +- You can set the value of this variable to `NO_PRIORITY`, `LOW_PRIORITY`, `DELAYED` or `HIGH_PRIORITY`. ## Optimizer Hint From 0492492bb69c844dd252fb04681cf67fce871e98 Mon Sep 17 00:00:00 2001 From: Morgan Tocker Date: Thu, 11 Oct 2018 15:49:38 +0000 Subject: [PATCH 7/7] Addressed PR feedback --- sql/server-command-option.md | 4 ++-- sql/tidb-specific.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sql/server-command-option.md b/sql/server-command-option.md index dfa501286e7ca..851da50497797 100644 --- a/sql/server-command-option.md +++ b/sql/server-command-option.md @@ -161,9 +161,9 @@ Same as the "run-ddl" startup option - 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 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). +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 diff --git a/sql/tidb-specific.md b/sql/tidb-specific.md index 76ed097b27723..bf79439f6fc69 100644 --- a/sql/tidb-specific.md +++ b/sql/tidb-specific.md @@ -286,7 +286,7 @@ set @@global.tidb_distsql_scan_concurrency = 10 - 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. +- 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