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 can be taken by the sequence. |
| MAX_VALUE | decimal(28,0) | NO | The maximum value (inclusive) that can be taken by the sequence. |
| INCREMENT_BY | decimal(28,0) | NO | The step size for each value taken. It 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 per node. |
| ORDER_FLAG | tinyint(4) | NO | Whether the values are guaranteed to be globally ordered. |
| CYCLE_FLAG | tinyint(4) | NO | Whether the sequence can cycle through values. |
| IS_SYSTEM_GENERATED | tinyint(4) | NO | Whether the sequence is internally generated. Currently, sequences generated by IDENTITY columns will have this field set 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 |
+-------------+------------------+-------------+---------------+-----------+-----------+--------------+------------+------------+------------+------------+---------------------+
| 500003 | 1675748057234736 | 500002 | seq1 | 1 | 10 | 2 | 1 | 30 | 0 | 0 | 0 |
+-------------+------------------+-------------+---------------+-----------+-----------+--------------+------------+------------+------------+------------+---------------------+
1 row in set