This topic describes how to query information about sequences.

Syntax

SHOW SEQUENCES [ WHERE <filter_condition> ]
Note
  • You can execute the SHOW SEQUENCES statement to query information about sequences in the current database.
  • You can query information about all sequences in the current instance from the INFORMATION_SCHEMA.SEQUENCES view.

Examples

  • You can execute the following statement to query information about all sequences in the current database:
    SHOW SEQUENCES;

    Sample result:

    +-------------+-----------+-------+------------+------------+------------+--------------+------------+---------------------+-------+-------+------------------------------------------+
    | SCHEMA_NAME | NAME      | VALUE | UNIT_COUNT | UNIT_INDEX | INNER_STEP | INCREMENT_BY | START_WITH | MAX_VALUE           | CYCLE | TYPE  | PHY_SEQ_NAME                             |
    +-------------+-----------+-------+------------+------------+------------+--------------+------------+---------------------+-------+-------+------------------------------------------+
    | partest     | newseq1   | 1     | N/A        | N/A        | N/A        | 1            | 1          | 9223372036854775807 | N     | NEW   | pxc_seq_ee6653d17586a275d41522852aa36c80 |
    | partest     | newseq2   | 1     | N/A        | N/A        | N/A        | 2            | 100        | 200                 | Y     | NEW   | pxc_seq_6a2a3689aa90a0179b71183b8bfc426c |
    | partest     | timeseq1  | N/A   | N/A        | N/A        | N/A        | N/A          | N/A        | N/A                 | N/A   | TIME  | N/A                                      |
    | partest     | timeseq2  | N/A   | N/A        | N/A        | N/A        | N/A          | N/A        | N/A                 | N/A   | TIME  | N/A                                      |
    | partest     | groupseq1 | 0     | 1          | 0          | 100000     | N/A          | N/A        | N/A                 | N/A   | GROUP | N/A                                      |
    | partest     | groupseq2 | 200000| 1          | 0          | 100000     | N/A          | N/A        | N/A                 | N/A   | GROUP | N/A                                      |
    +-------------+-----------+-------+------------+------------+------------+--------------+------------+---------------------+-------+-------+------------------------------------------+
  • You can execute the following statement to query information about all NEW sequences in the current database:
    SHOW SEQUENCES WHERE TYPE='NEW';

    Sample result:

    +-------------+---------+-------+------------+------------+------------+--------------+------------+---------------------+-------+------+------------------------------------------+
    | SCHEMA_NAME | NAME    | VALUE | UNIT_COUNT | UNIT_INDEX | INNER_STEP | INCREMENT_BY | START_WITH | MAX_VALUE           | CYCLE | TYPE | PHY_SEQ_NAME                             |
    +-------------+---------+-------+------------+------------+------------+--------------+------------+---------------------+-------+------+------------------------------------------+
    | partest     | newseq1 | 1     | N/A        | N/A        | N/A        | 1            | 1          | 9223372036854775807 | N     | NEW  | pxc_seq_ee6653d17586a275d41522852aa36c80 |
    | partest     | newseq2 | 1     | N/A        | N/A        | N/A        | 2            | 101        | 300                 | N     | NEW  | pxc_seq_6a2a3689aa90a0179b71183b8bfc426c |
    +-------------+---------+-------+------------+------------+------------+--------------+------------+---------------------+-------+------+------------------------------------------+
  • You can execute the following statement to query information about all sequences whose names include the seq1 keyword in the current database:
    SHOW SEQUENCES WHERE NAME LIKE '%seq1%';

    Sample result:

    +-------------+-----------+-------+------------+------------+------------+--------------+------------+---------------------+-------+-------+------------------------------------------+
    | SCHEMA_NAME | NAME      | VALUE | UNIT_COUNT | UNIT_INDEX | INNER_STEP | INCREMENT_BY | START_WITH | MAX_VALUE           | CYCLE | TYPE  | PHY_SEQ_NAME                             |
    +-------------+-----------+-------+------------+------------+------------+--------------+------------+---------------------+-------+-------+------------------------------------------+
    | partest     | newseq1   | 1     | N/A        | N/A        | N/A        | 1            | 1          | 9223372036854775807 | N     | NEW   | pxc_seq_ee6653d17586a275d41522852aa36c80 |
    | partest     | timeseq1  | N/A   | N/A        | N/A        | N/A        | N/A          | N/A        | N/A                 | N/A   | TIME  | N/A                                      |
    | partest     | groupseq1 | 0     | 1          | 0          | 100000     | N/A          | N/A        | N/A                 | N/A   | GROUP | N/A                                      |
    +-------------+-----------+-------+------------+------------+------------+--------------+------------+---------------------+-------+-------+------------------------------------------+