v.20.11Improvement
Primary Key Specification Enhanced for MergeTree Table Engines
Now it's possible to specifyPRIMARY KEYwithoutORDER BYfor MergeTree table engines family. Closes #15591. #16284 (alesapin).
Why it matters
This feature addresses the limitation where users had to define anORDER BY clause whenever a PRIMARY KEY was specified in MergeTree tables. By decoupling PRIMARY KEY from ORDER BY, it provides more flexibility in table schema design and improves usability, especially for scenarios where sorting is not needed but a primary key is still desired for data organization or uniqueness.How to use it
When creating a MergeTree family table, you can now specifyPRIMARY KEY independently of ORDER BY. For example:CREATE TABLE example (
id UInt32,
value String
) ENGINE = MergeTree()
PRIMARY KEY idHere, no
ORDER BY clause is required, simplifying table definition.