Sequences are Vitess' answer to MySQL's auto-increment feature as described in the Vitess Documentation.


A typical example when of when you may want to manually adjust the starting ID in a sequence is when you are migrating a table that previously relied on the native MySQL implementation and you want Sequences to pick up where it's left off.


First, find the sequence table you need by referencing the vSchema.


{
  ...
  "tables" : {
    "customer": {
      "column_vindexes": [
           ...
      ],
      "auto_increment": {
        "column": "customer_id",
        "sequence": "customer_seq"
      }
    },


Then, execute the following query against that table through vtgate:


INSERT INTO customer_seq (id, next_id, cache) VALUES (0, 1000, 100);

If a value is already present, execute this instead:


UPDATE customer_seq SET next_id = 1000 WHERE id = 0;


Vitess will now start counting from the specified number (1000 in this example) in the sequence for any table defined as using it.