How we built REGIONAL BY ROW
CockroachDB comes with new easy-to-use SQL syntax for configuring a database across multiple regions. One of these SQL features is to declare a table to have the locality REGIONAL BY ROW
, allowing developers to place individual rows of a table in a specific region whilst maintaining the facade of a single SQL table, for example:
CREATE TABLE users (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
username STRING NOT NULL UNIQUE
) LOCALITY REGIONAL BY ROW;
With this extra piece of syntax during CREATE TABLE, they’ve made row-level data homing simple.