mysqlvitess

How to create multiple Vitess Indexes


Could anyone point out how to change VSchema in Vitess to accommodate multiple VIndexes.

{
    "sharded": true,
    "tables": {
        "card": {
            "column_vindexes": [
                {
                    "column": [
                        "customerId",
                        "sourceId"
                    ],
                    "name": "hash"
                }
            ]
        }
    },
    "vindexes": {
        "hash": {
            "type": "hash"
        }
    }
}

Solution

  • This file showcases a fairly complex vschema with multiple vindexes: https://github.com/vitessio/vitess/blob/master/examples/demo/schema/user/vschema.json. If you have vitess up and running, you can launch the scripts in the upper directory and play with the demo.