Skip to content

Commit 7b866ee

Browse files
authored
Update 20221008_01.md
1 parent f85e152 commit 7b866ee

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

202210/20221008_01.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ PostgreSQL , online ddl , pg-osc
1212
----
1313
1414
## 背景
15-
解决大表DDL(某些需要rewrite table的DDL)长时间持有排他锁导致业务影响的问题.
15+
解决大表DDL(某些需要rewrite table的DDL)长时间持有排他锁导致业务影响的问题. 支持9.6及以上版本.
1616

1717
https://github.com/shayonj/pg-osc
1818

@@ -24,6 +24,35 @@ pg-osc is inspired by the design and workings of tools like pg_repack and pt-onl
2424

2525
Proceed with caution when using this on production like workloads. Best to try on similar setup or staging like environment first. Read on below for some examples and caveats.
2626

27+
```
28+
pg-online-schema-change help perform
29+
30+
Usage:
31+
pg-online-schema-change perform -a, --alter-statement=ALTER_STATEMENT -d, --dbname=DBNAME -h, --host=HOST -p, --port=N -s, --schema=SCHEMA -u, --username=USERNAME
32+
33+
Options:
34+
-a, --alter-statement=ALTER_STATEMENT # The ALTER statement to perform the schema change
35+
-s, --schema=SCHEMA # The schema in which the table is
36+
# Default: public
37+
-d, --dbname=DBNAME # Name of the database
38+
-h, --host=HOST # Server host where the Database is located
39+
-u, --username=USERNAME # Username for the Database
40+
-p, --port=N # Port for the Database
41+
# Default: 5432
42+
-w, [--password=PASSWORD] # DEPRECATED: Password for the Database. Please pass PGPASSWORD environment variable instead.
43+
-v, [--verbose], [--no-verbose] # Emit logs in debug mode
44+
-f, [--drop], [--no-drop] # Drop the original table in the end after the swap
45+
-k, [--kill-backends], [--no-kill-backends] # Kill other competing queries/backends when trying to acquire lock for the shadow table creation and swap. It will wait for --wait-time-for-lock duration before killing backends and try upto 3 times.
46+
-w, [--wait-time-for-lock=N] # Time to wait before killing backends to acquire lock and/or retrying upto 3 times. It will kill backends if --kill-backends is true, otherwise try upto 3 times and exit if it cannot acquire a lock.
47+
# Default: 10
48+
-c, [--copy-statement=COPY_STATEMENT] # Takes a .sql file location where you can provide a custom query to be played (ex: backfills) when pgosc copies data from the primary to the shadow table. More examples in README.
49+
-b, [--pull-batch-count=N] # Number of rows to be replayed on each iteration after copy. This can be tuned for faster catch up and swap. Best used with delta-count.
50+
# Default: 1000
51+
-e, [--delta-count=N] # Indicates how many rows should be remaining before a swap should be performed. This can be tuned for faster catch up and swap, especially on highly volume tables. Best used with pull-batch-count.
52+
# Default: 20
53+
-o, [--skip-foreign-key-validation], [--no-skip-foreign-key-validation] # Skip foreign key validation after swap. You shouldn't need this unless you have a very specific use case, like manually validating foreign key constraints after swap.
54+
```
55+
2756

2857

2958
#### [期望 PostgreSQL 增加什么功能?](https://github.com/digoal/blog/issues/76 "269ac3d1c492e938c0191101c7238216")

0 commit comments

Comments
 (0)