Help Center/ GaussDB/ MySQL Compatibility(Centralized)/ Overview/ Overview of M-compatible Mode
Updated on 2025-06-30 GMT+08:00

Overview of M-compatible Mode

M-compatible Mode compares GaussDB in M-compatible mode (sql_compatibility set to 'M') with MySQL 5.7. Only compatibility features added later than GaussDB Kernel 505.1.0 are described. You are advised to view the specifications and restrictions of the features in M Compatibility Developer Guide.

GaussDB is compatible with MySQL in terms of data types, SQL functions, and database objects.

The execution plan, optimization, and EXPLAIN result in GaussDB are different from those in MySQL.

GaussDB and MySQL implement different underlying frameworks. Therefore, there are still some differences between GaussDB and MySQL.

  • The M-compatible mode is recommended because it is more compatible with MySQL in terms of syntax, data types, metadata, and protocols. B-compatible mode is not recommended and will not evolve because it is not compatible with the MySQL architecture.
  • The underlying architecture of GaussDB in M-compatible mode is different from that of MySQL. Therefore, the performance of querying the same schemas under information_schema and m_schema may be different from that in MySQL. For details, see "Schemas" in M Compatibility Developer Guide. For example, the execution of the count function cannot be optimized. The time consumed by the SELECT * and SELECT COUNT(*) statements is similar.

Database and Schema Design

MySQL data objects include database, table, index, view, trigger, and proc, mapping those in GaussDB hierarchically and maybe in a 1:N relationship, as shown in the following figure.

Figure 1 Differences between databases and schemas in MySQL and GaussDB
  • In MySQL, database and schema are synonyms. In GaussDB, a database can have multiple schemas. In this feature, each database in MySQL is mapped to a schema in GaussDB.
  • In MySQL, an index belongs to a table. In GaussDB, an index belongs to a schema. As a result, an index name must be unique in a schema in GaussDB and must be unique in a table in MySQL. This difference will be retained as a current constraint.