SQL - CREATE SEQUENCE
Creates a new sequence. Command introduced in version 2.2.
Syntax
CREATE SEQUENCE <sequence> TYPE <CACHED|ORDERED> [START <start>]
[INCREMENT <increment>] [CACHE <cache>]
<sequence>Logical name for the sequence to cache.TYPEDefines the sequence type. Supported types are,CACHEDFor sequences where it caches N items on each node to improve performance when you require many calls to the.next()method. (Bear in mind, this may create holes with numeration).ORDEREDFor sequences where it draws on a new value with each call to the.next()method.
STARTDefines the initial value of the sequence.INCREMENTDefines the increment for each call of the.next()method.CACHEDefines the number of value to pre-cache, in the event that you use the cached sequence type.
Examples
Create a new sequence to handle id numbers:
orientdb>CREATE SEQUENCE idseq TYPE ORDEREDUse the new sequence to insert id values
orientdb>INSERT INTO Account SET id = sequence('idseq').next()
For more information, see