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?
【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.
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.
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 */);
Confirmed that it cannot be exported, an error will be reported.
MySQL does not have the clustered keyword. You can remove this keyword after exporting from TiDB.
This topic will be automatically closed 60 days after the last reply. No new replies are allowed.