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

  • Quoted database and table identifiers with Chinese names are supported.

  • ENCRYPTION are currently supported but do not work.

  • ALTER DATABASE is not supported.

  • Only the utf8mb4 character set and utf8mb4_bin collation are supported by default and cannot be changed.

About TABLE

  • ENGINE= in the table definition is not supported.

  • The clauses: CHANGE [COLUMN], MODIFY [COLUMN], RENAME COLUMN, ADD [CONSTRAINT [symbol]] PRIMARY KEY, DROP PRIMARY KEY, and ALTER COLUMN ORDER BY can be freely combined in ALTER TABLE, these are not supported to be used with other clauses for the time being.

  • Temporary tables currently do not support using ALTER TABLE to modify the table structure.

  • Tables created using CREATE TABLE ... CLUSTER BY... do not allow modifications to the table structure using ALTER TABLE.

  • ALTER TABLE does not support PARTITION related operations.

  • Support defining Cluster by column clauses to pre-sort a column to speed up queries.

About VIEW

  • The with check option clause is not supported, but MatrixOne simply ignores’ ENGINE= ‘.

  • View definitions accept DEFINER and SQL SECURITY; view security defaults to DEFINER and supports INVOKER.

About SEQUENCE

  • MySQL does not support SEQUENCE objects, but MatrixOne can create a sequence through CREATE SEQUENCE, and the syntax of MatrixOne is the same as PostgreSQL.

  • When using SEQUENCE in a table, you must pay attention to the auto_increment and sequence cannot 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, and TIME_ZONE.

DML Statements

About SELECT

  • SELECT ... FOR UPDATE is supported for joins, multi-table queries, CTEs, derived tables, EXISTS/IN subqueries, and aggregate queries.

About INSERT

  • MatrixOne does not support modifiers such as LOW_PRIORITY, DELAYED, HIGH_PRIORITY.

About UPDATE

  • MatrixOne does not support the use of LOW_PRIORITY and IGNORE modifiers.

About DELETE

  • MatrixOne does not support modifiers such as LOW_PRIORITY, QUICK, or IGNORE.

About Subqueries

  • Nested correlated IN and NOT IN subqueries are supported, including correlations across three nested levels.

About LOAD

  • MatrixOne supports SET, but only in the form of SET columns_name=nullif(expr1,expr2).

  • MatrixOne supports LOAD DATA LOCAL on the client side, but the --local-infle parameter must be added when connecting.

  • MatrixOne supports the import of JSONlines files but requires some unique syntax.

  • MatrixOne supports importing files from object storage but requires some unique syntax.

About EXPLAIN

  • MatrixOne’s Explain and Explain Analyze printing formats refer to PostgreSQL, which differs from MySQL.

  • JSON-type output is not supported.

other

  • The REPLACE statement supports multi-row VALUES row constructors.

Advanced SQL Features

  • Triggers are not supported.

  • Stored procedures support CREATE PROCEDURE, CALL, and DROP PROCEDURE, including IN, OUT, and INOUT parameters.

  • Event dispatchers are not supported.

  • Materialized views are not supported.

  • SQL-language custom functions are supported, including creation, execution, inspection, and deletion.

Stream Computing

  • Streaming is unique to MatrixOne and currently version 1.2.3 only supports Kafka connectors.

  • Kafka connectors need to be created and used with a special syntax.

Data Types

  • BOOL values accept numeric 0/1 and are returned as 0/1 in compatibility tests.

  • 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) and Double(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: MatrixOne accepts values from '1970-01-01 00:00:01.000000' UTC through '9999-12-31 23:59:59.999999' UTC; earlier values are rejected.

  • MatrixOne supports UUID type.

  • MatrixOne supports vector types.

  • MatrixOne supports datalink type.

  • Spatial types (GEOMETRY, GEOMETRY32) are supported.

  • SET types are supported with documented differences; see SET Type.

  • MEDIUMINT is accepted and mapped to a 32-bit integer type.

Indexes and Constraints

  • MatrixOne supports vector indexing.

  • Secondary indexes can be used for equality, range, IN, and BETWEEN predicates.

  • Foreign keys support ON DELETE CASCADE cascade actions.

Partition Support

  • Supports KEY, HASH, RANGE, RANGE COLUMNS, LIST, LIST COLUMNS.

  • Partition pruning is implemented for KEY, HASH, RANGE, and LIST partitioning.

  • Sub-partitioning only implements the syntax, not the function.

  • ADD/DROP/TRUNCATE PARTITION is not yet supported.

MatrixOne Keywords

Functions and Operators

Aggregate Functions

  • Support MatrixOne-specific Median function.

Date and Time Functions

  • MatrixOne’s TO_DATE function is the same as MySQL’s STR_TO_DATE function.

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, and NTH_VALUE are 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=XXX to change the engine.

Security and Permissions

  • Only using ALTER USER can change the password.

  • Does not support modifying the upper limit of user connections.

  • Connection IP whitelisting is not supported.

  • Does not support LOAD file authorization management.

  • Can support SELECT INTO file authorization management through the CREATE STAGE section.

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 TABLES and UNLOCK TABLES are 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’s default sql_mode includes ERROR_FOR_DIVISION_BY_ZERO, NO_ENGINE_SUBSTITUTION, NO_ZERO_DATE, NO_ZERO_IN_DATE, ONLY_FULL_GROUP_BY, and STRICT_TRANS_TABLES. MatrixOne also supports SQL modes that affect parsing or execution, such as ANSI_QUOTES, PIPES_AS_CONCAT, and strict modes; other accepted mode names are not guaranteed to implement complete MySQL behavior.

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 database provides system tables such as statement_info and log_info.

  • 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.