Skip to content

Statements

/

ALTER

ALTER SEQUENCE

The ALTER SEQUENCE statement is used to modify a defined sequence.

SurrealQL Syntax
ALTER SEQUENCE [ IF EXISTS ] @name [ TIMEOUT @duration ]

The timeout of a sequence can be modified via an ALTER SEQUENCE statement. For example, a sequence can be included in the schema but effectively disabled if given a timeout of 0ns, after which ALTER SEQUENCE can be used to modify the timeout to make it available.

DEFINE SEQUENCE mySeq3 BATCH 1000 START 100 TIMEOUT 0ns;
INFO FOR DB.sequences;
//- { mySeq3: 'DEFINE SEQUENCE mySeq3 BATCH 1000 START 100 TIMEOUT 0ns' }
sequence::nextval('mySeq3');
//- 'The query was not executed because it exceeded the timeout: 0ns'

ALTER SEQUENCE mySeq3 TIMEOUT 100ms;
sequence::nextval('mySeq3');
//- 100

Was this page helpful?