Column groups

Columns of the same table can be grouped to set the following parameters:

  • DATA: A storage device type for the data in this column group. Acceptable values: ssd, rot.

Alert

Supported only for row-oriented tables.

  • COMPRESSION: A data compression codec. Acceptable values: off, lz4, zstd.

Alert

Codec "zstd" is supported only for column-oriented tables.

  • COMPRESSION_LEVEL — compression level of codec if it supports different compression levels.

Alert

Supported only for column-oriented tables.

By default, all columns are in the same group named default. If necessary, the parameters of this group can also be redefined, if they are not redefined, then predefined values are applied.

Example

In the example below, for the created table, the family_large group of columns is added and set for the series_info column, and the parameters for the default group, which is set by default for all other columns, are also redefined.

CREATE TABLE series_with_families (
    series_id Uint64,
    title Utf8,
    series_info Utf8 FAMILY family_large,
    release_date Uint64,
    PRIMARY KEY (series_id),
    FAMILY default (
        DATA = "ssd",
        COMPRESSION = "off"
    ),
    FAMILY family_large (
        DATA = "rot",
        COMPRESSION = "lz4"
    )
);
CREATE TABLE series_with_families (
    series_id Uint64,
    title Utf8,
    series_info Utf8 FAMILY family_large,
    release_date Uint64,
    PRIMARY KEY (series_id),
    FAMILY default (
        COMPRESSION = "lz4"
    ),
    FAMILY family_large (
        COMPRESSION = "zstd",
        COMPRESSION_LEVEL = 5
    )
) 
WITH (STORE = COLUMN);

Note

Available types of storage devices depend on the YDB cluster configuration.

Previous