Error 4084: Sequence has run out
4084
ER_SEQUENCE_RUN_OUT
Sequence '%-.64s.%-.64s' has run out
Possible Causes and Solutions
Sequence has Completed Normally
In a sequence, once the MAXVALUE has been reached, and the CYCLE argument has not been used, further attempts to set the next value will fail:
CREATE OR REPLACE SEQUENCE s START WITH 1 INCREMENT BY 1 MAXVALUE=2;
SELECT NEXTVAL(s);
+------------+
| NEXTVAL(s) |
+------------+
| 1 |
+------------+
SELECT NEXTVAL(s);
+------------+
| NEXTVAL(s) |
+------------+
| 2 |
+------------+
SELECT NEXTVAL(s);
ERROR 4084 (HY000): Sequence 'test.s' has run outThis is usually intended behaviour, but there are a number of ways to prevent this:
Choose a larger MAXVALUE
Prior to MariaDB 11.5, this defaulted to the maximum, BIGINT. From MariaDB 11.5, it can be BIGINT UNSIGNED
Cycling
If re-use sequence values is not a problem, you can cycle back to the start once the maximum value has been reached:
Sequence has Completed Due to Cache
The underlying table is only updated with a new sequence value the first time the value is created, and then each time the cache expires. By default the cache is set to 1000. For example:
This behaviour can be prevented by setting the cache to zero, so that the value stored in the underlying table is written each time:
See Also
SETVAL(). Set next value for the sequence.
This page is licensed: CC BY-SA / Gnu FDL
Last updated
Was this helpful?

