forked from docs/doc-exports
Reviewed-by: Wagner, Fabian <fabian.wagner@t-systems.com> Co-authored-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Co-committed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
9.5 KiB
9.5 KiB
Overview
Global sequences are mainly database-based global sequences.

- The start auto-increment SN can be modified.
- Global sequence provides sequence numbers that are globally unique but may not increase continuously.
Table Type |
Sharded |
Broadcast |
Unsharded |
---|---|---|---|
DB-based |
Supported |
Supported |
Not supported |
Creating an Auto-Increment Sequence
- Log in to the required DDM instance using a client.
- Open the required schema.
- Run the following command to create an auto-increment sequence:
create sequence <seq_name>;
- <seq_name> indicates the sequence name.
- The auto-increment key should be a BIGINT value. To avoid duplicate values, do not use TINYINT, SMALLINT, MEDIUMINT, INTEGER, or INT as the auto-increment key.
- Run show sequences to view the usage of the auto-increment sequence. If the usage reaches 100%, do not insert data anymore.
Dropping an Auto-Increment Sequence
- Log in to the required DDM instance using a client.
- Open the required schema.
- Run show sequences to view all global sequences.
- Run the following command to drop an auto-increment sequence:
drop sequence <seq_name> ;
drop sequence DB.<seq_name>;
Modifying the Start Value of an Auto-Increment Sequence
- Log in to the required DDM instance using a client.
- Open the required schema.
- Run show sequences to view all global sequences.
- Run the command to change the start value:
alter sequence <seq_name> START WITH <start_value>;
Querying an Auto-Increment Sequence
Modifying the Auto-Increment Cache Value
- Log in to the required DDM instance using a client.
- Open the required schema.
- Run command alter sequence test cache 5000 to modify the global sequence cache value of table test.
- Run command show sequences to view the cache value (INCREMENT value) of table test.
Parent topic: Global Sequence