diff --git a/sql/tidb-server.md b/sql/tidb-server.md index 182628bf04cb4..4f925d4bd38d7 100644 --- a/sql/tidb-server.md +++ b/sql/tidb-server.md @@ -14,7 +14,7 @@ You can set the service parameters using the command line or the configuration f ## TiDB system variable -TiDB is compatible with MySQL system variables, and defines some unique system variables to adjust the database behavior. For more information, see [The Proprietary System Variables and Syntaxes in TiDB](../sql/tidb-specific.md). +TiDB is compatible with MySQL system variables, and defines some unique system variables to adjust the database behavior. For more information, see [TiDB Specific System Variables](../sql/tidb-specific.md). ## TiDB system table diff --git a/sql/tidb-specific.md b/sql/tidb-specific.md index 3a0c426c1cf82..42a6e40d1bc6c 100644 --- a/sql/tidb-specific.md +++ b/sql/tidb-specific.md @@ -8,7 +8,7 @@ category: user guide TiDB contains a number of system variables which are specific to its usage, and **do not** apply to MySQL. These variables start with a `tidb_` prefix, and can be tuned to optimize system performance. -## System variable +## System variables Variables can be set with the `SET` statement, for example: @@ -289,11 +289,11 @@ set @@global.tidb_distsql_scan_concurrency = 10 - 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 +## Optimizer Hints -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. - -The `Hint` syntax is included in comments like `/*+ xxx */`, and in MySQL client versions earlier than 5.7.7, the comment is removed by default. If you want to use the `Hint` syntax in these earlier versions, add the `--comments` option when starting the client. For example: `mysql -h 127.0.0.1 -P 4000 -uroot --comments`. +TiDB supports optimizer hints, based on the comment-like syntax introduced in MySQL 5.7. i.e. `/*+ TIDB_XX(t1, t2) */`. Use of optimizer hints is recommended in cases where the TiDB optimizer selects a less optimal query plan. + +> **Note:** MySQL command-line clients earlier than 5.7.7 strip optimizer hints by default. If you want to use the `Hint` syntax in these earlier versions, add the `--comments` option when starting the client. For example: `mysql -h 127.0.0.1 -P 4000 -uroot --comments`. ### TIDB_SMJ(t1, t2) diff --git a/sql/variable.md b/sql/variable.md index d55ab2a314c1f..a0c30e48a69f7 100644 --- a/sql/variable.md +++ b/sql/variable.md @@ -45,6 +45,6 @@ The following MySQL system variables are fully supported in TiDB and have the sa | tx_isolation | GLOBAL \| SESSION | the isolation level of a transaction | | hostname | NONE | the hostname of the TiDB server | -## The proprietary system variables and syntaxes in TiDB +## TiDB Specific System Variables -See [The Proprietary System Variables and Syntax in TiDB](../sql/tidb-specific.md). +See [TiDB Specific System Variables](../sql/tidb-specific.md).