v.24.10Improvement
CREATE TABLE AS in ClickHouse Copies Key Clauses
CREATE TABLE ASwill copyPRIMARY KEY,ORDER BY, and similar clauses (ofMergeTreetables). #69739 (sakulali).
Why it matters
This feature simplifies table creation by preserving important table schema elements such as sorting and primary key definitions from an existingMergeTree table. It helps ensure consistency and reduces manual specification errors when duplicating table structures.How to use it
To use this feature, run aCREATE TABLE new_table AS existing_table statement on a MergeTree table. The new table will automatically inherit the PRIMARY KEY, ORDER BY, and similar clauses from the source table.