This document describes the common usage limitations of TiDB, including the maximum identifier length and the maximum number of supported databases, tables, indexes, partitioned tables, and sequences.
Note
TiDB offers high compatibility with the MySQL protocol and syntax, including many MySQL limitations. For example, a single index can include a maximum of 16 columns. For more information, see MySQL Compatibility and the official MySQL documentation.
Limitations on identifier length
Identifier type
Maximum length (number of characters allowed)
Database
64
Table
64
Column
64
Index
64
View
64
Sequence
64
Limitations on the total number of databases, tables, views, and connections
The maximum index length is 3072 bytes, equivalent to 768 characters using 4-byte UTF-8 encoding. The maximum number of columns in a single index is limited to 16.
You can adjust this limit using the max-index-length configuration item.
Limitations on data types
Type
Upper limit
CHAR
255 characters
BINARY
255 characters
VARBINARY
65535 characters
VARCHAR
16383 characters
TEXT
Defaults to 6 MiB and can be adjusted to 120 MiB
BLOB
Defaults to 6 MiB and can be adjusted to 120 MiB
Limitations on SQL statements
Type
Upper limit
The maximum number of SQL statements in a single transaction
When the optimistic transaction is used and the transaction retry is enabled, the upper limit is 5000.
You can modify the limit via the stmt-count-limit configuration item.
Limitations on TiKV version
In your cluster, if the version of the TiDB component is v6.2.0 or later, the version of TiKV must be v6.2.0 or later.