This topic describes the general naming conventions for OceanBase Database objects.
When developing a database, it is important to have a unified and standardized naming approach for database objects to enhance readability and make it easier for others to read, understand, and maintain the code. This topic aims to provide developers with some useful naming convention suggestions.
General conventions
The following sections describe the general conventions and precautions for naming objects.
Use consistent character sets for databases and tables, and use consistent character sets for all tables. We recommend that you use the UTF8MB4 character set for all. We do not recommend that you use custom character sets at the table level.
Use unified and standardized naming conventions.
Use full English nouns.
Use standard abbreviations.
Do not use Chinese identifiers.
Avoid using both Pinyin and English in the same object name.
Do not use a series of characters made up of numbers, meaningless letters, underscores (_) or special characters without practical meaning.
Do not use spaces between characters in an object name.
Do not use system reserved words and keywords.
Do not use object names that conflict with database systems or commonly used access methods.
Do not use Pinyin entirely in an object name.
Identifier length limits
MySQL mode
Item Maximum length Cluster name 128 bytes Tenant name 64 bytes Username 64 bytes Database name 128 bytes Table name 64 characters Column name 128 bytes Index name 64 bytes View name 64 bytes Alias 255 bytes Partition name 64 characters Oracle mode
Item Maximum length Cluster name 128 bytes Tenant name 64 bytes Username 64 bytes Table name 128 bytes Column name 128 bytes Index name 128 bytes View name 128 bytes Alias 255 bytes Object name 128 bytes Partition name 64 characters
Maximum number of connections to ODP
| Item | Upper limit |
|---|---|
| Number of connections to an ODP cluster | You can specify the client_max_connections parameter of an ODP cluster to specify the maximum number of connections to the cluster. The default value is 8192.
Note |
Maximum number of partition replicas
| Item | Upper limit |
|---|---|
| Number of partition replicas of an OBServer node | No upper limit.
Note |
Single-table limits
| Item | Upper limit |
|---|---|
| Row length | 1.5 MB |
| Number of columns | 4,096 |
| Number of indexes | 128 |
| Total number of index columns | 512 |
| Index length | 1.5 MB |
| Total number of primary key columns | 64 |
| Primary key length | 16 KB |
| Number of partitions |
|
Single-column limits
| Item | Upper limit |
|---|---|
| Length of an index column | 262,143 bytes |
String type limits
MySQL mode
Item Maximum length CHAR256 bytes VARCHAR1,048,576 bytes BINARY256 bytes VARBINARY1,048,576 bytes BLOB536,870,911 bytes TEXT536,870,911 bytes Oracle mode
Item Maximum length CHAR2,000 bytes VARCHAR32,767 bytes VARCHAR232,767 bytes NCHAR2,000 bytes NVARCHAR232,767 bytes