Unzip compressed dump and import via psql
Use compressed pg_dump:
- Using -Z
pg_dump dbname -Fp -Z6 -v > filename.gz - Using gzip
pg_dump dbname | gzip > filename.gz
Reload data: - gunzip
gunzip -c filename.gz | psql -Upostgres -ddbname - cat
cat filename.gz |gunzip|psql -Upostgres -ddbname
Examples:
1.pg_dump -d test -t t_auth* -Fp -Z6 -v > /home/data/auth.gz
2.gunzip -c /home/data/auth.gz |psql -Upostgres -d auth
3.cat /home/data/auth.gz |gunzip |psql -Upostgres -d auth
refer:
[1] postgresql-13-A4.pdf 25.1.3. Handling Large Databases
本文来自博客园,作者:program_keep,转载请注明原文链接:https://www.cnblogs.com/program-keep/p/18838964