Note
This view is available starting with V4.0.0.
Purpose
This view displays all sequences in the current tenant.
Columns
| Column | Type | Nullable? | Description |
|---|---|---|---|
| SEQUENCE_ID | bigint(20) | NO | The unique ID of the sequence in the current tenant. |
| SCHEMA_VERSION | bigint(20) | NO | The schema version corresponding to the sequence record. |
| DATABASE_ID | bigint(20) | NO | The ID of the database to which the sequence belongs. |
| SEQUENCE_NAME | varchar(128) | NO | The name of the sequence. |
| MIN_VALUE | decimal(28,0) | NO | The minimum value (inclusive) that the sequence can take. |
| MAX_VALUE | decimal(28,0) | NO | The maximum value (inclusive) that the sequence can take. |
| INCREMENT_BY | decimal(28,0) | NO | The step size for each value, which can be a positive or negative integer but cannot be 0. |
| START_WITH | decimal(28,0) | NO | The starting value of the sequence. |
| CACHE_SIZE | decimal(28,0) | NO | The number of cached values on each node. |
| ORDER_FLAG | tinyint(4) | NO | Indicates whether the values are globally ordered. |
| CYCLE_FLAG | tinyint(4) | NO | Indicates whether the sequence can cycle. |
| IS_SYSTEM_GENERATED | tinyint(4) | NO | Indicates whether the sequence is internally generated. Currently, sequences generated by IDENTITY columns set this field to True. |
Sample query
Query all sequences in the current tenant.
obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_SEQUENCE_OBJECTS;
The query result is as follows:
+-------------+------------------+-------------+---------------+-----------+-----------+--------------+------------+------------+------------+------------+---------------------+
| SEQUENCE_ID | SCHEMA_VERSION | DATABASE_ID | SEQUENCE_NAME | MIN_VALUE | MAX_VALUE | INCREMENT_BY | START_WITH | CACHE_SIZE | ORDER_FLAG | CYCLE_FLAG | IS_SYSTEM_GENERATED |
+-------------+------------------+-------------+---------------+-----------+-----------+--------------+------------+------------+------------+------------+---------------------+
| 500058 | 1741936647884232 | 500005 | seq1 | 1 | 10 | 2 | 1 | 30 | 0 | 0 | 0 |
+-------------+------------------+-------------+---------------+-----------+-----------+--------------+------------+------------+------------+------------+---------------------+
1 row in set