Skip to main content

Documentation Index

Fetch the complete documentation index at: https://planetscale.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

What this error means

UNSUPPORTED_SHARDED_FEATURE means the schema uses a feature that is valid in some MySQL or unsharded Vitess schemas but not in a sharded keyspace. Common messages include:
`recent_orders` is a view: sharded databases cannot have views
table "orders" has an autoincrement column "id": sharded databases cannot have autoincrement columns, use a sequence instead

Why PlanetScale rejects it

In a sharded keyspace, rows are distributed across multiple MySQL instances. Features that require one local MySQL instance to understand the entire table, such as AUTO_INCREMENT, cannot coordinate safely across shards. Views are also not supported in sharded keyspaces.

How to fix it

For AUTO_INCREMENT columns, use a Vitess sequence table instead:
CREATE TABLE orders (
  id bigint unsigned NOT NULL,
  customer_id bigint unsigned NOT NULL,
  PRIMARY KEY (id)
);
Then create a sequence table in an unsharded keyspace and update the VSchema to use it.
CREATE TABLE orders_seq (
  id bigint,
  next_id bigint,
  cache bigint,
  PRIMARY KEY (id)
) COMMENT 'vitess_sequence';
For views in sharded keyspaces, remove the view from the sharded keyspace. Move the logic into application queries, materialize the data into a table, or use an unsharded keyspace when appropriate.

Need help?

Get help from the PlanetScale Support team, or join our Discord community to see how others are using PlanetScale.