This topic describes the compatibility between OceanBase Community Edition and native MySQL databases.
OceanBase Community Edition is compatible with most features and syntax and all JSON functions in MySQL 5.7 and some JSON functions in MySQL 8.0. Some features are not supported because of their limited popularity or the product architecture differences between the two databases. This topic describes the differences between OceanBase Database in MySQL mode and native MySQL databases in the following aspects:
Data types
SQL syntax
System views
Character sets and collations
Functions and expressions
Partition support
Backup and recovery
Storage engine
Optimizer
Unsupported features
Data types
OceanBase Database supports the following data types:
Numeric data types
Integer types:
BOOL/BOOLEAN,TINYINT,SMALLINT,MEDIUMINT,INT/INTEGER, andBIGINTFixed-point types:
DECIMALandNUMERICFloating-point types:
FLOATandDOUBLEBit-value type:
BIT
Date and time types:
DATETIME,TIMESTAMP,DATE,TIME, andYEARCharacter types:
CHAR,VARCHAR,BINARY, andVARBINARYLarge object types:
TINYBLOB,BLOB,MEDIUMBLOB, andLONGBLOBText types:
TINYTEXT,TEXT,MEDIUMTEXT, andLONGTEXTEnumeration type:
ENUMCollection type:
SETJSON data types
OceanBase Database does not support spatial data types. However, OceanBase Database supports the same or more data types of other categories than native MySQL databases do.
SQL syntax
SELECT
OceanBase Database supports most query features, including single- and multi-table queries, subqueries, inner-joins, semi-joins, outer-joins, grouping, aggregation, and regular data mining functions such as probability and linear regression functions.
The following set operators can be used to process the results returned by multiple
SELECToperations:UNION,UNION ALL,MINUS,EXCEPT, andINTERSECT.You can use the following syntax to view an execution plan:
EXPLAIN [explain_type] dml_statement; explain_type: BASIC | OUTLINE | EXTENDED | EXTENDED_NOADDR | PARTITIONS | FORMAT = {TRADITIONAL| JSON} dml_statement: SELECT statement | DELETE statement | INSERT statement | REPLACE statement | UPDATE statementSELECT … FOR SHARE …statements are not supported.
INSERT
OceanBase Database supports single- and multi-row insert. It also supports inserting data into a specified partition.
OceanBase Database supports
INSERT INTO … SELECT …statements.OceanBase Database does not support direct INSERT operations on subqueries.
UPDATE
OceanBase Database supports single- and multi-column updates.
OceanBase Database supports updates by using subqueries.
OceanBase Database supports set updates.
OceanBase Database does not support direct UPDATE operations on subqueries.
DELETE
OceanBase Database supports single- and multi-table deletion.
OceanBase Database does not support direct DELETE operations on subqueries.
TRUNCATE
OceanBase Database allows you to truncate a specified table.
OceanBase Database does not support truncating a table that has a transaction in progress or a table that is being locked.
System views
OceanBase Database implements most views of two internal databases, information_schema and mysql. However, due to the differences from MySQL databases in architecture, OceanBase Database cannot implement all views of the databases or ensure consistency with MySQL databases in all column meanings of the views.
Character sets and collations
OceanBase Database is compatible with some character sets and collations of MySQL databases.
Supported character sets: binary, utf8mb4, gbk, utf16, and gb18030.
Supported collations: utf8mb4_general_ci, utf8mb4_bin, binary, gbk_chinese_ci, gbk_bin, utf16_general_ci, utf16_bin, gb18030_chinese_ci, and gb18030_bin.
Functions
OceanBase Community Edition does not support the following functions:
Character string functions:
CHARACTER_LENGTH(),LOAD_FILE(),MATCH(), andOCTET_LENGTH().XML functions:
ExtractValue()andUpdateXML().Lock functions:
GET_LOCK(),IS_FREE_LOCK(),IS_USED_LOCK(),RELEASE_ALL_LOCKS(), andRELEASE_LOCK().Other functions:
MASTER_POS_WAIT()andNAME_CONST().
OceanBase Community Edition does not support spatial analysis functions or performance schema functions. The analytic (window) functions supported by OceanBase Community Edition are a superset of those supported by MySQL databases. This means that OceanBase Database supports all analytic (window) functions supported by MySQL databases.
Partition support
The partition support feature of OceanBase Database is different from that of MySQL databases.
OceanBase Database supports partitioning, template-based subpartitioning, and non-template-based subpartitioning. MySQL databases do not support non-template-based subpartitioning.
OceanBase Database supports subpartitioning by Hash, Key, Range, Range Columns, List, and List Columns. MySQL databases support subpartitioning only by Hash and Key.
Backup and recovery
OceanBase Database is compatible with some backup and recovery features of MySQL databases.
OceanBase Database supports full backup and incremental backup.
OceanBase Database supports hot backup but not cold backup.
Cluster-level backup and recovery are not supported.
OceanBase Database does not support database- or table-level backup or recovery.
OceanBase Database does not support validity verification of backup data.
Storage engine
OceanBase Database uses an LSM-Tree-based storage engine, whereas a MySQL database uses data block-based InnoDB or MyISAM.
Optimizer
The optimizer of OceanBase Database is different from that of MySQL databases in the following aspects:
Commands to query execution plans
Only the
ID,OPERATOR,NAME,EST. ROWS, andCOSTcolumns and the operator details are queried.OceanBase Database does not support using the
SHOW WARNINGSstatement to display additional information.
Statistics query
OceanBase Database supports the
ANALYZE TABLEstatement for querying the histogram statistics about column values in the data dictionary table.You can query the
__all_meta_tableinternal table for statistics information about tables and columns.
Supported query rewrite and optimization features
Outer join optimization
Outer join simplification
Block nested-loop (BNL) and batched key access (BKA) joins
Conditional filtering
Constant folding optimization
IS NULLoptimization (indexes do not storeNULLvalues)ORDER BYoptimizationGROUP BYoptimizationElimination by using
DISTINCTLIMITpushdownAnalytic function optimization
Avoiding full table scan
Predicate pushdown
Optimizer hint mechanisms
Join-order optimizer hints
Table-level optimizer hints
Index-level optimizer hints
OceanBase Database supports
INDEX HINT,FULL HINT,ORDERED HINT, andLEADING HINT, but does not supportUSE INDEXorFORCE INDEX.
OceanBase Database is compatible with the parallel execution capabilities of MySQL databases such as parallel query, parallel replication, and parallel write. OceanBase Database also supports parallel operations such as parallel aggregate, parallel join, parallel grouping, and parallel sorting.
OceanBase Database supports plan caching and precompilation, which are not supported by MySQL databases.
Unsupported features
Spatial data types
SELECT … FOR SHARE …statementsSpatial analysis functions and performance schema functions
Backup and recovery at the database, cluster, or table level, and cold backup and backup validation
Using the
SHOW WARNINGSstatement in the command that returns the execution plan of an SQL statement