|
1 | 1 | # MyRocks limitations |
2 | 2 |
|
3 | | -The MyRocks storage engine lacks the following features compared to InnoDB: |
| 3 | +## Online DDL limitations |
4 | 4 |
|
5 | | -* [Online DDL](https://dev.mysql.com/doc/refman/{{vers}}/en/innodb-online-ddl.html) is not supported due to the lack of atomic DDL support. |
| 5 | +MyRocks has limited support for [Online DDL operations](https://dev.mysql.com/doc/refman/{{vers}}/en/innodb-online-ddl.html) due to the lack of [atomic DDL](./glossary.md#atomic-ddl-data-definition-language). As a result the schema changes are more restricted compared to InnoDB. |
6 | 6 |
|
7 | | - * There is no `ALTER TABLE ... ALGORITHM=INSTANT` functionality |
| 7 | +### Traditional MyRocks DDL behavior |
8 | 8 |
|
9 | | - * A partition management operation only supports the `COPY` algorithms, which rebuilds the partition table and moves the data based on the new `PARTITION ... VALUE` definition. In the case of `DROP PARTITION`, the data not moved to another partition is deleted. |
| 9 | +| Operation type | Examples | ALGORITHM | |
| 10 | +|---------------------|--------------------------------------------------|-----------------------------| |
| 11 | +| Index operations | `ADD INDEX`, `DROP INDEX`, `RENAME INDEX` | `INPLACE` (always) | |
| 12 | +| Column changes | `ADD COLUMN`, `DROP COLUMN`, `MODIFY COLUMN` | `COPY` (full table rebuild) | |
| 13 | +| Metadata changes | `RENAME TABLE`, some `RENAME COLUMN` operations | May be `INSTANT` | |
10 | 14 |
|
| 15 | +**Note:** MyRocks does not support [atomic DDL](./glossary.md#atomic-ddl-data-definition-language). Even metadata-only operations may require a full table rebuild, depending on the nature of the change. |
| 16 | + |
| 17 | +### Partition management support |
| 18 | + |
| 19 | +MyRocks supports `INPLACE` partition management for certain operations: |
| 20 | + |
| 21 | +```sql |
| 22 | +ALTER TABLE t1 DROP PARTITION p1, ALGORITHM=INPLACE; |
| 23 | +ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES LESS THAN (MAXVALUE)), ALGORITHM=INPLACE; |
| 24 | +``` |
| 25 | +These operations does not require a full table rebuild. However, operations that modify partitioning schemes, such as changing `VALUES LESS THAN`, fall back to the `COPY` algorithm. |
| 26 | + |
| 27 | +**Note:** Dropping a partition permanently deletes any data stored in it unless that data is reassigned to another partition. |
| 28 | + |
| 29 | +### Instant DDL support |
| 30 | + |
| 31 | +MyRocks provides limited Instant DDL support that is disabled by default, and you can activate the specific instant operations you need by setting the appropriate configuration variables. |
| 32 | + |
| 33 | +| Configuration variable | Enables Instant DDL for | |
| 34 | +|------------------------|--------------------------| |
| 35 | +| [`rocksdb_enable_instant_ddl_for_append_column=ON`](myrocks-server-variables.md#rocksdb_enable_instant_ddl_for_append_column) | `ALTER TABLE ... ADD COLUMN` | |
| 36 | +| [`rocksdb_enable_instant_ddl_for_column_default_changes=ON`](myrocks-server-variables.md#rocksdb_enable_instant_ddl_for_column_default_changes) | `ALTER/MODIFY COLUMN … DEFAULT` | |
| 37 | +| [`rocksdb_enable_instant_ddl_for_drop_index_changes=ON`](myrocks-server-variables.md#rocksdb_enable_instant_ddl_for_drop_index_changes) | `ALTER TABLE ... DROP INDEX` | |
| 38 | +| [`rocksdb_enable_instant_ddl_for_table_comment_changes=ON`](myrocks-server-variables.md#rocksdb_enable_instant_ddl_for_table_comment_changes) | `ALTER TABLE ... COMMENT` | |
| 39 | + |
| 40 | +**Note:** Instant DDL in MyRocks is applied only when **both** of the following conditions are met: |
| 41 | + |
| 42 | +* The configuration variable is set to `ON`. |
| 43 | +* The `ALTER TABLE` statement explicitly includes `ALGORITHM=INSTANT`. |
| 44 | + |
| 45 | +For example: |
| 46 | + |
| 47 | +```sql |
| 48 | +SET GLOBAL rocksdb_enable_instant_ddl_for_table_comment_changes = ON; |
| 49 | +ALTER TABLE my_table COMMENT = 'New comment', ALGORITHM=INSTANT; |
| 50 | +``` |
| 51 | + |
| 52 | +If either condition is missing: |
| 53 | + |
| 54 | +* When the variable is `ON` but `ALGORITHM=INSTANT` is omitted, MyRocks falls back to the default (non‑instant) algorithm. |
| 55 | +* When the variable is `OFF`, any `ALTER TABLE … ALGORITHM=INSTANT` statement fails with an error. |
| 56 | + |
| 57 | +## Unsupported InnoDB features in MyRocks |
11 | 58 |
|
12 | 59 | * [ALTER TABLE .. EXCHANGE PARTITION](https://dev.mysql.com/doc/refman/{{vers}}/en/partitioning-management-exchange.html). |
13 | 60 |
|
|
0 commit comments