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
* Added incompatibilities with MySQL
events, sys do not exist
pfs exists but returns empty.
* Changed monitoring to performance metrics
* Improve unsupported features
* Make all items plural
* Improved Clarity
Remove 'the' from Foreign keys / fulltext / spatial indexes
Clarify that it is not non-utf8 characters, but character sets other than utf8.
* utf8 as code
* Added Storage engines to compatibility
* Update mysql-compatibility.md
* Added link to --store
* Add large transactions and EXPLAIN command
* Added Optimizer Trace
To differentiate: TiDB has query-tracing, mysql has optimizer tracing.
* lowercase t
* Include PR605
Add default differences
* lower m
* Fixed spacing
* Addressed PR Feedback
* Addressed PR feedback
Copy file name to clipboardExpand all lines: sql/mysql-compatibility.md
+53-10Lines changed: 53 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,16 +14,19 @@ However, in TiDB, the following MySQL features are not supported for the time be
14
14
15
15
## Unsupported features
16
16
17
-
+ Stored Procedures
18
-
+ View
19
-
+ Trigger
20
-
+ The user-defined functions
21
-
+ The `FOREIGN KEY` constraints
22
-
+ The `FULLTEXT` indexes
23
-
+ The `Spatial` indexes
24
-
+ The Non-UTF-8 characters
17
+
+ Stored procedures and functions
18
+
+ Views
19
+
+ Triggers
20
+
+ Events
21
+
+ User-defined functions
22
+
+`FOREIGN KEY` constraints
23
+
+`FULLTEXT` indexes
24
+
+`SPATIAL` indexes
25
+
+ Character sets other than `utf8`
25
26
+ Add primary key
26
27
+ Drop primary key
28
+
+ SYS schema
29
+
+ Optimizer trace
27
30
28
31
## Features that are different from MySQL
29
32
@@ -50,6 +53,10 @@ The auto-increment ID feature in TiDB is only guaranteed to be automatically inc
50
53
> 1. The client issues the `insert into t values (1, 1)` statement to Instance B which sets the `id` to 1 and the statement is executed successfully.
51
54
> 2. The client issues the `insert into t (c) (1)` statement to Instance A. This statement does not specify the value of `id`, so Instance A allocates the value. Currently, Instances A caches the auto-increment ID of [1, 30000], so it allocates the `id` value to 1 and adds 1 to the local counter. However, at this time the data with the `id` of 1 already exists in the cluster, therefore it reports `Duplicated Error`.
52
55
56
+
### Performance schema
57
+
58
+
Performance schema tables return empty results in TiDB. TiDB uses a combination of [Prometheus and Grafana](https://pingcap.com/docs/op-guide/monitor/#use-prometheus-and-grafana) for performance metrics instead.
59
+
53
60
### Built-in functions
54
61
55
62
TiDB supports most of the MySQL built-in functions, but not all. See [TiDB SQL Grammar](https://pingcap.github.io/sqlgram/#FunctionCallKeyword) for the supported functions.
@@ -83,12 +90,20 @@ TiDB implements the asynchronous schema changes algorithm in F1. The Data Manipu
83
90
+ Rename Table
84
91
+ Create Table Like
85
92
86
-
### Transaction
93
+
### Transaction model
87
94
88
95
TiDB implements an optimistic transaction model. Unlike MySQL, which uses row-level locking to avoid write conflict, in TiDB, the write conflict is checked only in the `commit` process during the execution of the statements like `Update`, `Insert`, `Delete`, and so on.
89
96
90
97
**Note:** On the business side, remember to check the returned results of `commit` because even there is no error in the execution, there might be errors in the `commit` process.
91
98
99
+
### Large transactions
100
+
101
+
Due to the distributed, 2-phase commit requirement of TiDB, large transactions that modify data can be particularly problematic. TiDB intentionally sets some limits on transaction sizes to reduce this impact:
102
+
103
+
* Each Key-Value entry is no more than 6MB
104
+
* The total number of Key-Value entries is no more than 300,000
105
+
* The total size of Key-Value entries is no more than 100MB
106
+
92
107
### Load data
93
108
94
109
+ Syntax:
@@ -106,11 +121,39 @@ TiDB implements an optimistic transaction model. Unlike MySQL, which uses row-le
106
121
+ Transaction
107
122
108
123
When TiDB is in the execution of loading data, by default, a record with 20,000 rows of data is seen as a transaction for persistent storage. If a load data operation inserts more than 20,000 rows, it will be divided into multiple transactions to commit. If an error occurs in one transaction, this transaction in process will not be committed. However, transactions before that are committed successfully. In this case, a part of the load data operation is successfully inserted, and the rest of the data insertion fails. But MySQL treats a load data operation as a transaction, one error leads to the failure of the entire load data operation.
124
+
125
+
### Storage engines
126
+
127
+
For compatibility reasons, TiDB supports the syntax to create tables with alternative storage engines. Metadata commands describe tables as being of engine InnoDB:
Architecturally, TiDB does support a similar storage engine abstraction to MySQL, user tables are be created in the engine specified by the [`--store`](server-command-option.md#--store) option used when starting tidb-server (typically `tikv`).
143
+
144
+
### EXPLAIN
145
+
146
+
The output of the query execution plan returned from the `EXPLAIN` command differs from MySQL. For more information, see [Understand the Query Execution Plan](understanding-the-query-execution-plan.md).
109
147
110
148
### Default differences
111
149
112
-
- Default character set: `latin1` in MySQL 5.7 (UTF-8 in MySQL 8.0), while `utf8mb4` in TiDB.
150
+
- Default character set:
151
+
- The default value in TiDB is `utf8` which is equivalent to `utf8mb4` in MySQL.
152
+
- The default value in MySQL 5.7 is `latin1`, but changes to `utf8mb4` in MySQL 8.0.
113
153
- Default collation: `latin1_swedish_ci` in MySQL 5.7, while `binary` in TiDB.
154
+
- Default SQL mode:
155
+
- The default value in TiDB is `STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION`.
156
+
- The default value in MySQL 5.7 is `ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION`.
114
157
- Default value of `lower_case_table_names`:
115
158
- The default value in TiDB is 2 and currently TiDB only supports 2.
0 commit comments