VSchema is short for Vitess Schema and it describes how to shard data within Vitess.
In contrast to a traditional database schema that contains metadata about tables, a VSchema contains metadata about how tables are organized across shards. This
...moreA Vindex provides a way to map a column value to a keyspace ID. Since each shard in Vitess covers a range of keyspace ID values, this mapping can be used to identify which shard contains a row.
The advantages of Vindexes stem from their flexibility:
A
...moreThe Primary Vindex for a table is analogous to a database primary key.
Every sharded table must have one defined. A Primary Vindex must be unique: given an input value, it must produce a single keyspace ID. At the time of an insert to the table, the unique
...moreThe ease of creation of a VSchema depends heavily on now your data model is constructed.
For some data models, especially smaller and less complex ones, it can be less challenging to determine how to split the data between shards. A clear sharding key
...moreFor a very trivial setup where there is only one unsharded keyspace, there is no need to specify a VSchema because Vitess will know that there is nowhere to route a query except to the single shard.
However, once you have sharding, having a VSchema becomes
...more