DRDS is highly compatible with the MySQL protocol and the Structured Query Language (SQL) syntax of MySQL. However, some limits are imposed on the SQL statements for Distributed Relational Database Service (DRDS). This is because the architecture of distributed databases differs from that of single-instance databases. This topic describes the limits of SQL statements in DRDS.

General limits on the SQL statements

  • DRDS does not support custom data types or custom functions.
  • DRDS does not support stored procedures, triggers, or cursors.
  • DRDS does not support temporary tables.
  • DRDS does not support compound statements, such as BEGIN...END, LOOP...END LOOP, REPEAT...UNTIL...END REPEAT, and WHILE...DO...END WHILE.
  • DRDS does not support flow control statements, such as IF and WHILE statements.

Limits on the SQL syntax

  • DDL
    • You cannot execute the CREATE TABLE tbl_name LIKE old_tbl_name statement for table sharding.
    • You cannot execute the CREATE TABLE tbl_name SELECT statements for table sharding.
    • You cannot execute the RENAME statement to rename multiple tables at a time.
    • You cannot execute the ALTER TABLE statement to change shard key fields.
    • DRDS does not support data definition language (DDL) operations across schemas, such as CREATE TABLE db_name.tbl_name (...).

    For more information about DDL statements, see DDL.

  • DML
    • DRDS does not support the following statements: SELECT INTO OUTFILE, INTO DUMPFILE, and INTO var_name.
    • DRDS does not support STRAIGHT_JOIN or NATURAL JOIN operations.
    • DRDS does not support subqueries in UPDATE SET clauses.
    • DRDS does not support INSERT DELAYED statements.
    • DRDS does not support variable references and operations in SQL statements. For example, you cannot execute the following statement: SET @c=1, @d=@c+1; SELECT @c, @d.
    • You cannot perform the INSERT, REPLACE, UPDATE, or DELETE operations on broadcast tables in flexible transactions.

    For more information about data manipulation language (DML) statements, see DML.

  • Subqueries
    • DRDS does not support subqueries in HAVING or JOIN ON clauses.
    • DRDS does not support the ROW functions in the scalar subqueries that use equal signs (=) as operators.

    For more information about subqueries, see Subqueries.

  • Database management
    • DRDS does not support the combination of LIMIT and COUNT in SHOW WARNINGS statements.
    • DRDS does not support the combination of LIMIT and COUNT in SHOW ERRORS statements.
  • Operators that are not supported by DRDS

    DRDS does not support the assignment operators ':='

    For more information about operators, see Operators.

  • Functions that are not supported by DRDS

    For more information about functions, see Functions.

  • Keywords that are not supported by DRDS
    • MILLISECOND
    • MICROSECOND