This topic describes the supported conversion scope of CREATE TABLE DDL operations for creating partitions during data migration from a MySQL database to a MySQL-compatible tenant of OceanBase Database.
Syntax
partition_options:
PARTITION BY
{ [LINEAR] HASH(expr)
| [LINEAR] KEY [ALGORITHM={1 | 2}] (column_list)
| RANGE{(expr) | COLUMNS(column_list)}
| LIST{(expr) | COLUMNS(column_list)} }
[PARTITIONS num]
[SUBPARTITION BY
{ [LINEAR] HASH(expr)
| [LINEAR] KEY [ALGORITHM={1 | 2}] (column_list) }
[SUBPARTITIONS num]
]
[(partition_definition [, partition_definition] ...)]
partition_definition:
PARTITION partition_name
[VALUES
{LESS THAN {(expr | value_list) | MAXVALUE}
|
IN (value_list)}]
[[STORAGE] ENGINE [=] engine_name]
[COMMENT [=] 'string' ]
[DATA DIRECTORY [=] 'data_dir']
[INDEX DIRECTORY [=] 'index_dir']
[MAX_ROWS [=] max_number_of_rows]
[MIN_ROWS [=] min_number_of_rows]
[TABLESPACE [=] tablespace_name]
[(subpartition_definition [, subpartition_definition] ...)]
subpartition_definition:
SUBPARTITION logical_name
[[STORAGE] ENGINE [=] engine_name]
[COMMENT [=] 'string' ]
[DATA DIRECTORY [=] 'data_dir']
[INDEX DIRECTORY [=] 'index_dir']
[MAX_ROWS [=] max_number_of_rows]
[MIN_ROWS [=] min_number_of_rows]
[TABLESPACE [=] tablespace_name]
Supported operations
Create RANGE, LIST, HASH, or KEY partitions.
Create HASH or KEY subpartitions.
Specify a function partition key (an expression or a function) or a column partition key (a field) for RANGE, LIST, and HASH partitions. Specify a column partition key for KEY partitions.
Specify the PARTITIONS num and SUBPARTITIONS num options.
Unsupported operations
Create LINEAR HASH or LINEAR KEY partitions.
Warning
If the synchronized DDL statement for creating a partition contains unsupported definitions, the partition definition generated will be empty, but the table schema is retained (with the partition definition discarded).
Ignored clauses and options
Note
The following clauses and options will be ignored and will not be resolved or converted when they are specified in the synchronized DDL statements.
ENGINE
COMMENT
DATA DIRECTORY
INDEX DIRECTORY
MAX_ROWS
MIN_ROWS
TABLESPACE
ALGORITHM (for KEY partitions)
PARTITION BY KEY ALGORITHM={1 | 2} (column_list) -> PARTITION BY KEY (column_list)
Limitations
Notice
Due to the limitations of OceanBase Database's MySQL compatible mode, if the following scenarios exist, the synchronized DDL may encounter errors when executed in OceanBase Database's MySQL compatible mode, despite being successfully converted.
OceanBase Database MySQL compatible mode does not support certain field types as partition keys.
OceanBase Database MySQL compatible mode does not support certain functions or expressions as partition keys.