Appearance
sys.sequence
This view captures information about the sequences that exist in the system. See Generating Values with Sequences.
Column Name | Data Type | Description |
---|---|---|
database_id | bigint | The unique ID for the database. |
schema_id | bigint | The unique schema ID for the sequence. |
sequence_id | bigint | The unique ID for the sequence. |
fullname | text | The user-defined name of the sequence, pre-pended with the schema name. |
start_value | bigint | The current starting value for the sequence. |
last_value | bigint | The last value that was generated for the sequence (on the worker node that was the last to run the NEXTVAL function). |
max_value | bigint | The maximum value that the sequence can generate. |
is_temp | boolean | Whether the sequence was created as a temporary sequence (f =persistent; t =temporary). |
creation_time | timestamptz | When the sequence was created. |
Example
premdb=# create sequence matchid start 50000;
CREATE SEQUENCE
premdb=# select * from sys.sequence;
database_id | schema_id | sequence_id | fullname | start_value | last_value | max_value | is_temp | creation_time
-------------+-----------+-------------+----------------+-------------+------------+---------------------+---------+------------------------------
16388 | 2200 | 16403 | public.matchid | 49 | 49 | 9223372036854775807 | f | 2019-08-16 13:52:28.78335-07
(1 row)
premdb=# select nextval('matchid');
nextval
---------
51199
(1 row)
Parent topic:System Views