Global Sequence
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.
- Global sequences of global and sharded tables can either be configured on the DDM console during table creation, or specified in the CREATE TABLE statement on a client.
| Table Type | Sharded Table | Broadcast Table | Unsharded Table |
|---|---|---|---|
| DB-based | Supported | Supported | Not supported |
Creating an Auto-Increment Sequence
- Connect to the target DDM instance using a client.
- Open the target schema.
- Run the following command to create an auto-increment sequence:
create sequence xxxxx ;
- xxxxx indicates the sequence name.
Deleting an Auto-Increment Sequence
- Connect to the target DDM instance using a client.
- Open the target schema.
- Run show sequences to view all global sequences.
- Run the following command to delete an auto-increment sequence:
drop sequence xxxxx ;
drop sequence DB.xxx;
- The sequence name is case-insensitive.
- If an auto-increment sequence is inherent to a table, the sequence cannot be deleted.
Modifying the Start Value of an Auto-Increment Global Sequence
- Connect to the target DDM instance using a client.
- Open the target schema.
- Run show sequences to view all global sequences.
- Run the command to change the start value:
alter sequence xxxxx START WITH yyyyy;
- xxxxx indicates the sequence name.
- yyyyy indicates the start value of the target sequence.
Querying an Auto-Increment Sequence
- Connect to the target DDM instance using a client.
- Open the target schema.
- Run the following command to view all global sequences:
show sequences;

Last Article: Setting a Hint to Skip the Cached Execution Plan
Next Article: Using NEXTVAL and CURRVAL to Query Global Sequence Numbers
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.