MariaDB starting with 10.3.1

SEQUENCE's are being introduced in MariaDB 10.3.

Syntax

SHOW CREATE SEQUENCE sequence_name;

Description

Shows the CREATE SEQUENCE statement that created the given sequence. The statement requires the SELECT privilege for the table.

Example

CREATE SEQUENCE s1 START WITH 50;
SHOW CREATE SEQUENCE s1\G;

*************************** 1. row ***************************
       Table: t1
Create Table: CREATE SEQUENCE `s1` start with 50 minvalue 1 maxvalue 9223372036854775806
increment by 1 cache 1000 nocycle ENGINE=Aria

Notes

If you want to see the underlying table structure used for the SEQUENCE you can use SHOW CREATE TABLE on the SEQUENCE. You can also use SELECT to read the current recorded state of the SEQUENCE:

MariaDB [test]> CREATE SEQUENCE t1;
MariaDB [test]> SHOW CREATE TABLE s1\G
*************************** 1. row ***************************
       Table: s1
Create Table: CREATE TABLE `s1` (
  `next_value` bigint(21) NOT NULL COMMENT 'next not cached value',
  `min_value` bigint(21) NOT NULL COMMENT 'min value',
  `max_value` bigint(21) NOT NULL COMMENT 'max value',
  `start` bigint(21) NOT NULL COMMENT 'start value',
  `increment` bigint(21) NOT NULL COMMENT 'increment value',
  `cache` bigint(21) NOT NULL COMMENT 'cache size',
  `cycle` tinyint(1) unsigned NOT NULL COMMENT 'cycle state',
  `round` bigint(21) NOT NULL COMMENT 'How many cycles has been done'
) ENGINE=Aria SEQUENCE=1
MariaDB [test]> select * from s1;
+------------+-----------+---------------------+-------+-----------+-------+-------+-------+
| next_value | min_value | max_value           | start | increment | cache | cycle | round |
+------------+-----------+---------------------+-------+-----------+-------+-------+-------+
|          1 |         1 | 9223372036854775806 |     1 |         1 |  1000 |     0 |     0 |
+------------+-----------+---------------------+-------+-----------+-------+-------+-------+

See also

Comments

Comments loading...