Managing schema changes
CockroachDB supports online schema changes, which don't require any downtime. An existing schema can be changed using statements that include ALTER
and CREATE INDEX
operations.
CockroachDB internally maintains a consistent distributed schema cache, along with consistent table data that works with multiple versions of the schema concurrently. This enables the rolling out of a new schema while the older schema is still being used. CockroachDB backfills the table data into the newer schema without holding locks. So, online schema changes don't affect the current read/write operations on the cluster on a particular table whose schema is being modified.
Here are some of the benefits of online schema changes:
- Zero downtime.
- Schema changes happen without holding any table-level locks, so application workloads on the cluster can continue to operate without performance degradation.
- Data is kept consistent throughout the schema upgrade...