-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add global and regional tables to patterns docs
Fixes #9268 Fixes #9266 Fixes #9265 Fixes #9264 Fixes #10425 Fixes #10319 Addresses #10051 Addresses #10401 Addresses #10461 Addresses #10463 Summary of changes: - Update multi-region "topology patterns" as follows: - Deemphasize "topology" for these patterns, since it really isn't - it's per-table - Add "global tables" as a pattern - Add "regional tables" as a pattern - Remove "duplicate indexes" and "geo-partitioned foos" pages and have them redirect to the above, as appropriate - Fix up ~all links in the docs to point to the new things - Update mentions of partitioning throughout the docs to note that most users should use new v21.1+ multi-region capabilities instead of explicit partitioning - Also removed mention of partitioning from several places as part of deemphasing explicit partitioning generally, since most use cases are covered by MR abstractions - Update `cockroach demo` to deemphasize partitioning and point to new MR things - Update disaster recovery pages to mention most users of new deployments should just use multi-region survival goals - Update various licensing docs to point to the new multi-region things - Update replication reports to mention the new MR things, in lieu of further updates - Renamed a bunch of links that used the phrase "geo-partitioning" to refer to the multi-region latency tutorial, which now goes by the name "Multi-Region Performance" - Note: we explicitly did *not* touch anything related to the multi-region Flask app, since that work is happening via #10394
- Loading branch information
1 parent
9999b26
commit e649a6c
Showing
38 changed files
with
420 additions
and
935 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
_Global_ tables are optimized for low-latency reads from every region in the database. The tradeoff is that writes will incur higher latencies from any given region, since writes have to be replicated across every region to make the global low-latency reads possible. | ||
|
||
Use global tables when your application has a "read-mostly" table of reference data that is rarely updated, and needs to be available to all regions. | ||
|
||
For an example of a table that can benefit from the _global_ table locality setting in a multi-region deployment, see the `promo_codes` table from the [MovR application](movr.html). | ||
|
||
For instructions showing how to set a table's locality to `GLOBAL`, see [`ALTER TABLE ... SET LOCALITY`](set-locality.html#global) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
In _regional by row_ tables, individual rows are optimized for access from different regions. This setting divides a table and all of [its indexes](multiregion-overview.html#indexes-on-regional-by-row-tables) into [partitions](partitioning.html), with each partition optimized for access from a different region. Like [regional tables](multiregion-overview.html#regional-tables), _regional by row_ tables are optimized for access from a single region. However, that region is specified at the row level instead of applying to the whole table. | ||
|
||
Use regional by row tables when your application requires low-latency reads and writes at a row level where individual rows are primarily accessed from a single region. For example, a users table in a global application may need to keep some users' data in specific regions for better performance. | ||
|
||
For an example of a table that can benefit from the _regional by row_ setting in a multi-region deployment, see the `users` table from the [MovR application](movr.html). | ||
|
||
For instructions showing how to set a table's locality to `REGIONAL BY ROW`, see [`ALTER TABLE ... SET LOCALITY`](set-locality.html#regional-by-row) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Regional tables work well when your application requires low-latency reads and writes for an entire table from a single region. | ||
|
||
For _regional_ tables, access to the table will be fast in the table's "home region" and slower in other regions. In other words, CockroachDB optimizes access to data in regional tables from a single region. By default, a regional table's home region is the [database's primary region](multiregion-overview.html#database-regions), but that can be changed to use any region added to the database. | ||
|
||
For instructions showing how to set a table's locality to `REGIONAL BY TABLE`, see [`ALTER TABLE ... SET LOCALITY`](set-locality.html#regional-by-table) | ||
|
||
{{site.data.alerts.callout_info}} | ||
By default, all tables in a multi-region database are _regional_ tables that use the database's primary region. Unless you know your application needs different performance characteristics than regional tables provide, there is no need to change this setting. | ||
{{site.data.alerts.end}} |
3 changes: 3 additions & 0 deletions
3
_includes/v21.1/sql/use-multiregion-instead-of-partitioning.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{{site.data.alerts.callout_success}} | ||
<span class="version-tag">New in v21.1:</span> Most users should not need to use partitioning directly. Instead, they should use CockroachDB's built-in [multi-region capabilities](multiregion-overview.html), which automatically handle geo-partitioning and other low-level details. | ||
{{site.data.alerts.end}} |
8 changes: 3 additions & 5 deletions
8
_includes/v21.1/topology-patterns/multi-region-cluster-setup.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
First, create a database and use it: | ||
|
||
{% include copy-clipboard.html %} | ||
~~~ sql | ||
CREATE DATABASE test; | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
~~~ sql | ||
USE test; | ||
~~~ | ||
|
||
[This cluster is already deployed across three regions](#cluster-setup). Therefore, to make this database a "multi-region database", you need to issue the following SQL statement that [sets the primary region](add-region.html#set-the-primary-region): | ||
|
||
{% include copy-clipboard.html %} | ||
~~~ sql | ||
ALTER DATABASE test PRIMARY REGION "us-east"; | ||
~~~ | ||
|
||
{{site.data.alerts.callout_info}} | ||
Every multi-region database must have a primary region. For more information, see [Database regions](multiregion-overview.html#database-regions). | ||
{{site.data.alerts.end}} | ||
|
||
Next, issue the following [`ADD REGION`](add-region.html) statements to add the remaining regions to the database. | ||
|
||
{% include copy-clipboard.html %} | ||
~~~ sql | ||
ALTER DATABASE test ADD REGION "us-west"; | ||
~~~ | ||
|
||
{% include copy-clipboard.html %} | ||
~~~ sql | ||
ALTER DATABASE test ADD REGION "us-central"; | ||
~~~ | ||
|
||
Congratulations, `test` is now a multi-region database! |
20 changes: 20 additions & 0 deletions
20
_includes/v21.1/topology-patterns/multiregion-fundamentals.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Multi-region patterns require thinking about the following questions: | ||
|
||
- What are my [survival goals](multiregion-overview.html#survival-goals)? Do I need to survive a [zone failure](multiregion-overview.html#surviving-zone-failures)? A [region failure](multiregion-overview.html#surviving-region-failures)? | ||
- Given the constraints provided by my survival goals, what are the [table localities](multiregion-overview.html#table-locality) that will provide the performance characteristics I need for each table's data? | ||
- Do I need low-latency reads and writes from a single region? Do I need them at the [row level](multiregion-overview.html#regional-by-row-tables)? Or will the [table level](multiregion-overview.html#regional-tables) suffice? | ||
- Do I have a "read-mostly" [table of reference data that is rarely updated](multiregion-overview.html#global-tables), but that needs to be available to all regions? | ||
|
||
For more information about our multi-region capabilities, review the following pages: | ||
|
||
- [Multi-region overview](multiregion-overview.html) | ||
- [Choosing a multi-region configuration](choosing-a-multi-region-configuration.html) | ||
- [When to use `ZONE` vs. `REGION` Survival Goals](when-to-use-zone-vs-region-survival-goals.html) | ||
- [When to use `REGIONAL` vs. `GLOBAL` Tables](when-to-use-regional-vs-global-tables.html) | ||
|
||
In addition, reviewing the following information will be helpful: | ||
|
||
- The concept of [locality](cockroach-start.html#locality), which makes CockroachDB aware of the location of nodes and able to intelligently place and balance data based on how you define [survival goals](multiregion-overview.html#survival-goals) and [table localities](multiregion-overview.html#table-locality). | ||
- The recommendations in our [Production Checklist](recommended-production-settings.html). | ||
- This page doesn't account for hardware specifications, so be sure to follow our [hardware recommendations](recommended-production-settings.html#hardware) and perform a POC to size hardware for your use case. | ||
- Finally, adopt these [SQL Best Practices](performance-best-practices-overview.html) to get good performance. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
- [Multi-Region Capabilities Overview](multiregion-overview.html) | ||
- [Choosing a multi-region configuration](choosing-a-multi-region-configuration.html) | ||
- [When to use `ZONE` vs. `REGION` survival goals](when-to-use-zone-vs-region-survival-goals.html) | ||
- [When to use `GLOBAL` vs. `REGIONAL` tables](when-to-use-regional-vs-global-tables.html) | ||
- [`ALTER DATABASE ... SURVIVE {ZONE,REGION} FAILURE`](survive-failure.html) | ||
- [`ALTER TABLE ... SET LOCALITY ...`](set-locality.html) | ||
- [Topology Patterns Overview](topology-patterns.html) | ||
|
||
- Single-region | ||
- [Development](topology-development.html) | ||
- [Basic Production](topology-basic-production.html) | ||
|
||
- Multi-region | ||
- [Geo-Partitioned Replicas](topology-geo-partitioned-replicas.html) | ||
- [Geo-Partitioned Leaseholders](topology-geo-partitioned-leaseholders.html) | ||
- [Duplicate Indexes](topology-duplicate-indexes.html) | ||
- [Follow-the-Workload](topology-follow-the-workload.html) | ||
- Single-region | ||
- [Development](topology-development.html) | ||
- [Basic Production](topology-basic-production.html) | ||
- Multi-region | ||
- [`REGIONAL` Table Locality Pattern](topology-regional-tables.html) | ||
- [`GLOBAL` Table Locality Pattern](topology-global-tables.html) | ||
- [Follow-the-Workload](topology-follow-the-workload.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.