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
Copy file name to clipboardExpand all lines: docs/features/sharding/resharding/schema.md
+11-3Lines changed: 11 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,7 @@ PgDog can copy tables, indexes and other entities from your production database
7
7
8
8
1.[Create tables](#tables-and-primary-keys), primary key indexes, and sequences
9
9
2. Create [secondary indexes](#secondary-indexes)
10
+
3. Move [sequence](#sequences) values
10
11
11
12
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.
12
13
@@ -31,6 +32,7 @@ Required (*) and optional parameters for this command are as follows:
31
32
|`--dry-run`| Print the SQL statements that will be executed on the destination database and exit. |
32
33
|`--ignore-errors`| Execute SQL statements and ignore any errors. |
33
34
|`--data-sync-complete`| Run the second step to create secondary indexes and sequences. |
35
+
|`--cutover`| Run the cutover step to move sequence values. |
34
36
35
37
## Tables and primary keys
36
38
@@ -42,7 +44,7 @@ A primary key constraint is **required** on all tables for logical replication t
42
44
43
45
Before starting the resharding process for your database, double-check that you have primary keys on all your tables.
44
46
45
-
## Publication
47
+
###Publication
46
48
47
49
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.
48
50
@@ -58,7 +60,7 @@ This will make sure _all_ tables in your database will be copied and resharded i
58
60
!!! note "Multiple schemas"
59
61
If you're using schemas other than `public`, create them on the destination database before running the schema sync.
60
62
61
-
## Schema admin
63
+
###Schema admin
62
64
63
65
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:
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.
89
91
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.
0 commit comments