pg_dump -Fd mydb -t myschema.mytable -v -f /data/mydirectory -j 2Where
-Fd = export into a directory-format archive -t = table name -v = verbose -f = the target directory -j = number of export jobsNote that -f can be omitted for file based output formats.
Since I am using the directory output format however, I am required to use it, and it specifies the target directory instead of a file. In this case the directory is created by pg_dump and it must not exist before.
In plain text file format:
pg_dump mydb -n 'myschema' -a -Fp -t mytable | gzip > mydb_myschema_mytable.gzWhere
-Fp = plain text format -a = data only, no metadata. In the case of plain text, this means no "create table" statement is generated -t = table nameWhen the export is done, you may unpack the mydb_myschema_mytable.gz and you will observe that the file contains COPY directives for each row.
In custom format:
pg_dump mydb -n 'myschema' -a -Fc -t mytable | gzip > mydb_myschema_mytable_custom.gzWhere all the options are identical to the plain text format, except for
-Fc = custom data format
No comments:
Post a Comment