Dump in custom format
Dump in the custom format with pg_dump -Fc. It is compressed and lets pg_restore list the contents and restore one table, which a plain SQL dump cannot do.
A plain SQL dump restores all or nothing, and the file for a large database is bigger than it needs to be.
createdb shop
psql shop -q -c 'CREATE TABLE orders (id int PRIMARY KEY, note text)' -c 'CREATE TABLE users (id int)' -c "INSERT INTO orders SELECT g, repeat('x', 100) FROM generate_series(1, 20000) g"
pg_dump shop > shop.sql
pg_dump -Fc shop > shop.dump
echo "plain: $(wc -c < shop.sql) bytes, custom: $(wc -c < shop.dump) bytes"
head -c 5 shop.dump; echo
pg_restore -l shop.dump | grep -E 'TABLE( DATA)? public'
dropdb shopplain: 2130406 bytes, custom: 58425 bytes
PGDMP
217; 1259 16496 TABLE public orders postgres
218; 1259 16503 TABLE public users postgres
3458; 0 16496 TABLE DATA public orders postgres
3459; 0 16503 TABLE DATA public users postgres-Fc writes PostgreSQL's custom archive format, which is compressed with zlib by default and has a table of contents. pg_restore -l prints that list, and pg_restore -t orders -d target shop.dump restores a single table, or -j 4 restores in parallel, as the pg_restore reference describes. The file is binary, beginning with the letters PGDMP, so it is not meant to be read or edited as text. Here it is a small fraction of the size of the plain dump.
Only pg_restore can read it, and it needs a version no older than the one that wrote the file. A plain dump is easier to diff and to load with psql, and the directory format, -Fd, is the one that allows a parallel dump with -j. The size depends on the data; random content hardly compresses.