Sharded Keyspace >>

    We are going to start with configuring the table in the unsharded keyspace product. The schema file should be as follows:

    product_id is the primary key for product, and it is also configured to use MySQL’s auto_increment feature that allows you to automatically generate unique values for it.

    The json states that the keyspace is not sharded. The product table is specified in the “tables” section of the json. This is because there are other sections that we will introduce later.

    For unsharded keyspaces, no additional metadata is needed for regular tables. So, their entry is empty.

    Alternate VSchema DDL:

    Bringing up the cluster will allow you to access the product table. You can now insert rows into the table:

    The insert does not specify values for , because we are relying on MySQL’s auto_increment feature to populate it.

    You will notice that we did not connect to the product database or issue a use statement to select it. This is the ‘unspecified’ mode supported by Vitess. As long as a table name can be uniquely identified from the vschemas, Vitess will automatically direct the query to the correct keyspace.


    Sharded Keyspace >>