Skip to content

Commit 1c7cb9c

Browse files
Merge pull request #246961 from hariramt/task/table-in-parallel-2
Added emphasis on simple PK
2 parents 8b1a6b0 + 2b30834 commit 1c7cb9c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

articles/postgresql/migrate/concepts-single-to-flexible.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,18 +247,18 @@ In general, a powerful SKU is recommended for the target as the migration tool r
247247

248248
If the data distribution on the source is highly skewed, with most of the data present in one table, the allocated compute for migration is not fully utilized and it creates a bottleneck. So, we will split large tables into smaller chunks which are then migrated in parallel. This is applicable to tables that have more than 10000000 (10m) tuples. Splitting the table into smaller chunks is possible is possible if one of the following conditions are satisfied.
249249

250-
1. The table must have a column with a primary key or unique index of type int or big int.
250+
1. The table must have a column with a simple (not composite) primary key or unique index of type int or big int.
251251

252252
> [!NOTE]
253253
> In case of approaches #2 or #3 below, the user must carefully evaluate the implications of adding a unique index column to the source schema. Only after confirmation that adding a unique index column will not affect the application should the user go ahead with the changes.
254254
255-
2. If the table does not have a primary key or unique index of type int or big int, but has a column that meets the data type criteria, the column can be converted into a unique index using the below command. Note that this command does not require a lock on the table.
255+
2. If the table does not have a simple primary key or unique index of type int or big int, but has a column that meets the data type criteria, the column can be converted into a unique index using the below command. Note that this command does not require a lock on the table.
256256

257257
```sql
258258
create unique index concurrently partkey_idx on <table name> (column name);
259259
```
260260

261-
3. If the table has neither an int/big int primary key or unique index nor any column that meets the data type criteria, you can add such a column using [ALTER](https://www.postgresql.org/docs/current/sql-altertable.html) and drop it post-migration. Note that running the ALTER command requires a lock on the table.
261+
3. If the table has neither a simple int/big int primary key or unique index nor any column that meets the data type criteria, you can add such a column using [ALTER](https://www.postgresql.org/docs/current/sql-altertable.html) and drop it post-migration. Note that running the ALTER command requires a lock on the table.
262262

263263
```sql
264264
alter table <table name> add column <column name> bigserial unique;
@@ -273,7 +273,7 @@ If any of the above conditions are satisfied, the table will be migrated in mult
273273

274274
In summary, the Single to Flexible migration tool will migrate a table in parallel threads and reduce the migration time if:
275275

276-
1. The table has a column with a primary key or unique index of type int or big int.
276+
1. The table has a column with a simple primary key or unique index of type int or big int.
277277
2. The table has at least 10000000 (10m) rows so that the difference between the minimum and maximum value of the primary key is more than 10000000 (10m).
278278
3. The SKU used has idle cores which can be leveraged for migrating the table in parallel.
279279

0 commit comments

Comments
 (0)