Skip to content

YDB DDL Examples

Anton Kovalenko edited this page Apr 24, 2024 · 4 revisions

Create ColumnTable

CREATE TABLE `my_column_table` (
  Key Uint64 not null,
  Value String,
  PRIMARY KEY (Key)
)
PARTITION BY HASH(Key)
WITH (
  STORE = COLUMN,
  AUTO_PARTITIONING_MIN_PARTITIONS_COUNT = 10
);

Add Secondary Index

docs

ALTER TABLE `my_table` ADD INDEX `name_index` GLOBAL ON (`name`);

Create Changefeed (CDC Stream)

docs

ALTER TABLE `my-table` ADD CHANGEFEED `my_cdc` WITH (
    FORMAT = 'JSON',
    MODE = 'UPDATES'
);
Clone this wiki locally