You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pd-configuration-file.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -295,7 +295,7 @@ Configuration items related to scheduling
295
295
296
296
### `max-affinity-merge-region-size` <span class="version-mark">Introduced in versions v8.5.5 and v9.0.0</span>
297
297
298
-
+ Controls the threshold for automatically merging small adjacent Regions that belong to the same [affinity](/table-affinity.md) group. When a Region belongs to an affinity group and its size is less than this configuration value, PD will attempt to merge this Region with other small adjacent Regions within the same affinity group to reduce the number of Regions and maintain the affinity effect.
298
+
+ Controls the threshold for automatically merging small adjacent Regions that belong to the same [affinity](/table-affinity.md) group. When a Region belongs to an affinity group and its size is smaller than this threshold, PD attempts to merge this Region with other small adjacent Regions in the same affinity group to reduce the number of Regions and maintain the affinity effect.
299
299
+ Setting it to `0` disables the automatic merging of small adjacent Regions within an affinity group.
300
300
+ Default value: 256
301
301
+ Unit: MiB
@@ -382,8 +382,8 @@ Configuration items related to scheduling
382
382
383
383
### `affinity-schedule-limit` <span class="version-mark">Introduced in versions v8.5.5 and v9.0.0</span>
384
384
385
-
+ Controls the number of concurrent [affinity](/table-affinity.md) scheduling tasks. Setting it to `0` disables affinity scheduling.
386
-
+ Default value: 0
385
+
+ Controls the number of [affinity](/table-affinity.md) scheduling tasks that can be performed concurrently. Setting it to `0` disables affinity scheduling.
Copy file name to clipboardExpand all lines: sql-statements/sql-statement-alter-table.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,6 +55,7 @@ AlterTableSpec ::=
55
55
| TTLEnable EqOpt ( 'ON' | 'OFF' )
56
56
| TTLJobInterval EqOpt stringLit
57
57
)
58
+
| 'AFFINITY' EqOpt stringLit
58
59
| PlacementPolicyOption
59
60
60
61
PlacementPolicyOption ::=
@@ -182,7 +183,7 @@ The following major restrictions apply to `ALTER TABLE` in TiDB:
182
183
183
184
- Changes of some data types (for example, some TIME, Bit, Set, Enum, and JSON types) are not supported due to the compatibility issues of the `CAST` function's behavior between TiDB and MySQL.
184
185
185
-
-`AFFINITY` option is a TiDB extension syntax. After enabling `AFFINITY`, changing the table's partition scheme (e.g., adding, deleting, reorganizing, or swapping partitions) is not supported. You need to remove `AFFINITY` first.
186
+
-`AFFINITY` option is a TiDB extension syntax. After `AFFINITY` is enabled for a table, modifying the partition scheme (such as adding, dropping, reorganizing, or swapping partitions) of that table is not supported. You need to remove `AFFINITY` first.
Copy file name to clipboardExpand all lines: sql-statements/sql-statement-create-table.md
+15-2Lines changed: 15 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -173,12 +173,25 @@ The following *table_options* are supported. Other options such as `AVG_ROW_LENG
173
173
|`CHARACTER SET`| To specify the [character set](/character-set-and-collation.md) for the table |`CHARACTER SET` = 'utf8mb4' |
174
174
|`COLLATE`| To specify the character set collation for the table |`COLLATE` = 'utf8mb4_bin' |
175
175
|`COMMENT`| The comment information |`COMMENT` = 'comment info' |
176
-
|`AFFINITY`| Enables affinity scheduling for a table or partition. For non-partitioned tables, it can be set to `'table'`; for partitioned tables, it can be set to `'partition'`. Setting it to `'none'` or leaving it empty disables affinity scheduling. |`AFFINITY` = 'table' |
176
+
|`AFFINITY`| Enables affinity scheduling for a table or partition. It can be set to `'table'` for non-partitioned tables and `'partition'` for partitioned tables. Setting it to `'none'` or leaving it empty disables affinity scheduling. |`AFFINITY` = 'table' |
177
+
178
+
<CustomContentplatform="tidb">
177
179
178
180
> **Note:**
179
181
>
180
182
> - The `split-table` configuration option is enabled by default. When it is enabled, a separate Region is created for each newly created table. For details, see [TiDB configuration file](/tidb-configuration-file.md).
181
-
> - When using `AFFINITY`, changing the partitioning scheme of a table (such as adding, deleting, reorganizing, or swapping partitions) is not supported, nor is setting this option on temporary tables or views.
183
+
> - Before using `AFFINITY`, note that modifying the partitioning scheme (such as adding, dropping, reorganizing, or swapping partitions) of a table with affinity enabled is not supported, and configuring `AFFINITY` on temporary tables or views is not supported.
184
+
185
+
</CustomContent>
186
+
187
+
<CustomContentplatform="tidb-cloud">
188
+
189
+
> **Note:**
190
+
>
191
+
> - TiDB creates a separate Region for each newly created table.
192
+
> - Before using `AFFINITY`, note that modifying the partitioning scheme (such as adding, dropping, reorganizing, or swapping partitions) of a table with affinity enabled is not supported, and configuring `AFFINITY` on temporary tables or views is not supported.
Copy file name to clipboardExpand all lines: sql-statements/sql-statement-show-affinity.md
+16-16Lines changed: 16 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,13 @@
1
1
---
2
2
title: SHOW AFFINITY
3
-
summary: Overview of using SHOW AFFINITY in TiDB database.
3
+
summary: An overview of the usage of SHOW AFFINITY for the TiDB database.
4
4
---
5
5
6
-
# SHOW AFFINITY <spanclass="version-mark">Introduced in v8.5.5 and v9.0.0</span>
6
+
# SHOW AFFINITY <spanclass="version-mark">New in v8.5.5 and v9.0.0</span>
7
7
8
-
The `SHOW AFFINITY` statement is used to view the [affinity](/table-affinity.md) scheduling information of tables configured with the `AFFINITY` option, and the target replica distribution currently recorded by PD.
8
+
The `SHOW AFFINITY` statement shows [affinity](/table-affinity.md) scheduling information for tables configured with the `AFFINITY` option, as well as the target replica distribution currently recorded by PD.
9
9
10
-
## Grammar Diagram
10
+
## Synopsis
11
11
12
12
```ebnf+diagram
13
13
ShowAffinityStmt ::=
@@ -18,7 +18,7 @@ ShowAffinityStmt ::=
18
18
19
19
## Examples
20
20
21
-
The following examples create two tables with affinity scheduling enabled and view their scheduling information:
21
+
The following examples create two tables with affinity scheduling enabled and show how to view their scheduling information:
22
22
23
23
```sql
24
24
CREATETABLEt1 (a INT) AFFINITY ='table';
@@ -41,21 +41,21 @@ The example output is as follows:
41
41
42
42
The meaning of each column is as follows:
43
43
44
-
-`Leader_store_id`, `Voter_store_ids`: The TiKV Store IDs where PD records the target Leader replica and Voter replicas for this table or partition. If the affinity group has not yet determined the target replica locations or if [`schedule.affinity-schedule-limit`](/pd-configuration-file.md#affinity-schedule-limit-从-v855-和-v900-版本开始引入) is `0`, it displays as `NULL`.
45
-
-`Status`: Indicates the current status of affinity scheduling. Possible values are:
46
-
-`Pending`: PD has not yet performed affinity scheduling for this table or partition (e.g., when Leader or Voter is not determined).
44
+
-`Leader_store_id`, `Voter_store_ids`: the IDs of TiKV stores recorded by PD, indicating which stores host the target Leader and Voter replicas for the table or partitions. If the target replica locations for the affinity group are not determined, or if [`schedule.affinity-schedule-limit`](/pd-configuration-file.md#affinity-schedule-limit-new-in-v855-and-v900) is set to `0`, the value is displayed as `NULL`.
45
+
-`Status`: indicates the current status of affinity scheduling. Possible values are:
46
+
-`Pending`: PD has not started affinity scheduling for the table or partition, such as when Leaders or Voters are not yet determined.
47
47
-`Preparing`: PD is scheduling Regions to meet affinity requirements.
48
-
-`Stable`: All Regions have reached the target distribution.
49
-
-`Region_count`: The current number of Regions in this affinity group.
50
-
-`Affinity_region_count`: The number of Regions that currently satisfy the affinity replica distribution requirements.
51
-
- When `Affinity_region_count` is less than `Region_count`, it indicates that some Regions have not yet completed replica scheduling based on affinity.
52
-
- When `Affinity_region_count` equals `Region_count`, it indicates that the Region replica migration scheduling based on affinity is complete, meaning that the distribution of all Regions meets the affinity requirements. However, this does not imply that related Region merge operations are complete.
48
+
-`Stable`: all Regions have reached the target distribution.
49
+
-`Region_count`: the current number of Regions in the affinity group.
50
+
-`Affinity_region_count`: the number of Regions that currently meet the affinity replica distribution requirements.
51
+
- When `Affinity_region_count` is less than `Region_count`, it indicates that some Regions have not yet completed affinity-replica scheduling.
52
+
- When `Affinity_region_count` equals `Region_count`, it indicates that affinity-replica scheduling is complete, meaning the distribution of all related Regions meets the affinity requirements. However, it does not indicate that related Region merge operations are completed.
53
53
54
-
## MySQL Compatibility
54
+
## MySQL compatibility
55
55
56
-
This statement is an extension of MySQL syntax by TiDB.
56
+
This statement is a TiDB extension to MySQL syntax.
0 commit comments