You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Document how to use zone config extensions to remove read replicas (#22371)
* Document how to use Zone config extensions to remove read replicas
Fixes DOC-15023
Co-authored-by: Florence Morris <58752716+florence-crl@users.noreply.github.com>
Copy file name to clipboardExpand all lines: src/current/v26.1/alter-database.md
+50-2Lines changed: 50 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -746,11 +746,12 @@ ALTER DATABASE movr CONFIGURE ZONE DISCARD;
746
746
The following examples show:
747
747
748
748
- How to [override specific fields of a schema object's zone configs](#override-specific-fields-of-a-schema-objects-zone-configs).
749
+
- How to [reduce storage costs by removing non-voting replicas](#reduce-storage-costs-by-removing-non-voting-replicas).
750
+
- How you could [implement super regions](#implement-super-regions).
751
+
- How to [minimize cross-region write latency](#minimize-cross-region-write-latency).
749
752
- How something like the [Secondary regions]({% link {{ page.version.version }}/multiregion-overview.md %}#secondary-regions) multi-region abstraction could have been implemented using Zone Config Extensions. For this example, we will call it ["Failover regions"](#failover-regions).
750
753
- How to [reset a region's Zone Config Extensions](#reset-a-regions-zone-config-extensions).
751
754
- How to [discard a region's Zone Config Extensions](#discard-a-regions-zone-config-extensions).
752
-
- How you could [implement super regions](#implement-super-regions).
753
-
- How to [minimize cross-region write latency](#minimize-cross-region-write-latency).
754
755
755
756
{{site.data.alerts.callout_info}}
756
757
We strongly recommend using the multi-region abstractions over "rolling your own" using Zone Config Extensions. These examples are provided to show the flexibility of Zone Config Extensions.
@@ -866,6 +867,53 @@ The `lease_preferences` field is now updated to include `us-west1`.
866
867
867
868
To remove the changes made in this example, [reset the Zone Config Extensions](#reset-a-regions-zone-config-extensions).
868
869
870
+
#### Reduce storage costs by removing non-voting replicas
871
+
872
+
In a [multi-region database]({% link {{ page.version.version }}/multiregion-overview.md %}), the default zone configuration may include additional [non-voting replicas]({% link {{ page.version.version }}/configure-replication-zones.md %}#num_voters) (for example, to support [follower reads]({% link {{ page.version.version }}/follower-reads.md %})). The database's [survival goal]({% link {{ page.version.version }}/multiregion-overview.md %}#survival-goals) depends only on the number of voting replicas (`num_voters`), not the total number of replicas (`num_replicas`).
873
+
874
+
By default, the `movr` database [as configured for this example](#setup) has a [zone survival goal]({% link {{ page.version.version }}/multiregion-survival-goals.md %}):
875
+
876
+
{% include_cached copy-clipboard.html %}
877
+
~~~sql
878
+
SHOW SURVIVAL GOAL FROM DATABASE movr;
879
+
~~~
880
+
881
+
~~~
882
+
database | survival_goal
883
+
-----------+----------------
884
+
movr | zone
885
+
(1 row)
886
+
~~~
887
+
888
+
This means that the number of replicas (`num_replicas`) is greater than strictly necessary to support the zone survival goal, which you can confirm with [`SHOW ZONE CONFIGURATION`]({% link {{ page.version.version }}/show-zone-configurations.md %}):
If you want to reduce storage costs, and can accept losing the ability to perform [follower reads]({% link {{ page.version.version }}/follower-reads.md %}), use Zone Config Extensions to reduce the number of non-voting replicas by setting `num_replicas` equal to `num_voters`:
911
+
912
+
{% include_cached copy-clipboard.html %}
913
+
~~~sql
914
+
ALTERDATABASE movr ALTER LOCALITY REGIONAL CONFIGURE ZONE USING num_replicas =3;
915
+
~~~
916
+
869
917
#### Implement super regions
870
918
871
919
In this example, [Zone Config Extensions]({% link {{ page.version.version }}/zone-config-extensions.md %}) are used to provide an alternative implementation of [super regions]({% link {{ page.version.version }}/multiregion-overview.md %}#super-regions), which are useful for [data domiciling]({% link {{ page.version.version }}/data-domiciling.md %}).
Copy file name to clipboardExpand all lines: src/current/v26.1/zone-config-extensions.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,7 @@ We strongly recommend that most users use the [default multi-region SQL abstract
24
24
-[`REGIONAL`]({% link {{ page.version.version }}/alter-database.md %}#parameters) extensions don't set [lease preferences]({% link {{ page.version.version }}/configure-replication-zones.md %}#lease_preferences).
25
25
-[`REGIONAL IN`]({% link {{ page.version.version }}/alter-database.md %}#parameters) extensions don't set [lease preferences]({% link {{ page.version.version }}/configure-replication-zones.md %}#lease_preferences), nor do they set [replica constraints]({% link {{ page.version.version }}/configure-replication-zones.md %}#constraints) or [voter constraints]({% link {{ page.version.version }}/configure-replication-zones.md %}#voter_constraints) that would conflict with the original [home region]({% link {{ page.version.version }}/table-localities.md %}#regional-by-row-tables).
26
26
- In no case will Zone Config Extensions change the [survival goals]({% link {{ page.version.version }}/multiregion-overview.md %}#survival-goals) for the database.
27
+
- Zone Config Extensions can set [`num_replicas`]({% link {{ page.version.version }}/configure-replication-zones.md %}#num_replicas) as low as [`num_voters`]({% link {{ page.version.version }}/configure-replication-zones.md %}#num_voters), which removes non-voting replicas while preserving the database's survival goal.
27
28
- They are composable. You can use Zone Config Extensions to build up approximations of many higher-level features. For an example, see [Failover regions]({% link {{ page.version.version }}/alter-database.md %}#failover-regions).
28
29
- They are region scoped. When a Zone Config Extension is attached to a [database region]({% link {{ page.version.version }}/multiregion-overview.md %}#database-regions), any [`REGIONAL BY TABLE`]({% link {{ page.version.version }}/table-localities.md %}#regional-tables) or [`REGIONAL BY ROW`]({% link {{ page.version.version }}/table-localities.md %}#regional-by-row-tables) tables associated with that region will have their zone configurations updated according to the settings passed via the extension. As mentioned above, this updated config will also be persisted in the face of other multi-region configuration changes.
29
30
- They are locality scoped. You can specify a Zone Config Extension that only applies to tables with certain [localities]({% link {{ page.version.version }}/multiregion-overview.md %}#table-localities). For example, to apply a Zone Config Extension to tables with the [`GLOBAL` locality]({% link {{ page.version.version }}/table-localities.md %}#global-tables), use [`ALTER DATABASE ... ALTER LOCALITY GLOBAL ...`]({% link {{ page.version.version }}/alter-database.md %}#alter-locality).
0 commit comments