v.24.4Experimental Feature

Mark Variant Type as Comparable for Primary Key Use

Mark type Variant as comparable so it can be used in primary key. #62693 (Kruglov Pavel).
Mark the Variant data type as comparable, enabling its use in primary keys.

Why it matters

Previously, the Variant type could not be used in primary keys because it was not comparable. This feature allows users to leverage the flexibility of Variant within primary keys, improving indexing and query performance for semi-structured data.

How to use it

Users can now define a table with a primary key that includes columns of type Variant. For example:

CREATE TABLE example (
id UInt64,
data Variant,
PRIMARY KEY (data)
) ENGINE = ...;