MySQL Compatibility¶
This documentation primarily introduces the compatibility comparison information between the MySQL mode of MatrixOne database and the native MySQL database.
MatrixOne is highly compatible with the MySQL 8.0 protocol and commonly used features and syntax of MySQL 8.0. Additionally, MatrixOne provides support for commonly used MySQL-related tools, including Navicat, MySQL Workbench, JDBC, etc. However, due to the different technical architecture of MatrixOne and its ongoing development and improvement, some functionalities are not yet supported. This section will mainly discuss the differences between the MySQL mode of MatrixOne database and the native MySQL database from the following aspects:
DDL Statements
DCL Statements
DML Statements
Advanced SQL Features
Data Types
Indexes and Constraints
Partition
Functions and Operators
Storage Engine
Transaction
Security and Permissions
Backup and Restore
System Variables
Programming Language
Peripheral Tools
DDL statements¶
About DATABASE¶
A database with a Chinese name is not supported.
ENCRYPTIONare currently supported but do not work.ALTER DATABASEsupports only MatrixOne-specific settings; general MySQLALTER DATABASEoptions are not supported.Only the
utf8mb4character set andutf8mb4_bincollation are supported by default and cannot be changed.
About TABLE¶
ENGINE=in the table definition is syntactically accepted and ignored; MatrixOne uses TAE exclusively.Multiple
ALTER TABLEoperations can be combined, butDROP PRIMARY KEYcannot be combined withRENAME COLUMN,CHANGE COLUMN, orDROP COLUMN;DROP PRIMARY KEYwithADD COLUMNorMODIFY COLUMNis supported.Temporary tables currently do not support using
ALTER TABLEto modify the table structure.Tables created using
CREATE TABLE ... CLUSTER BY...do not allow modifications to the table structure usingALTER TABLE.ALTER TABLEdoes not supportPARTITIONrelated operations.Support defining
Cluster by columnclauses to pre-sort a column to speed up queries.
About VIEW¶
The
WITH CHECK OPTIONclause is syntactically accepted but not enforced.The
DEFINERandSQL SECURITYclauses are not supported.
About SEQUENCE¶
MySQL does not support
SEQUENCEobjects, but MatrixOne can create a sequence throughCREATE SEQUENCE, and the syntax of MatrixOne is the same as PostgreSQL.When using
SEQUENCEin a table, you must pay attention to theauto_incrementandsequencecannot be used together; otherwise, an error will be occured.
DCL Statement¶
About ACCOUNT¶
Multi Account is a unique function of MatrixOne, including related statements such as
CREATE/ALTER/DROP ACCOUNT.
About Permission¶
GRANT, authorization logic is different from MySQL.REVOLE, the recovery logic is different from MySQL.
About SHOW¶
MatrixOne does not support performing SHOW operations on certain objects, including
TRIGGER,FUNCTION,EVENT,PROCEDURE,ENGINE, and so on.Due to architectural differences, MatrixOne has implemented some SHOW commands solely for syntactic compatibility; these commands will not produce any output, such as
SHOW STATUS/PRIVILEGES, etc.Although some commands have the same syntax as MySQL, their results differ significantly from MySQL due to different implementations. These commands include
SHOW GRANTS,SHOW ERRORS,SHOW PROCESSLIST,SHOW VARIABLES.For the purpose of its own management, MatrixOne offers several unique SHOW commands such as
SHOW BACKEND SERVERS,SHOW ACCOUNTS,SHOW ROLES,SHOW NODE LIST, and others.
About SET¶
The system variables in MatrixOne differ significantly from MySQL, with most only providing syntactic compatibility. The parameters that can be set at present include:
ROLE,SQL_MODE, andTIME_ZONE.
DML Statements¶
About SELECT¶
SELECT...FOR UPDATEonly supports single-table queries.
About INSERT¶
MatrixOne does not support modifiers such as
LOW_PRIORITY,DELAYED,HIGH_PRIORITY.
About UPDATE¶
LOW_PRIORITYandIGNOREmodifiers are syntactically accepted but ignored.
About DELETE¶
LOW_PRIORITY,QUICK, andIGNOREmodifiers are syntactically accepted but ignored.
About Subqueries¶
INsubqueries, including nested forms, are supported.
About LOAD¶
MatrixOne supports
SET, but only in the form ofSET columns_name=nullif(expr1,expr2).MatrixOne supports
LOAD DATA LOCALon the client side, but the--local-infileparameter must be added when connecting.MatrixOne supports the import of
JSONlinesfiles but requires some unique syntax.MatrixOne supports importing files from object storage but requires some unique syntax.
About EXPLAIN¶
MatrixOne’s
ExplainandExplain Analyzeprinting formats refer to PostgreSQL, which differs from MySQL.JSON-type output is not supported.
other¶
The
REPLACEstatement does not support aWHEREclause.
Advanced SQL Features¶
Triggers are not supported.
Stored procedures are supported with MatrixOne-specific syntax; MySQL procedure bodies may require adaptation.
Event dispatchers are not supported.
Materialized views are not supported.
Custom functions are supported in SQL and Python, with usage differing significantly from MySQL.
Stream Computing¶
Streaming is unique to MatrixOne; v4.2.4 supports Kafka connectors.
Kafka connectors need to be created and used with a special syntax.
Data Types¶
BOOL: Different from MySQL’s Boolean value type, which is int, MatrixOne’s
Booleanvalue is a new type whose value can only beTrueorFalse.DECIMAL:
DECIMAL(P, D), the maximum precision of both P and D in MatrixOne is 65 digits; MySQL supports maximum precision of 65 for P and 30 for D.Float numbers: The usage of
Float(M,D)andDouble(M,D)is discarded after MySQL 8.0.17, but MatrixOne still retains this usage.DATETIME: The maximum value range of MySQL is
'1000-01-01 00:00:00'to'9999-12-31 23:59:59', and the maximum range of MatrixOne is'0001-01-01 00:00:00'to'9999-12-31 23:59:59'.TIMESTAMP: The maximum value range of MySQL is
'1970-01-01 00:00:01.000000'UTC to'2038-01-19 03:14:07.999999'UTC, the maximum range of MatrixOne is'0001-01-01 00:00:00'UTC to'9999-12-31 23:59:59'UTC.MatrixOne supports
UUIDtype.MatrixOne supports vector types.
MatrixOne supports datalink type.
Spatial types (
GEOMETRY,GEOMETRY32) are supported.SETtypes are supported with documented differences; see SET Type.MEDIUMINTis accepted for compatibility and treated asINT.
Indexes and Constraints¶
MatrixOne supports vector indexing.
Secondary indexes are supported by the optimizer and can accelerate eligible queries; effectiveness depends on the query predicates and index definition.
Foreign keys support
ON DELETE CASCADEcascade actions.
Partition Support¶
Supports KEY, HASH, RANGE, RANGE COLUMNS, LIST, LIST COLUMNS.
Supports KEY, HASH two kinds of partition cropping, the other four are not yet realized.
Sub-partitioning only implements the syntax, not the function.
ADD/DROP/TRUNCATE PARTITION is not yet supported.
MatrixOne Keywords¶
MatrixOne and MySQL keywords have many differences, see MatrixOne Keywords.
Functions and Operators¶
Aggregate Functions¶
Support MatrixOne-specific Median function.
Date and Time Functions¶
MatrixOne’s
TO_DATEfunction is the same as MySQL’sSTR_TO_DATEfunction.
CAST Function¶
The type conversion rules are pretty different from MySQL; see CAST.
Window functions¶
Window functions including
RANK,DENSE_RANK,ROW_NUMBER,NTILE,CUME_DIST,PERCENT_RANK,LAG,LEAD,FIRST_VALUE,LAST_VALUE, andNTH_VALUEare supported.
JSON functions¶
JSON_EXTRACT,JSON_UNQUOTE,JSON_QUOTE,JSON_KEYS,JSON_LENGTH,JSON_ARRAY,JSON_OBJECT,JSON_PRETTY,JSON_TYPE,JSON_VALID,JSON_VALUE,JSON_SCHEMA_VALID, and other JSON functions are supported.
System Management functions¶
CURRENT_ROLE_NAME(),CURRENT_ROLE(),CURRENT_USER_NAME(),CURRENT_USER(),PURGE_LOG()are supported.
TAE Storage Engine¶
MatrixOne’s TAE storage engine is independently developed and does not support MySQL’s InnoDB, MyISAM, or other engines.
There is only a TAE storage engine in MatrixOne; there is no need to use
ENGINE=XXXto change the engine.
Security and Permissions¶
Only using
ALTER USERcan change the password.Does not support modifying the upper limit of user connections.
Connection IP whitelisting is not supported.
Does not support
LOADfile authorization management.Can support
SELECT INTOfile authorization management through theCREATE STAGEsection.
Transaction¶
MatrixOne defaults to pessimistic transactions with Read Committed isolation. Optimistic transactions with Snapshot Isolation are also supported.
different from MySQL, DDL statements in MatrixOne are transactional, and DDL operations can be rolled back within a transaction.
SET operations within a transaction are not allowed in MatrixOne.
Table-level locks with
LOCK TABLESandUNLOCK TABLESare supported.
Backup and Restore¶
Support for physical backups based on the mobackup tool.
Snapshot backup support
The mysqldump backup tool is not supported, only the mo-dump tool.
Binlog log backup is not supported.
System variables¶
MatrixOne’s lower_case_table_names has 2 modes, default is 1.
MatrixOne supports a subset of MySQL
sql_modevalues; the default includesONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES, and other modes.
System Tables¶
MatrixOne’s system tables have their own unique system tables, but also take into account MySQL’s system tables as a whole.
The default mysql and information_schema libraries in MatrixOne are compatible with the MySQL usage model.
The system_metrics system library in MatrixOne collects and stores a range of runtime status monitoring data for MatrixOne services.
The system library in MatrixOne collects statements and system logs executed by users and systems in MatrixOne.
The mo_catalog system library in MatrixOne stores various database objects and metadata in MatrixOne.
Programming language¶
Java, Python, C#, Golang connectors, and ORM are basically supported, and connectors and ORMs in other languages may encounter compatibility issues.
Other support tools¶
Navicat, DBeaver, MySQL Workbench, and HeidiSQL are basically supported, but the support for table design functions could be better due to the incomplete ability of ALTER TABLE.
The xtrabackup backup tool is not supported.