Updated on 2024-07-30 GMT+08:00

Unavailable Features and Limitations

Unsupported Features

  • Stored procedures
  • Triggers
  • Views
  • Events
  • User-defined functions
  • Foreign key references and associations
  • Full-text indexes and SPACE functions
  • Temporary tables
  • Compound statements such as BEGIN...END, LOOP...END LOOP, REPEAT...UNTIL...END REPEAT, and WHILE...DO...END WHILE
  • Process control statements such as IF and WHILE
  • RESET and FLUSH statements
  • BINLOG statement
  • HANDLER statement
  • INSTALL and UNINSTALL PLUGIN statements
  • Character sets other than ASCII, Latin1, binary, utf8, and utf8mb4
  • SYS schema
  • MySQL Optimizer Trace
  • X-Protocol
  • CHECKSUM TABLE syntax
  • Table maintenance statements, including CHECK, CHECKSUM, OPTIMIZE, and REPAIR TABLE
  • Statements for assigning a value to or querying variable session

    Example:

    set @rowid=0;
    select @rowid:=@rowid+1,id from user;
  • SQL statements that use -- or /.../ to comment out a single line or multiple lines of code
  • Incomplete support for system variable queries. The returned values are variable values of RDS instances, instead of DDM kernel variable values. For example, the returned values of SELECT @@autocommit do not indicate the current transaction status.
  • Executing SET Syntax to modify global variables
  • PARTITION syntax. Partitioned tables are not recommended.
  • LOAD XML statement
  • Inline comments
  • CREATE TABLE AS WITH SELECT syntax
  • ZEROFILL CREATE syntax

Unsupported Operators

  • Assignment operator :=. Executing this operator is allowed. After this operator is executed, it does not take effect even if no errors are reported.
  • Arrow operator ->. This operator can be executing on a single table. Errors will be displayed if the operator is executed on other types of tables.
  • Arrow operator ->>. This operator can be executing on a single table. Errors will be displayed if the operator is executed on other types of tables.
  • Expression IS UNKNOWN
  • Operators =, <, <=, >, >=, <>, !=, <=> that require comparing JSON fields at the DDM compute layer

Unsupported Functions

The DDM compute layer does not support the following functions. Do not use them if you are not sure that they can be pushed down to RDS for execution.

  • XML functions
  • Function ANY_VALUE()
  • Function ROW_COUNT()
  • Function COMPRESS()
  • Function SHA()
  • Function SHA1()
  • Function AES_ENCRYPT()
  • Function AES_DECRYPT()
  • Aggregate function JSON_OBJECTAGG()
  • Aggregate function JSON_ARRAYAGG()
  • Aggregate function STD()
  • Aggregate function STDDEV()
  • Aggregate function STDDEV_POP()
  • Aggregate function STDDEV_SAMP()
  • Aggregate function VAR_POP()
  • Aggregate function VAR_SAMP()
  • Aggregate function VARIANCE()
  • Function MICROSECOND()
  • Function TO_DAYS()
  • Function TO_SECONDS()
  • Function UNCOMPRESS()
  • Function UNCOMPRESSED_LENGTH()
  • Function UNHEX()
  • Function YEARWEEK()
  • Function TIME_FORMAT()

SQL Syntax Limitations

Unsupported SELECT syntax

  • DISTINCTROW
  • Configuring options [HIGH_PRIORITY], [STRAIGHT_JOIN], [SQL_SMALL_RESULT], [SQL_BIG_RESULT], [SQL_BUFFER_RESULT], and [SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS] in SELECT statements on DDM instances
  • SELECT ... GROUP BY ... WITH ROLLUP
  • SELECT ... ORDER BY ... WITH ROLLUP
  • WITH
  • JOIN statements with different collations
  • Window functions
  • SELECT FOR UPDATE supports only simple queries and does not support statements such as JOIN, GROUP BY, ORDER BY, and LIMIT. Option [NOWAIT | SKIP LOCKED] for modifying FOR UPDATE is invalid for DDM.
  • DDM does not support multiple columns with the same name for each SELECT statement in UNION.
    For example, duplicate column names are used in the following SELECT statement:
    SELECT id, id, name FROM t1 UNION SELECT pk, pk, name FROM t2;

SORT and LIMIT

LIMIT/OFFSET, allowed value range: 0–2147483647

Aggregation

Function asc or desc cannot be used in the GROUP BY statement to sort out results.
  • DDM automatically ignores keyword asc or desc after GROUP BY.
  • In MySQL versions earlier than 8.0.13, function asc or desc can be used in the GROUP BY statement to sort out results. In MySQL 8.0.13 or later, a syntax error is reported if you use function asc or desc this way. ORDER BY is recommended for sorting.

Subqueries

  • Subqueries that join grandparent queries are not supported.
  • Subqueries in the HAVING clause and the JOIN ON condition are not supported.
  • Each derived table must have an alias.
  • A derived table cannot be a correlated subquery.

LOAD DATA

  • LOW_PRIORITY is not supported.
  • CONCURRENT is not supported.
  • PARTITION (partition_name [, partition_name] ...) is not supported.
  • LINES STARTING BY 'string' is not supported.
  • User-defined variables are not supported.
  • ESCAPED BY supports only '\\'.
  • If you have not specified a value for your auto-increment key when you insert a data record, DDM will not fill a value for the key. The auto-increment keys of data nodes of a DDM instance all take effect, so the auto-increment key values may be duplicate.
  • If the primary key or unique index is not routed to the same physical table, REPLACE does not take effect.
  • If the primary key or unique index is not routed to the same physical table, IGNORE does not take effect.
  • Executing LOAD DATA statements is not allowed on the tables that contain global secondary indexes.

INSERT and REPLACE

  • INSERT DELAYED is not supported.
  • Only INSERT statements that contain sharding fields are supported.
  • PARTITION syntax is not supported. Partitioned tables are not recommended.
  • Setting YYYY of datetime (in the format of YYYY-MM-DD HH:MM:SS) to 1582 or any value smaller in INSERT statements is not supported.
  • Nesting a subquery in ON DUPLICATE KEY UPDATE of an INSERT statement is not supported. The following is an example:
    INSERT INTO t1(a, b)
    SELECT * FROM(SELECT c, d FROM t2 UNION SELECT e, f FROM t3) AS dtest
    ON DUPLICATE KEY UPDATE b = b + c;

    Subquery c is used in the ON DUPLICATE KEY UPDATE clause.

  • The sharding key values in INSERT and REPLACE statements cannot be DEFAULT.

UPDATE and DELETE

  • Updating a sharding key value to DEFAULT is not supported.
  • Repeatedly updating the same field in one SQL statement is not supported.
  • Updating a sharding key using UPDATE JOIN is not supported. The following is an example:
    UPDATE tbl_1 a, tbl_2 b set a.name=b.name where a.id=b.id;

    name indicates the sharding key of table tbl_1.

  • Updating a sharding key by executing INSERT ON DUPLICATE KEY UPDATE is not supported.
  • Updating self-joins is not supported.
    UPDATE tbl_1 a, tbl_1 b set a.tinyblob_col=concat(b.tinyblob_col, 'aaabbb');
  • Updating sharding keys in subqueries is not allowed for secondary sharded tables that contain JSON fields.
  • UPDATE JOIN supports only joins with WHERE conditions.
    The following is an example:
    UPDATE tbl_3, tbl_4 SET tbl_3.varchar_col='dsgfdg';
  • Referencing other object columns in assignment statements or expressions is not supported when UPDATE JOIN syntax is used. The following is an example:
    UPDATE tbl_1 a, tbl_2 b SET a.name=concat(b.name, 'aaaa'),b.name=concat(a.name, 'bbbb') ON a.id=b.id;
  • You can update a sharding field by two steps: delete the original sharding field and then insert a new field. During this process, the results of querying the sharding fields involved in the target table may be inconsistent.

DDL

  • Modifying database names and sharding field names and types is not allowed.
  • Creating or deleting schemas by executing SQL statements is not supported.
  • Index FULL_TEXT is not supported.
  • AS SELECT clause of the CREATE TABLE statement is not supported.
  • CREATE TABLE ... LIKE statement is not supported.
  • Dropping multiple tables with one SQL statement is not supported.
  • Executing multiple DDL statements at the same time is not supported.
  • Creating foreign keys for broadcast and sharded tables is not supported.
  • Creating tables whose names are prefixed by _ddm is not supported.
  • Creating temporary sharded or broadcast tables is not supported.
  • Specifying globally unique keys in the CREATE TABLE statement is not supported.
  • Modifying global secondary indexes is not supported.

Indexes

  • Global unique indexes are not supported. Unique keys and primary keys may not be globally unique.
  • Values of primary key and sharding key fields cannot exceed the corresponding data range.
  • If you want to use a global secondary index, set sql_mode to STRICT_TRANS_TABLES.

Table Recycle Bins: Unsupported Functions

  • Hints
  • Deleting tables by schema
  • Deleting tables by logical table
  • After a table is recovered, its globally unique sequence increases automatically but may not follow the last sequence value.
  • Shard configuration
  • Retaining copies with no time limit
  • Recovering data to a table with any name
  • Unlimited copies

Transactions: Unsupported Functions

  • Savepoints
  • XA syntax. DDM has implemented distributed transactions through XA, so the user layer does not need to process the syntax.
  • Customizing the isolation level of a transaction. Currently, DDM supports only the READ COMMITTED isolation level. In consideration of compatibility, DDM does not report errors for any SQL statement (such as SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ) to set the database isolation level, but will ignore the modifications to the transaction isolation level.
  • Setting a transaction to read-only (START TRANSACTION READ ONLY). DDM can enable read/write of a transaction, instead of enabling read-only, to ensure compatibility.

Permissions

  • Column-level permissions
  • Subprogram-level permissions

Database Management Statements

  • SHOW TRIGGERS statements are not supported.
  • Most of SHOW statements such as SHOW PROFILES, SHOW ERRORS, and SHOW WARNINGS are not supported.
  • The following SHOW statements are randomly sent to a database shard. If database shards are on different RDS for MySQL instances, the returned variables or table information may be different.
    • SHOW TABLE STATUS
    • SHOW VARIABLES Syntax
    • SHOW WARNINGS Syntax does not support the combination of LIMIT and COUNT.
    • SHOW ERRORS Syntax does not support the combination of LIMIT and COUNT.

INFORMATION_SCHEMA

Only simple queries of SCHEMATA, TABLES, COLUMNS, STATISTICS, and PARTITIONS are supported. No subqueries, JOINs, aggregate functions, ORDER BY, and LIMIT are allowed.

Broadcast Tables

The DDM broadcast table mechanism is that each SQL statement can be executed on all shards of a broadcast table. When you use such a broadcast table, do not use any function that has different results returned each time it is executed. Otherwise, data inconsistency will occur between different broadcast table shards. If such functions are indeed required, calculate their results, write the results to your SQL statements, and then execute the SQL statements on the broadcast table. Functions of this type include but are not limited to the following:

  • CONNECTION_ID()
  • CURDATE()
  • CURRENT_DATE()
  • CURRENT_TIME()
  • CURRENT_TIMESTAMP()
  • CURTIME()
  • LAST_INSERT_ID()
  • LOCALTIME()
  • LOCALTIMESTAMP()
  • NOW()
  • UNIX_TIMESTAMP()
  • UTC_DATE()
  • UTC_TIME()
  • UTC_TIMESTAMP()
  • CURRENT_ROLE()
  • CURRENT_USER()
  • FOUND_ROWS()
  • GET_LOCK()
  • IS_FREE_LOCK()
  • IS_USED_LOCK()
  • JSON_TABLE()
  • LOAD_FILE()
  • MASTER_POS_WAIT()
  • RAND()
  • RELEASE_ALL_LOCKS()
  • RELEASE_LOCK()
  • ROW_COUNT()
  • SESSION_USER()
  • SLEEP()
  • SYSDATE()
  • SYSTEM_USER()
  • USER()
  • UUID()
  • UUID_SHORT()