Updating a topic

You can use the topic alter subcommand to update a previously created topic.

General format of the command:

ydb [global options...] topic alter [options...] <topic-path>

View the description of the update topic command:

ydb topic alter --help

Parameters of the subcommand

The command changes the values of parameters specified in the command line. The other parameter values remain unchanged.

Name Description
--partitions-count The number of topic partitions. You can only increase the number of partitions.
--retention-period-hours The retention period for topic data, in hours.
--partition-write-speed-kbps The maximum write speed to a partition, specified in KB/s.
The default value is 1024.
--retention-storage-mb The maximum storage size, specified in MB. When the limit is reached, the oldest data will be deleted.
The default value is 0 (no limit).
--supported-codecs Supported data compression methods.
Possible values:
  • RAW: No compression.
  • ZSTD: zstd compression.
  • GZIP: gzip compression.
  • LZOP: lzop compression.
--metering-mode The topic pricing method for a serverless database.
Possible values:
  • request-units: Based on actual usage.
  • reserved-capacity: Based on dedicated resources.

Examples

Note

The examples use the db1 profile. To learn more, see Creating a connection profile.

Add a partition and the lzop compression method to the previously created topic:

ydb -p db1 topic alter \
  --partitions-count 3 \
  --supported-codecs raw,gzip,lzop \
  my-topic

Make sure that the topic parameters have been updated:

ydb -p db1 scheme describe my-topic

Result:

RetentionPeriod: 2 hours
PartitionsCount: 3
SupportedCodecs: RAW, GZIP, LZOP