Is it impossible to import a clustered table into MySQL with the statement CREATE TABLE t (a BIGINT PRIMARY KEY CLUSTERED, b VARCHAR(255))?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: CREATE TABLE t (a BIGINT PRIMARY KEY CLUSTERED, b VARCHAR(255))问一下聚簇表是不是无法导入到mysql?

| username: tidb狂热爱好者

【TiDB Usage Environment】Production environment or Test environment or POC
【TiDB Version】6.1
【Encountered Problem】
【Reproduction Path】What operations were performed that caused the problem
【Problem Phenomenon and Impact】
How does CDC handle this MySQL keyword that doesn’t exist?
CREATE TABLE t (a BIGINT PRIMARY KEY CLUSTERED, b VARCHAR(255));
【Attachments】

Please provide the version information of each component, such as cdc/tikv, which can be obtained by executing cdc version/tikv-server --version.

| username: ddhe9527 | Original post link

This syntax does not exist in MySQL. InnoDB tables are always clustered by the primary key. If no primary key is defined, it will generate a hidden primary key to cluster the data, so such syntax is not needed.

| username: xfworld | Original post link

When creating tables in TiDB, these incompatible syntaxes will have comments. You can observe them carefully, so it won’t interfere with synchronization issues.

CREATE TABLE t (a BIGINT PRIMARY KEY /*T![clustered_index] CLUSTERED */, b VARCHAR(255));
CREATE TABLE t (a BIGINT PRIMARY KEY /*T![clustered_index] NONCLUSTERED */, b VARCHAR(255));
CREATE TABLE t (a BIGINT, b VARCHAR(255), PRIMARY KEY(a, b) /*T![clustered_index] CLUSTERED */);
CREATE TABLE t (a BIGINT, b VARCHAR(255), PRIMARY KEY(a, b) /*T![clustered_index] NONCLUSTERED */);
| username: tidb狂热爱好者 | Original post link

Confirmed that it cannot be exported, an error will be reported.

| username: Min_Chen | Original post link

MySQL does not have the clustered keyword. You can remove this keyword after exporting from TiDB.

| username: system | Original post link

This topic will be automatically closed 60 days after the last reply. No new replies are allowed.