Skip to content

Commit de0dd54

Browse files
committed
Cutover docs
1 parent 213ec81 commit de0dd54

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

docs/features/sharding/resharding/schema.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ PgDog can copy tables, indexes and other entities from your production database
77

88
1. [Create tables](#tables-and-primary-keys), primary key indexes, and sequences
99
2. Create [secondary indexes](#secondary-indexes)
10+
3. Move [sequence](#sequences) values
1011

1112
The create tables step needs to be performed first, before [copying data](hash.md). The second step is performed once the data sync is almost complete.
1213

@@ -31,6 +32,7 @@ Required (*) and optional parameters for this command are as follows:
3132
| `--dry-run` | Print the SQL statements that will be executed on the destination database and exit. |
3233
| `--ignore-errors` | Execute SQL statements and ignore any errors. |
3334
| `--data-sync-complete` | Run the second step to create secondary indexes and sequences. |
35+
| `--cutover` | Run the cutover step to move sequence values. |
3436

3537
## Tables and primary keys
3638

@@ -42,7 +44,7 @@ A primary key constraint is **required** on all tables for logical replication t
4244

4345
Before starting the resharding process for your database, double-check that you have primary keys on all your tables.
4446

45-
## Publication
47+
### Publication
4648

4749
Since PgDog is using logical replication to move and reshard data, a [publication](https://www.postgresql.org/docs/current/sql-createpublication.html) for the relevant tables needs to be created on the source database.
4850

@@ -58,7 +60,7 @@ This will make sure _all_ tables in your database will be copied and resharded i
5860
!!! note "Multiple schemas"
5961
If you're using schemas other than `public`, create them on the destination database before running the schema sync.
6062

61-
## Schema admin
63+
### Schema admin
6264

6365
Schema sync creates tables, indexes, and other entities on the destination database. To make sure that's done with a user with sufficient privileges (e.g., `CREATE` permission on the database), you need to add it to [`users.toml`](../../../configuration/users.toml/users.md) and mark it as the schema administrator:
6466

@@ -87,6 +89,12 @@ pg_dump_path = "/path/to/pg_dump"
8789

8890
This step is performed after [data sync](hash.md) is complete. Running this step will create secondary indexes on all your tables, which will take some time, depending on the number of indexes in your schema.
8991

90-
## Next steps
92+
## Sequences
93+
94+
This steps is performed during the cutover stage once both schema sync and data sync are complete. The source database is no longer accepting writes and we are ready to move them to the destination.
95+
96+
This step will calculate the `MAX(column) + 1` values for all table sequences and set them on the respective columns.
97+
98+
## Read more
9199

92100
- [Move data](hash.md)

0 commit comments

Comments
 (0)