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

planner: add docs for some variables #9943

Merged
merged 31 commits into from
Aug 18, 2022
Merged
Changes from 30 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
73c22dc
fix ci
qw4990 Aug 3, 2022
d700942
fixup
qw4990 Aug 11, 2022
cbcc7ca
Merge remote-tracking branch 'upstream/master' into vars
qw4990 Aug 11, 2022
ea8e1c2
fixup
qw4990 Aug 11, 2022
aa8d832
fixup
qw4990 Aug 11, 2022
b8aab3e
address comments
qw4990 Aug 15, 2022
ab89763
Update system-variables.md
qw4990 Aug 16, 2022
b77e6c2
Update system-variables.md
qw4990 Aug 16, 2022
fe0b085
Update system-variables.md
qw4990 Aug 16, 2022
a39e5d6
Update system-variables.md
qw4990 Aug 16, 2022
84cd867
Update system-variables.md
qw4990 Aug 16, 2022
59a8c2d
Update system-variables.md
qw4990 Aug 16, 2022
7e8ca88
Update system-variables.md
qw4990 Aug 16, 2022
3b8a5c9
Update system-variables.md
qw4990 Aug 16, 2022
eb3554f
Update system-variables.md
qw4990 Aug 16, 2022
4797be3
Update system-variables.md
qw4990 Aug 16, 2022
ac5fed6
Update system-variables.md
qw4990 Aug 16, 2022
458b49f
Update system-variables.md
qw4990 Aug 16, 2022
8ff4b80
Update system-variables.md
qw4990 Aug 16, 2022
a60c199
Update system-variables.md
qw4990 Aug 16, 2022
9affe1d
Update system-variables.md
qw4990 Aug 16, 2022
0f08d6e
Update system-variables.md
qw4990 Aug 16, 2022
d0f5d3c
Update system-variables.md
qw4990 Aug 16, 2022
4c2d1b7
Update system-variables.md
qw4990 Aug 16, 2022
efae50d
Update system-variables.md
qw4990 Aug 16, 2022
45631c9
Update system-variables.md
qw4990 Aug 16, 2022
7454a40
Apply suggestions from code review
TomShawn Aug 16, 2022
c6d981c
Update system-variables.md
TomShawn Aug 16, 2022
1eac2a8
Update system-variables.md
qw4990 Aug 17, 2022
94a4398
Update system-variables.md
qw4990 Aug 17, 2022
676a458
Apply suggestions from code review
TomShawn Aug 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 132 additions & 0 deletions system-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,38 @@ This variable is an alias for `last_insert_id`.
>
> Unlike in MySQL, the `max_execution_time` system variable currently works on all kinds of statements in TiDB, not only restricted to the `SELECT` statement. The precision of the timeout value is roughly 100ms. This means the statement might not be terminated in accurate milliseconds as you specify.

### max_prepared_stmt_count

- Scope: GLOBAL
- Persists to cluster: Yes
- Type: Integer
- Default value: `-1`
- Range: `[-1, 1048576]`
- Specifies the maximum number of [`PREPARE`](/sql-statements/sql-statement-prepare.md) statements in a session.
- The value of `-1` means no limit on the maximum number of `PREPARE` statements in a session.
- If you set the variable to a value that exceeds the upper limit `1048576`, `1048576` is used instead:

```sql
mysql> SET GLOBAL max_prepared_stmt_count=1048577;
TomShawn marked this conversation as resolved.
Show resolved Hide resolved
Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql> SHOW WARNINGS;
+---------+------+--------------------------------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------------------------------+
| Warning | 1292 | Truncated incorrect max_prepared_stmt_count value: '1048577' |
+---------+------+--------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> SHOW GLOBAL VARIABLES LIKE 'max_prepared_stmt_count';
+-------------------------+---------+
| Variable_name | Value |
+-------------------------+---------+
| max_prepared_stmt_count | 1048576 |
+-------------------------+---------+
1 row in set (0.00 sec)
```

### plugin_dir

- Scope: GLOBAL
Expand Down Expand Up @@ -1053,6 +1085,14 @@ Constraint checking is always performed in place for pessimistic transactions (d
- Since v6.1.0, the [Join Reorder](/join-reorder.md) algorithm of TiDB supports Outer Join. This variable controls the support behavior, and the default value is `ON`.
- For a cluster upgraded from a version earlier than v6.1.0, the default value is still `TRUE`.

### tidb_enable_ordered_result_mode

- Scope: SESSION | GLOBAL
- Persists to cluster: Yes
- Default value: `OFF`
- Specifies whether to sort the final output result automatically.
- For example, with this variable enabled, TiDB processes `SELECT a, MAX(b) FROM t GROUP BY a` as `SELECT a, MAX(b) FROM t GROUP BY a ORDER BY a, MAX(b)`.

### tidb_enable_paging <span class="version-mark">New in v5.4.0</span>

- Scope: SESSION | GLOBAL
Expand Down Expand Up @@ -1724,6 +1764,35 @@ For a system upgraded to v5.0 from an earlier version, if you have not modified
- This variable is used to set whether the optimizer executes the optimization operation of pushing down the aggregate function to the position before Join, Projection, and UnionAll.
- When the aggregate operation is slow in query, you can set the variable value to ON.

### tidb_opt_cartesian_bcj
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect variable name. Fixed in #10782


- Scope: SESSION | GLOBAL
- Persists to cluster: YES
- Type: Integer
- Default value: `1`
- Range: `[0, 2]`
- Indicates whether to allow the Broadcast Cartesian Join.
- `0` means that the Broadcast Cartesian Join is not allowed. `1` means that it is allowed based on [`tidb_broadcast_join_threshold_count`](#tidb_broadcast_join_threshold_count-new-in-v50). `2` means that it is always allowed even if the table size exceeds the threshold.
- This variable is internally used in TiDB, and it is not recommended to modify its value.
TomShawn marked this conversation as resolved.
Show resolved Hide resolved

### tidb_opt_concurrency_factor

- Scope: SESSION | GLOBAL
- Persists to cluster: YES
- Type: Float
- Range: `[0, 2147483647]`
- Default value: `3.0`
- Indicates the CPU cost of starting a Golang goroutine in TiDB. This variable is internally used in the [Cost Model](/cost-model.md), and it is not recommended to modify its value.
TomShawn marked this conversation as resolved.
Show resolved Hide resolved

### tidb_opt_cop_cpu_factor
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect variable name. Fixed in #10782


- Scope: SESSION | GLOBAL
- Persists to cluster: YES
- Type: Float
- Range: `[0, 2147483647]`
- Default value: `3.0`
- Indicates the CPU cost for TiKV Coprocessor to process one row. This variable is internally used in the [Cost Model](/cost-model.md), and it is not recommended to modify its value.
TomShawn marked this conversation as resolved.
Show resolved Hide resolved

### tidb_opt_correlation_exp_factor

- Scope: SESSION | GLOBAL
Expand All @@ -1746,6 +1815,33 @@ For a system upgraded to v5.0 from an earlier version, if you have not modified
- Range: `[0, 1]`
- This variable is used to set the threshold value that determines whether to enable estimating the row count by using column order correlation. If the order correlation between the current column and the `handle` column exceeds the threshold value, this method is enabled.

### tidb_opt_cpu_factor

- Scope: SESSION | GLOBAL
- Persists to cluster: YES
- Type: Float
- Range: `[0, 2147483647]`
- Default value: `3.0`
- Indicates the CPU cost for TiDB to process one row. This variable is internally used in the [Cost Model](/cost-model.md), and it is not recommended to modify its value.
TomShawn marked this conversation as resolved.
Show resolved Hide resolved

### tidb_opt_desc_scan_factor
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect variable name. Fixed in #10782


- Scope: SESSION | GLOBAL
- Persists to cluster: YES
- Type: Float
- Range: `[0, 2147483647]`
- Default value: `3.0`
- Indicates the cost for TiKV to scan one row from the disk in descending order. This variable is internally used in the [Cost Model](/cost-model.md), and it is not recommended to modify its value.
TomShawn marked this conversation as resolved.
Show resolved Hide resolved

### tidb_opt_disk_factor

- Scope: SESSION | GLOBAL
- Persists to cluster: YES
- Type: Float
- Range: `[0, 2147483647]`
- Default value: `1.5`
- Indicates the I/O cost for TiDB to read or write one byte of data from or to the temporary disk. This variable is internally used in the [Cost Model](/cost-model.md), and it is not recommended to modify its value.
TomShawn marked this conversation as resolved.
Show resolved Hide resolved

### tidb_opt_distinct_agg_push_down

- Scope: SESSION
Expand Down Expand Up @@ -1825,6 +1921,15 @@ mysql> desc select count(distinct a) from test.t;
- This variable is used to set the threshold that determines whether to push the Limit or TopN operator down to TiKV.
- If the value of the Limit or TopN operator is smaller than or equal to this threshold, these operators are forcibly pushed down to TiKV. This variable resolves the issue that the Limit or TopN operator cannot be pushed down to TiKV partly due to wrong estimation.

### tidb_opt_memory_factor

- Scope: SESSION | GLOBAL
- Persists to cluster: YES
- Type: Float
- Range: `[0, 2147483647]`
- Default value: `0.001`
- Indicates the memory cost for TiDB to store one row. This variable is internally used in the [Cost Model](/cost-model.md), and it is not recommended to modify its value.
TomShawn marked this conversation as resolved.
Show resolved Hide resolved

### tidb_opt_mpp_outer_join_fixed_build_side <span class="version-mark">New in v5.1.0</span>

- Scope: SESSION | GLOBAL
Expand All @@ -1833,6 +1938,15 @@ mysql> desc select count(distinct a) from test.t;
- Default value: `ON`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect default value. Fixed in #10782.

- Specifies whether to allow using outer table as the build side in outer join for TiFlash.

### tidb_opt_network_factor

- Scope: SESSION | GLOBAL
- Persists to cluster: YES
- Type: Float
- Range: `[0, 2147483647]`
- Default value: `1.0`
- Indicates the net cost of transferring 1 byte of data through the network. This variable is internally used in the [Cost Model](/cost-model.md), and it is not recommended to modify its value.
TomShawn marked this conversation as resolved.
Show resolved Hide resolved

### tidb_opt_prefer_range_scan <span class="version-mark">New in v5.0</span>

- Scope: SESSION | GLOBAL
Expand Down Expand Up @@ -1874,6 +1988,24 @@ explain select * from t where age=5;
- Default value: `OFF`
- Specifies whether to allow the optimizer to push `Projection` down to the TiKV or TiFlash coprocessor.

### tidb_opt_scan_factor

- Scope: SESSION | GLOBAL
- Persists to cluster: YES
- Type: Float
- Range: `[0, 2147483647]`
- Default value: `1.5`
- Indicates the cost for TiKV to scan one row of data from the disk in ascending order. This variable is internally used in the [Cost Model](/cost-model.md), and it is not recommended to modify its value.
TomShawn marked this conversation as resolved.
Show resolved Hide resolved

### tidb_opt_seek_factor

- Scope: SESSION | GLOBAL
- Persists to cluster: YES
- Type: Float
- Range: `[0, 2147483647]`
- Default value: `20`
- Indicates the start-up cost for TiDB to request data from TiKV. This variable is internally used in the [Cost Model](/cost-model.md), and it is not recommended to modify its value.
TomShawn marked this conversation as resolved.
Show resolved Hide resolved

### tidb_opt_skew_distinct_agg <span class="version-mark">New in v6.2.0</span>

> **Note:**
Expand Down