All Products
Search
Document Center

PolarDB:DDL FAQ

Last Updated:Mar 28, 2026

This topic answers common questions about DDL execution errors in PolarDB-X 1.0.

What do I do if a table creation fails?

PolarDB-X 1.0 runs DDL statements in distributed mode across multiple shards. If a failure occurs partway through, some shards may have created the physical tables while others have not, leaving the schema in an inconsistent state. You need to identify the failed shards and manually complete or clean up the operation.

Step 1: Get the error details.

PolarDB-X 1.0 displays basic error information such as syntax errors directly. If the error message is truncated, run SHOW WARNINGS to see the full failure cause for each database shard.

Step 2: Check the physical table topology.

Run SHOW TOPOLOGY to see which physical tables exist and which shards they belong to:

SHOW TOPOLOGY FROM multi_db_multi_tbl;

Expected output:

+------+-----------------+-----------------------+
| ID   | GROUP_NAME      | TABLE_NAME            |
+------+-----------------+-----------------------+
|    0 | corona_qatest_0 | multi_db_multi_tbl_00 |
|    1 | corona_qatest_0 | multi_db_multi_tbl_01 |
|    2 | corona_qatest_0 | multi_db_multi_tbl_02 |
|    3 | corona_qatest_1 | multi_db_multi_tbl_03 |
|    4 | corona_qatest_1 | multi_db_multi_tbl_04 |
|    5 | corona_qatest_1 | multi_db_multi_tbl_05 |
|    6 | corona_qatest_2 | multi_db_multi_tbl_06 |
|    7 | corona_qatest_2 | multi_db_multi_tbl_07 |
|    8 | corona_qatest_2 | multi_db_multi_tbl_08 |
|    9 | corona_qatest_3 | multi_db_multi_tbl_09 |
|   10 | corona_qatest_3 | multi_db_multi_tbl_10 |
|   11 | corona_qatest_3 | multi_db_multi_tbl_11 |
+------+-----------------+-----------------------+
12 rows in set (0.21 sec)

Step 3: Verify the logical table status.

Run CHECK TABLE on the logical table name to confirm its status:

mysql> check table multi_db_multi_tbl;

If a physical table is missing on any shard, the output shows an error for that shard:

+-------------------------------------------------+-------+----------+---------------------------------------------------------------------------+
| TABLE                                           | OP    | MSG_TYPE | MSG_TEXT                                                                  |
+-------------------------------------------------+-------+----------+---------------------------------------------------------------------------+
| andor_mysql_qatest. multi_db_multi_tbl | check | Error    | Table 'corona_qatest_0. multi_db_multi_tbl_02' doesn't exist |
+-------------------------------------------------+-------+----------+---------------------------------------------------------------------------+
1 row in set (0.16 sec)

Step 4: Re-run the DDL in idempotent mode.

Use IF NOT EXISTS or IF EXISTS to safely retry the operation on the remaining physical tables:

-- Re-create missing physical tables
CREATE TABLE IF NOT EXISTS table1
(id int, name varchar(30), primary key(id))
dbpartition by hash(id);

-- Or clean up all physical tables
DROP TABLE IF EXISTS table1;

What do I do if creating an index or adding a column fails?

The same steps apply: run SHOW WARNINGS to get error details, SHOW TOPOLOGY to locate the affected shards, CHECK TABLE to verify the current state, then retry using the idempotent form of the DDL statement.

For a detailed reference, see Troubleshoot DDL exceptions.