CONVERT SEQUENCES

更新时间:
复制 MD 格式

Converts all sequences of a specific type to another type, either across an entire instance or within a single logical database.

Syntax

CONVERT ALL SEQUENCES FROM <source_type> TO <target_type>
[ FOR <database_name> ]

Parameters

ParameterDescription
source_typeThe current sequence type. Valid values: NEW, GROUP, TIME.
target_typeThe target sequence type. Valid values: NEW, GROUP, TIME.
database_nameThe name of the logical database to convert. Optional. If omitted, all sequences of source_type in every logical database in the current instance are converted.

Usage notes

  • Sequence conversion is exclusive: no other operations can be performed on the affected sequences while conversion is in progress.

  • Run conversions during off-peak hours or at a time when your application does not need to generate sequence values.

  • To prevent duplicate values after conversion, PolarDB-X automatically assigns new start values to all converted sequences.

Examples

Convert all NEW sequences in every logical database in the current instance to GROUP sequences:

CONVERT ALL SEQUENCES FROM NEW TO GROUP;

Convert all NEW sequences in the product database to GROUP sequences:

CONVERT ALL SEQUENCES FROM NEW TO GROUP FOR product;