From 02ae3160fb0f26665ff9cf92a84d2df430d9b8c6 Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Tue, 2 Jul 2019 20:29:08 +0800 Subject: [PATCH 1/4] v3.0, dev/reference: update the descriptions of compability --- dev/reference/mysql-compatibility.md | 8 +++++--- v3.0/reference/mysql-compatibility.md | 10 +++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/dev/reference/mysql-compatibility.md b/dev/reference/mysql-compatibility.md index 4cc17c8865c96..d5e1395857581 100644 --- a/dev/reference/mysql-compatibility.md +++ b/dev/reference/mysql-compatibility.md @@ -10,6 +10,8 @@ TiDB supports both the MySQL wire protocol and the majority of its syntax. This Currently TiDB Server advertises itself as MySQL 5.7 and works with most MySQL database tools such as PHPMyAdmin, Navicat, MySQL Workbench, mysqldump, and mydumper/myloader. +However, as some features of MySQL are not well implemented in a distributed scenario, TiDB currently does not support these features or, in some way, behaves differently from MySQL. Some syntaxes of MySQL are parsed but ignored in TiDB, such as `Engine` in `Create Table` statement. + > **Note:** > > This page refers to general differences between MySQL and TiDB. Please also see the dedicated pages for [Security](/reference/security/compatibility.md) and [Transaction Model](/reference/transactions/transaction-model.md) compatibility. @@ -23,7 +25,7 @@ Currently TiDB Server advertises itself as MySQL 5.7 and works with most MySQL d + `FOREIGN KEY` constraints + `FULLTEXT` functions and indexes + `SPATIAL` functions and indexes -+ Character sets other than `utf8mb4` ++ Character sets other than `utf8mb4` and `utf8` + Collations other than `BINARY` + Add primary key + Drop primary key @@ -95,7 +97,7 @@ In TiDB DDL does not block reads or writes to tables while in operation. However + Alter Database - Only supports changing the `CHARACTER SET` attribute from `utf8` to `utf8mb4`. + `LOCK [=] {DEFAULT|NONE|SHARED|EXCLUSIVE}`: the syntax is supported, but is not applicable to TiDB. All DDL changes that are supported do not lock the table. -+ `ALGORITHM [=] {DEFAULT|INSTANT|INPLACE|COPY}`: the syntax for `ALGORITHM=INSTANT` and `ALGORITHM=INPLACE` is fully supported, but will work differently than MySQL since some operations that are `INPLACE` in MySQL are `INSTANT` in TiDB. The syntax `ALGORITHM=COPY` is not applicable to TIDB and returns a warning. ++ `ALGORITHM [=] {DEFAULT|INSTANT|INPLACE|COPY}`: the syntax for `ALGORITHM=INSTANT` and `ALGORITHM=INPLACE` is fully supported, but will work differently than MySQL since some operations that are `INPLACE` in MySQL are `INSTANT` in TiDB. The syntax `ALGORITHM=COPY` is not applicable to TIDB and returns a warning. For more information, see [Online Schema Changes](/key-features.md#online-schema-changes). @@ -207,4 +209,4 @@ Because they are built-in, named time zones in TiDB might behave slightly differ #### Zero month and zero day -It is not recommended to unset the `NO_ZERO_DATE` and `NO_ZERO_IN_DATE` SQL modes, which are enabled by default in TiDB as in MySQL. While TiDB supports operating with these modes disabled, the TiKV coprocessor does not. Executing certain statements that push down date and time processing functions to TiKV might result in a statement error. +It is not recommended to unset the `NO_ZERO_DATE` and `NO_ZERO_IN_DATE` SQL modes, which are enabled by default in TiDB as in MySQL. While TiDB supports operating with these modes disabled, the TiKV coprocessor does not. Executing certain statements that push down date and time processing functions to TiKV might result in a statement error. \ No newline at end of file diff --git a/v3.0/reference/mysql-compatibility.md b/v3.0/reference/mysql-compatibility.md index 82cc664d10ff2..c2e44d587f5e5 100644 --- a/v3.0/reference/mysql-compatibility.md +++ b/v3.0/reference/mysql-compatibility.md @@ -2,7 +2,6 @@ title: Compatibility with MySQL summary: Learn about the compatibility of TiDB with MySQL, and the unsupported and different features. category: reference -aliases: ['/docs/sql/mysql-compatibility/'] --- # Compatibility with MySQL @@ -11,6 +10,8 @@ TiDB supports both the MySQL wire protocol and the majority of its syntax. This Currently TiDB Server advertises itself as MySQL 5.7 and works with most MySQL database tools such as PHPMyAdmin, Navicat, MySQL Workbench, mysqldump, and mydumper/myloader. +However, as some features of MySQL are not well implemented in a distributed scenario, TiDB currently does not support these features or, in some way, behaves differently from MySQL. Some syntaxes of MySQL are parsed but ignored in TiDB, such as `Engine` in `Create Table` statement. + > **Note:** > > This page refers to general differences between MySQL and TiDB. Please also see the dedicated pages for [Security](/reference/security/compatibility.md) and [Transaction Model](/reference/transactions/transaction-model.md) compatibility. @@ -24,7 +25,7 @@ Currently TiDB Server advertises itself as MySQL 5.7 and works with most MySQL d + `FOREIGN KEY` constraints + `FULLTEXT` functions and indexes + `SPATIAL` functions and indexes -+ Character sets other than `utf8mb4` ++ Character sets other than `utf8mb4` and `utf8` + Collations other than `BINARY` + Add primary key + Drop primary key @@ -37,7 +38,6 @@ Currently TiDB Server advertises itself as MySQL 5.7 and works with most MySQL d + `CREATE TABLE tblName AS SELECT stmt` syntax + `CREATE TEMPORARY TABLE` syntax + `XA` syntax (TiDB uses a two-phase commit internally, but this is not exposed via an SQL interface) -+ `LOCK TABLE` syntax (TiDB uses `tidb_snapshot` to [produce backups](/reference/tools/mydumper.md)) + `CHECK TABLE` syntax + `CHECKSUM TABLE` syntax + `GET_LOCK` and `RELEASE_LOCK` functions @@ -97,7 +97,7 @@ In TiDB DDL does not block reads or writes to tables while in operation. However + Alter Database - Only supports changing the `CHARACTER SET` attribute from `utf8` to `utf8mb4`. + `LOCK [=] {DEFAULT|NONE|SHARED|EXCLUSIVE}`: the syntax is supported, but is not applicable to TiDB. All DDL changes that are supported do not lock the table. -+ `ALGORITHM [=] {DEFAULT|INSTANT|INPLACE|COPY}`: the syntax for `ALGORITHM=INSTANT` and `ALGORITHM=INPLACE` is fully supported, but will work differently than MySQL since some operations that are `INPLACE` in MySQL are `INSTANT` in TiDB. The syntax `ALGORITHM=COPY` is not applicable to TIDB and returns a warning. ++ `ALGORITHM [=] {DEFAULT|INSTANT|INPLACE|COPY}`: the syntax for `ALGORITHM=INSTANT` and `ALGORITHM=INPLACE` is fully supported, but will work differently than MySQL since some operations that are `INPLACE` in MySQL are `INSTANT` in TiDB. The syntax `ALGORITHM=COPY` is not applicable to TIDB and returns a warning. For more information, see [Online Schema Changes](/key-features.md#online-schema-changes). @@ -203,4 +203,4 @@ Because they are built-in, named time zones in TiDB might behave slightly differ #### Zero month and zero day -It is not recommended to unset the `NO_ZERO_DATE` and `NO_ZERO_IN_DATE` SQL modes, which are enabled by default in TiDB as in MySQL. While TiDB supports operating with these modes disabled, the TiKV coprocessor does not. Executing certain statements that push down date and time processing functions to TiKV might result in a statement error. +It is not recommended to unset the `NO_ZERO_DATE` and `NO_ZERO_IN_DATE` SQL modes, which are enabled by default in TiDB as in MySQL. While TiDB supports operating with these modes disabled, the TiKV coprocessor does not. Executing certain statements that push down date and time processing functions to TiKV might result in a statement error. \ No newline at end of file From 8699d6d95f858d96980b347635be9196dd98ef02 Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Mon, 15 Jul 2019 18:10:23 +0800 Subject: [PATCH 2/4] Apply suggestions from code review Co-Authored-By: Lilian Lee --- dev/reference/mysql-compatibility.md | 4 ++-- v3.0/reference/mysql-compatibility.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dev/reference/mysql-compatibility.md b/dev/reference/mysql-compatibility.md index d5e1395857581..1f1651181d003 100644 --- a/dev/reference/mysql-compatibility.md +++ b/dev/reference/mysql-compatibility.md @@ -10,7 +10,7 @@ TiDB supports both the MySQL wire protocol and the majority of its syntax. This Currently TiDB Server advertises itself as MySQL 5.7 and works with most MySQL database tools such as PHPMyAdmin, Navicat, MySQL Workbench, mysqldump, and mydumper/myloader. -However, as some features of MySQL are not well implemented in a distributed scenario, TiDB currently does not support these features or, in some way, behaves differently from MySQL. Some syntaxes of MySQL are parsed but ignored in TiDB, such as `Engine` in `Create Table` statement. +However, TiDB does not support some of MySQL features or behaves differently from MySQL because these features cannot be easily implemented in a distributed system. For some MySQL syntax, TiDB can parse but does not process it. For example, `Engine` in the `CREATE TABLE` statement can be parsed but is ignored. > **Note:** > @@ -209,4 +209,4 @@ Because they are built-in, named time zones in TiDB might behave slightly differ #### Zero month and zero day -It is not recommended to unset the `NO_ZERO_DATE` and `NO_ZERO_IN_DATE` SQL modes, which are enabled by default in TiDB as in MySQL. While TiDB supports operating with these modes disabled, the TiKV coprocessor does not. Executing certain statements that push down date and time processing functions to TiKV might result in a statement error. \ No newline at end of file +It is not recommended to unset the `NO_ZERO_DATE` and `NO_ZERO_IN_DATE` SQL modes, which are enabled by default in TiDB as in MySQL. While TiDB supports operating with these modes disabled, the TiKV coprocessor does not. Executing certain statements that push down date and time processing functions to TiKV might result in a statement error. diff --git a/v3.0/reference/mysql-compatibility.md b/v3.0/reference/mysql-compatibility.md index c2e44d587f5e5..173d47ede8a1e 100644 --- a/v3.0/reference/mysql-compatibility.md +++ b/v3.0/reference/mysql-compatibility.md @@ -10,7 +10,7 @@ TiDB supports both the MySQL wire protocol and the majority of its syntax. This Currently TiDB Server advertises itself as MySQL 5.7 and works with most MySQL database tools such as PHPMyAdmin, Navicat, MySQL Workbench, mysqldump, and mydumper/myloader. -However, as some features of MySQL are not well implemented in a distributed scenario, TiDB currently does not support these features or, in some way, behaves differently from MySQL. Some syntaxes of MySQL are parsed but ignored in TiDB, such as `Engine` in `Create Table` statement. +However, TiDB does not support some of MySQL features or behaves differently from MySQL because these features cannot be easily implemented in a distributed system. For some MySQL syntax, TiDB can parse but does not process it. For example, `Engine` in the `CREATE TABLE` statement can be parsed but is ignored. > **Note:** > @@ -203,4 +203,4 @@ Because they are built-in, named time zones in TiDB might behave slightly differ #### Zero month and zero day -It is not recommended to unset the `NO_ZERO_DATE` and `NO_ZERO_IN_DATE` SQL modes, which are enabled by default in TiDB as in MySQL. While TiDB supports operating with these modes disabled, the TiKV coprocessor does not. Executing certain statements that push down date and time processing functions to TiKV might result in a statement error. \ No newline at end of file +It is not recommended to unset the `NO_ZERO_DATE` and `NO_ZERO_IN_DATE` SQL modes, which are enabled by default in TiDB as in MySQL. While TiDB supports operating with these modes disabled, the TiKV coprocessor does not. Executing certain statements that push down date and time processing functions to TiKV might result in a statement error. From bf89d2fd0a1c6634211bff34fccc8a7529338e6d Mon Sep 17 00:00:00 2001 From: Lilian Lee Date: Tue, 16 Jul 2019 10:41:09 +0800 Subject: [PATCH 3/4] dev/reference: improve wording --- dev/reference/mysql-compatibility.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/reference/mysql-compatibility.md b/dev/reference/mysql-compatibility.md index 1f1651181d003..ee4607b6a5adb 100644 --- a/dev/reference/mysql-compatibility.md +++ b/dev/reference/mysql-compatibility.md @@ -97,7 +97,7 @@ In TiDB DDL does not block reads or writes to tables while in operation. However + Alter Database - Only supports changing the `CHARACTER SET` attribute from `utf8` to `utf8mb4`. + `LOCK [=] {DEFAULT|NONE|SHARED|EXCLUSIVE}`: the syntax is supported, but is not applicable to TiDB. All DDL changes that are supported do not lock the table. -+ `ALGORITHM [=] {DEFAULT|INSTANT|INPLACE|COPY}`: the syntax for `ALGORITHM=INSTANT` and `ALGORITHM=INPLACE` is fully supported, but will work differently than MySQL since some operations that are `INPLACE` in MySQL are `INSTANT` in TiDB. The syntax `ALGORITHM=COPY` is not applicable to TIDB and returns a warning. ++ `ALGORITHM [=] {DEFAULT|INSTANT|INPLACE|COPY}`: the syntax for `ALGORITHM=INSTANT` and `ALGORITHM=INPLACE` is fully supported, but it works differently from MySQL because some operations that are `INPLACE` in MySQL are `INSTANT` in TiDB. The syntax `ALGORITHM=COPY` is not applicable to TIDB and returns a warning. For more information, see [Online Schema Changes](/key-features.md#online-schema-changes). From e803c246d42a289eb5a5827447ae60099a350779 Mon Sep 17 00:00:00 2001 From: Lilian Lee Date: Tue, 16 Jul 2019 10:42:08 +0800 Subject: [PATCH 4/4] v3.0/reference: improve wording --- v3.0/reference/mysql-compatibility.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v3.0/reference/mysql-compatibility.md b/v3.0/reference/mysql-compatibility.md index 173d47ede8a1e..b9b2a3403827d 100644 --- a/v3.0/reference/mysql-compatibility.md +++ b/v3.0/reference/mysql-compatibility.md @@ -97,7 +97,7 @@ In TiDB DDL does not block reads or writes to tables while in operation. However + Alter Database - Only supports changing the `CHARACTER SET` attribute from `utf8` to `utf8mb4`. + `LOCK [=] {DEFAULT|NONE|SHARED|EXCLUSIVE}`: the syntax is supported, but is not applicable to TiDB. All DDL changes that are supported do not lock the table. -+ `ALGORITHM [=] {DEFAULT|INSTANT|INPLACE|COPY}`: the syntax for `ALGORITHM=INSTANT` and `ALGORITHM=INPLACE` is fully supported, but will work differently than MySQL since some operations that are `INPLACE` in MySQL are `INSTANT` in TiDB. The syntax `ALGORITHM=COPY` is not applicable to TIDB and returns a warning. ++ `ALGORITHM [=] {DEFAULT|INSTANT|INPLACE|COPY}`: the syntax for `ALGORITHM=INSTANT` and `ALGORITHM=INPLACE` is fully supported, but it works differently from MySQL because some operations that are `INPLACE` in MySQL are `INSTANT` in TiDB. The syntax `ALGORITHM=COPY` is not applicable to TIDB and returns a warning. For more information, see [Online Schema Changes](/key-features.md#online-schema-changes).