Skip to main content

4.1 Compatibility between OceanBase Database and MySQL

To migrate or synchronize data between heterogeneous databases, you need to first learn about the compatibility between these databases in terms of, for example, data types, character sets, collations, and indexes. Data migration or synchronization between incompatible databases will inevitably fail. That is why you need to grasp features and characteristics of source databases, and check whether they are compatible with destination databases before migration, and if not, whether other better alternatives are available. This topic describes the compatibility between OceanBase Database V4.2.1 and MySQL 8.x. You can check the compatibility between OceanBase Database and other databases by referring to this topic.

OceanBase Database in MySQL mode is compatible with most features and statements of MySQL 5.7 or 8.0. In this topic, differences between OceanBase Database in MySQL mode and native MySQL are described in the following aspects: data types, strings, procedural language (PL) features, system views, character sets, collations, indexes, SQL_MODE, partitions, and backup and restore.

Note

For information about compatibility between OceanBase Database of other versions and MySQL, see Compatibility with MySQL in OceanBase Database documentation of the target versions.

Data types

OceanBase Database supports all data types of MySQL except the SERIAL type.

Length comparison of string types

TypeMySQL 8.0OceanBase Database V4.2.1
CHAR255 characters256 characters
VARCHAR65,535 characters (around 16,383 characters in fact)262,144 characters
BINARY255 bytes256 bytes
VARBINARY65,535 bytes (around 65,532 characters in fact)1,048,576 bytes
TINYBLOB255 bytes255 bytes
BLOB65,535 bytes65,536 bytes
MEDIUMBLOB16,777,215 bytes16,777,216 bytes
LONGBLOB4,294,967,295 bytes (4 GB)536,870,911 bytes
TINYTEXT255 bytes255 bytes
TEXT65,535 bytes65,536 bytes
MEDIUMTEXT16,777,215 bytes6,777,216 bytes
LONGTEXT4,294,967,295 bytes (4 GB)536,870,911 bytes

PL features

OceanBase Database Community Edition is compatible with most PL features of MySQL. For more information, see PL reference.

OceanBase Database supports the following PL features:

  • Data types

  • Stored procedures

  • Custom functions

  • Triggers

  • Exception handling

OceanBase Database also provides particular MySQL PL packages, such as DBMS_RESOURCE_MANAGER, DBMS_STATS, DBMS_UDR, DBMS_XPLAN and DBMS_WORKLOAD_REPOSITORY.

System views

OceanBase Database implements most views of two internal databases: information_schema and mysql. However, due to the differences from MySQL in architecture, OceanBase Database cannot implement all the views of MySQL or ensure consistency with MySQL in definitions of all columns in the views.

For more information about the columns in system views, see Overview.

Character sets and collations

This section describes only the character sets and collations supported by OceanBase Database Community Edition V4.2.1.

Notice

The supported character sets and collations may vary in different versions. If you use OceanBase Database Community Edition of a version other than V4.2.1, run the show charset and show collation commands to view the supported character sets and collations.

The following table describes the character sets and collations supported by OceanBase Database Community Edition.

Character setCollationDescription
utf8mb4utf8mb4_general_ciA general collation.
utf8mb4utf8mb4_binA binary collation.
binarybinaryA binary collation.
gbkgbk_chinese_ciA collation for Chinese.
gbkgbk_binA binary collation.
utf16utf16_general_ciA general collation.
utf16utf16_binA binary collation.
gb18030gb18030_chinese_ciA collation for Chinese.
gb18030gb18030_binA binary collation.
latin1latin1_swedish_ciA collation for Swedish/Finnish.
latin1latin1_binA binary collation.
gb18030_2022gb18030_2022_binA binary collation.
gb18030_2022gb18030_2022_chinese_ciA Pinyin collation for Chinese. The collation is case-insensitive. This is the default collation for this character set in MySQL mode.
gb18030_2022gb18030_2022_chinese_csA Pinyin collation for Chinese. The collation is case-sensitive.
gb18030_2022gb18030_2022_radical_ciA radical stroke collation for Chinese. The collation is case-insensitive.
gb18030_2022gb18030_2022_radical_csA radical stroke collation for Chinese. The collation is case-sensitive.
gb18030_2022gb18030_2022_stroke_ciA stroke collation for Chinese. The collation is case-insensitive.
gb18030_2022gb18030_2022_stroke_csA stroke collation for Chinese. The collation is case-sensitive.

For more information about character sets and collations, see Character set and collation.

Indexes

The following table describes index types that are supported in MySQL but not in OceanBase Database.

Index typeIndex data structureMySQLOceanBase Database
Index extensionB-treeSupportedNot supported
Descending indexB-treeSupportedNot supported
Full-text indexB-treeSupportedNot supported
HASH indexB-treeSupportedNot supported
LOCK option/SupportedNot supported
Index mergeB-treeSupportedNot supported

For more information about indexes, see Indexes.

SQL_MODE

OceanBase Database V4.2.1 supports all SQL_MODE values that are supported by MySQL. For more information, see sql_mode.

Partitions

The partition support feature of OceanBase Database is different from that of MySQL.

  • OceanBase Database supports partitioning, template-based subpartitioning, and non-template-based subpartitioning. MySQL does not support non-template-based subpartitioning.

  • OceanBase Database supports the following subpartitioning methods: HASH, KEY, RANGE, RANGE COLUMNS, LIST, and LIST COLUMNS. MySQL supports only HASH and KEY subpartitioning.

For more information, see Create and manage partitions.

Backup and restore

OceanBase Database is compatible with some backup and restore features of MySQL. For example, OceanBase Database supports the following features:

  • Full backup and incremental backup.

  • Hot backup.

  • Table-level restore.

OceanBase Database does not support the following features:

  • Cluster-level backup or restore.

  • Cold backup.

  • Validation of backup data.

  • Backup or restore for some databases within tenants.

Loading...