Skip to content

sys.sequence

This view captures information about the sequences that exist in the system. See Generating Values with Sequences.

Column NameData TypeDescription
database_idbigintThe unique ID for the database.
schema_idbigintThe unique schema ID for the sequence.
sequence_idbigintThe unique ID for the sequence.
fullnametextThe user-defined name of the sequence, pre-pended with the schema name.
start_valuebigintThe current starting value for the sequence.
last_valuebigintThe last value that was generated for the sequence (on the worker node that was the last to run the NEXTVAL function).
max_valuebigintThe maximum value that the sequence can generate.
is_tempbooleanWhether the sequence was created as a temporary sequence (f=persistent; t=temporary).
creation_timetimestamptzWhen 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