Defining PostgreSQL Sequences
The following properties are applicable to a PostgreSQL Sequence object
Tab |
Section |
Property |
Description |
Additional Information |
---|---|---|---|---|
|
|
Name |
Specifies the name of the sequence |
|
|
|
Schema |
Specifies the schema options for the schema generation |
Select the schema from the drop-down list or click to create a new one |
|
|
If Not Exists |
Specifies that if the collation already exists, no exception is thrown, and no action happens |
|
|
|
Generate |
Specifies whether a SQL statement for the collation is generated during forward engineering |
|
General
|
General Options
|
Is Temporary |
Specifies whether the sequence object is created only for this session and dropped when the session ends. While the temporary sequence exists, you cannot see existing permanent sequences with the same name in this session unless you reference them with schema-qualified names. |
|
Unlogged |
Selecting this option creates an unlogged sequence. A write-ahead log does not record changes to unlogged sequences. |
|
||
Data Type |
Specifies the data type of the sequence |
smallint: Requires 2 bytes of storage size and can store integers in the range of -37, 767 to 32, 767. It comes in handy for storing data like the age of people, the number of pages in a book, etc. integer: Requires 4 bytes of storage space and can store integers from -2, 147, 483, 648 to 2, 147, 483, 647. It is useful for storing data such as a country's population, the number of active users on a social media app, etc. bigint: Requires 8 bytes of storage size and can store integers in the range of -9, 223, 372, 036, 854, 775, 808 to +9, 223, 372, 036, 854, 775, 807. Using the BIGINT type consumes a lot of space and slows down the database, so you should have a good reason to do so. It is useful for storing data such as the number of stars in a galaxy, scientific constants, etc. |
||
Increment By |
Specifies the value to add to the current sequence value to create a new value. |
Use a positive value to create an ascending sequence and a negative value to create a descending sequence. The default value is 1 |
||
Minimum Value |
Specifies the minimum value a sequence can generate |
|
||
No Min Value |
Use this keyword to set this behavior to the default |
|
||
Maximum Value |
Specifies the maximum value a sequence can generate |
|
||
No Max Value |
Use this keyword to set this behavior to the default |
|
||
Starting Value |
Specifies the starting value of the sequence |
|
||
Cache Capacity |
Specifies the number of sequence numbers to preallocate and store in memory for faster access. The minimum and default value is 1. |
|
||
Cycle Options |
Allows you to restart the value if the limit is reached |
TRUE: When the limit reaches, the next number is the minvalue or maxvalue. FALSE: Any calls to nextval after the sequence has reached its maximum value will return an error. |
||
Owned By |
Allows you to associate the table column with the sequence so that when you drop the column or table, PostgreSQL will automatically drop the associated sequence |
|
- (Optional) Click the Comment tab and enter any comments that you want to associate with the object.
- (Optional) Click the UDP tab to work with user-defined properties for the object.
- (Optional) Click the Notes tab to view and edit user notes.
- (Optional) Click the Extended Notes tab to view or edit user notes.
- Click Close.
The sequence is defined, and the PostgreSQL Sequence Editor closes.
For more information, refer to PostgreSQL documentation.
Copyright © 2024 Quest Software, Inc. |