Sequences

Sequences let you set the default values of columns to sequential integer values. Sequences guarantee uniqueness, and avoid constraint enforcement problems and overhead. Sequences are especially useful for primary key columns.

While sequence object values are guaranteed to be unique, they are not guaranteed to be contiguous, so you might interpret the returned values as missing. For example, two nodes can increment a sequence at different rates. The node with a heavier processing load increments the sequence, but the values are not contiguous with those being incremented on a node with less processing.

Vertica supports the following sequence types:

  • Named sequences are database objects that generates unique numbers in sequential ascending or descending order. Named sequences are defined independently through CREATE SEQUENCE statements, and are managed independently of the tables that reference them. A table can set the default values of one or more columns to named sequences.
  • AUTO_INCREMENT/IDENTITY column sequences: Column constraints AUTO_INCREMENT and IDENTITY are synonyms that specify to increment or decrement a column's value as new rows are added. This sequence type is table-dependent and does not persist independently. A table can contain only one AUTO_INCREMENT or IDENTITY column.

In This Section