Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tatarurzvn/99926b29746f04f2efba6119cc8496e6 to your computer and use it in GitHub Desktop.
Save tatarurzvn/99926b29746f04f2efba6119cc8496e6 to your computer and use it in GitHub Desktop.
pg_dump / pg_restore faster
pg_dump -j 4 --section=pre-data -Fc -d DB -h 127.0.0.1 -p 5432 -U postgres --schema public > pre_date
pg_dump -j 4 --section=data -Fc -Z 9 -d DB -h 127.0.0.1 -p 5432 -U postgres --schema public > data_date
pg_dump -j 4 --section=post-data -Fc -Z 9 -d DB -h 127.0.0.1 -p 5432 -U postgres --schema public > post_date
# -j4 -> because 4 tables
# Split per sections
# -Fc -> pg_restore format
# -Z 9 -> copression (cool if i need to scp it)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment