v.24.7Experimental Feature
Change Binary Serialization of Variant Data Type to Include Compact Mode
Change binary serialization of theVariantdata type: addcompactmode to avoid writing the same discriminator multiple times for granules with single variant or with only NULL values. Add MergeTree settinguse_compact_variant_discriminators_serializationthat is enabled by default. Note that Variant type is still experimental and backward-incompatible change in serialization is ok. #62774 (Kruglov Pavel).
Why it matters
The feature aims to optimize storage efficiency and improve serialization performance for theVariant data type by avoiding repeated writing of the same discriminator value when it is unnecessary. This reduces data size and overhead when working with granules that have uniform variant types or only NULLs.How to use it
Enable the new serialization mode by setting the MergeTree settinguse_compact_variant_discriminators_serialization to true. This setting is enabled by default in the new version. No additional changes to queries or table definitions are required.