From 4845ae3a9b971a797ae5f4cd3156cb143ee3caee Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Mon, 5 Aug 2024 17:18:43 +0800 Subject: [PATCH 1/6] add five restrictions on partitioned tables --- partitioned-table.md | 6 ++++++ sql-statements/sql-statement-create-table.md | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/partitioned-table.md b/partitioned-table.md index 5c1f6ac2e3ca1..aa3643fa8f207 100644 --- a/partitioned-table.md +++ b/partitioned-table.md @@ -1450,6 +1450,12 @@ Partition selection is supported for all types of table partitioning, including This section introduces some restrictions and limitations on partitioned tables in TiDB. +- Using the [`ALTER TABLE ... CHANGE COLUMN`](/sql-statements/sql-statement-change-column.md) statement to change column types of partitioned tables is not supported. +- [Temporary tables](/temporary-tables.md) in TiDB are **NOT** compatible with partitioned tables. +- Using the `ALTER TABLE t ADD PARTITION` statement to set partitioned tables to [cached tables](/cached-tables.md) is not supported. +- Creating a [foreign key](/foreign-key.md) on a partitioned table is not supported. +- The [ORDER_INDEX(t1_name, idx1_name [, idx2_name ...])](/optimizer-hints.md#order_indext1_name-idx1_name--idx2_name-) hint does not work for partitioned tables and their related indexes, because indexes on partitioned tables cannot be read in order. + ### Partitioning keys, primary keys and unique keys This section discusses the relationship of partitioning keys with primary keys and unique keys. The rule governing this relationship can be expressed as follows: **Every unique key on the table must use every column in the table's partitioning expression**. This also includes the table's primary key, because it is by definition a unique key. diff --git a/sql-statements/sql-statement-create-table.md b/sql-statements/sql-statement-create-table.md index 88e99d12f7821..0f67daea63a23 100644 --- a/sql-statements/sql-statement-create-table.md +++ b/sql-statements/sql-statement-create-table.md @@ -255,7 +255,7 @@ mysql> DESC t1; * The `[ASC | DESC]` in `index_col_name` is currently parsed but ignored (MySQL 5.7 compatible behavior). * The `COMMENT` attribute does not support the `WITH PARSER` option. * TiDB supports 1017 columns in a single table by default and 4096 columns at most. The corresponding number limit in InnoDB is 1017 columns, and the hard limit in MySQL is 4096 columns. For details, see [TiDB Limitations](/tidb-limitations.md). -* For partitioned tables, only Range, Hash and Range Columns (single column) are supported. For details, see [partitioned table](/partitioned-table.md). +* TiDB supports `HASH`, `RANGE`, `LIST`, and `KEY` partitioning types. For an unsupported partition type, TiDB returns `Warning: Unsupported partition type %s, treat as normal table`, where `%s` is the specific unsupported partition type. ## See also From 8ccca8717b867f6209e4c81079187465f22e3af2 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Mon, 5 Aug 2024 17:26:24 +0800 Subject: [PATCH 2/6] Update partitioned-table.md --- partitioned-table.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/partitioned-table.md b/partitioned-table.md index aa3643fa8f207..48460b362a4af 100644 --- a/partitioned-table.md +++ b/partitioned-table.md @@ -1451,8 +1451,8 @@ Partition selection is supported for all types of table partitioning, including This section introduces some restrictions and limitations on partitioned tables in TiDB. - Using the [`ALTER TABLE ... CHANGE COLUMN`](/sql-statements/sql-statement-change-column.md) statement to change column types of partitioned tables is not supported. +- Using the `ALTER TABLE t CACHE` statement to set partitioned tables to [cached tables](/cached-tables.md) is not supported. - [Temporary tables](/temporary-tables.md) in TiDB are **NOT** compatible with partitioned tables. -- Using the `ALTER TABLE t ADD PARTITION` statement to set partitioned tables to [cached tables](/cached-tables.md) is not supported. - Creating a [foreign key](/foreign-key.md) on a partitioned table is not supported. - The [ORDER_INDEX(t1_name, idx1_name [, idx2_name ...])](/optimizer-hints.md#order_indext1_name-idx1_name--idx2_name-) hint does not work for partitioned tables and their related indexes, because indexes on partitioned tables cannot be read in order. From fad80f447b35e30c4f1278068aeef92d1a40edd8 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Mon, 5 Aug 2024 17:30:48 +0800 Subject: [PATCH 3/6] Update partitioned-table.md --- partitioned-table.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/partitioned-table.md b/partitioned-table.md index 48460b362a4af..08e0ade36cf13 100644 --- a/partitioned-table.md +++ b/partitioned-table.md @@ -1451,7 +1451,7 @@ Partition selection is supported for all types of table partitioning, including This section introduces some restrictions and limitations on partitioned tables in TiDB. - Using the [`ALTER TABLE ... CHANGE COLUMN`](/sql-statements/sql-statement-change-column.md) statement to change column types of partitioned tables is not supported. -- Using the `ALTER TABLE t CACHE` statement to set partitioned tables to [cached tables](/cached-tables.md) is not supported. +- Using the [`ALTER TABLE t CACHE`](/cached-tables.md) statement to set partitioned tables to cached tables is not supported. - [Temporary tables](/temporary-tables.md) in TiDB are **NOT** compatible with partitioned tables. - Creating a [foreign key](/foreign-key.md) on a partitioned table is not supported. - The [ORDER_INDEX(t1_name, idx1_name [, idx2_name ...])](/optimizer-hints.md#order_indext1_name-idx1_name--idx2_name-) hint does not work for partitioned tables and their related indexes, because indexes on partitioned tables cannot be read in order. From ba07bea787fd5d7428f43df199f88cd5a4e397d4 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Mon, 5 Aug 2024 17:32:04 +0800 Subject: [PATCH 4/6] Update partitioned-table.md --- partitioned-table.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/partitioned-table.md b/partitioned-table.md index 08e0ade36cf13..2cc72d5c4909e 100644 --- a/partitioned-table.md +++ b/partitioned-table.md @@ -1451,7 +1451,7 @@ Partition selection is supported for all types of table partitioning, including This section introduces some restrictions and limitations on partitioned tables in TiDB. - Using the [`ALTER TABLE ... CHANGE COLUMN`](/sql-statements/sql-statement-change-column.md) statement to change column types of partitioned tables is not supported. -- Using the [`ALTER TABLE t CACHE`](/cached-tables.md) statement to set partitioned tables to cached tables is not supported. +- Using the [`ALTER TABLE ... CACHE`](/cached-tables.md) statement to set partitioned tables to cached tables is not supported. - [Temporary tables](/temporary-tables.md) in TiDB are **NOT** compatible with partitioned tables. - Creating a [foreign key](/foreign-key.md) on a partitioned table is not supported. - The [ORDER_INDEX(t1_name, idx1_name [, idx2_name ...])](/optimizer-hints.md#order_indext1_name-idx1_name--idx2_name-) hint does not work for partitioned tables and their related indexes, because indexes on partitioned tables cannot be read in order. From 3819da3489b2f9a245ae2600817a2581e3948713 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Mon, 5 Aug 2024 17:37:24 +0800 Subject: [PATCH 5/6] Update partitioned-table.md --- partitioned-table.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/partitioned-table.md b/partitioned-table.md index 2cc72d5c4909e..aa3476a79165f 100644 --- a/partitioned-table.md +++ b/partitioned-table.md @@ -1454,7 +1454,7 @@ This section introduces some restrictions and limitations on partitioned tables - Using the [`ALTER TABLE ... CACHE`](/cached-tables.md) statement to set partitioned tables to cached tables is not supported. - [Temporary tables](/temporary-tables.md) in TiDB are **NOT** compatible with partitioned tables. - Creating a [foreign key](/foreign-key.md) on a partitioned table is not supported. -- The [ORDER_INDEX(t1_name, idx1_name [, idx2_name ...])](/optimizer-hints.md#order_indext1_name-idx1_name--idx2_name-) hint does not work for partitioned tables and their related indexes, because indexes on partitioned tables cannot be read in order. +- The [`ORDER_INDEX(t1_name, idx1_name [, idx2_name ...])`](/optimizer-hints.md#order_indext1_name-idx1_name--idx2_name-) hint does not work for partitioned tables and their related indexes, because indexes on partitioned tables cannot be read in order. ### Partitioning keys, primary keys and unique keys From 0e66c48d6eedc79d3c9bf872bd8bd8025fdff884 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Tue, 6 Aug 2024 14:09:46 +0800 Subject: [PATCH 6/6] Update sql-statements/sql-statement-create-table.md --- sql-statements/sql-statement-create-table.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-create-table.md b/sql-statements/sql-statement-create-table.md index 0f67daea63a23..f09faf30d171e 100644 --- a/sql-statements/sql-statement-create-table.md +++ b/sql-statements/sql-statement-create-table.md @@ -255,7 +255,7 @@ mysql> DESC t1; * The `[ASC | DESC]` in `index_col_name` is currently parsed but ignored (MySQL 5.7 compatible behavior). * The `COMMENT` attribute does not support the `WITH PARSER` option. * TiDB supports 1017 columns in a single table by default and 4096 columns at most. The corresponding number limit in InnoDB is 1017 columns, and the hard limit in MySQL is 4096 columns. For details, see [TiDB Limitations](/tidb-limitations.md). -* TiDB supports `HASH`, `RANGE`, `LIST`, and `KEY` partitioning types. For an unsupported partition type, TiDB returns `Warning: Unsupported partition type %s, treat as normal table`, where `%s` is the specific unsupported partition type. +* TiDB supports `HASH`, `RANGE`, `LIST`, and `KEY` [partitioning types](/partitioned-table.md#partitioning-types). For an unsupported partition type, TiDB returns `Warning: Unsupported partition type %s, treat as normal table`, where `%s` is the specific unsupported partition type. ## See also