Is Vitess supports sequence(auto-increment) only in unsharded keyspaces?

61 Views Asked by At

As documentation says, it should be first creating backing table, so it confused what it should be

1

There are 1 best solutions below

0
Tobi On

The docs describe how sequences are implemented. Vitess needs a one-row table that keeps the state of the sequence. That state table needs to be un-sharded.

The sequence values themselves can be used in a sharded table.

Looking at the docs: https://vitess.io/docs/18.0/reference/features/vitess-sequences/ user_seq is a un-sharded table, user is a sharded table that utilises the sequence for auto-increment.