There are 2 main formats for pg_dump: custom vs sql. For custom, it's compressed by default, and not readable if you try to open it. But is it faster to dump into this format as opposed to SQL format. Or is the speed the same?
2 Answers
Time it and see. Which is fastest will depend on the balance of CPU to disk I/O on your system. If CPU is abundant and the disk is slow, a -Fc
dump will be faster. If CPU is very limited and the disk is fast, an SQL dump might be faster.
I strongly recommend using -Fc
custom format dumps anyway. They're much more flexible, and while you can convert a custom format dump into an SQL format dump you can't do the reverse easily.
-
2If you also came here for how to convert a custom dump into a sql one: stackoverflow.com/a/21429700/1380673 has an answer Commented Jun 16, 2021 at 9:45
You can dump | gzip
the plain SQL format for compression before writing to disk as well, but an advantage of the custom format for performance are parallel restores (-j option), and parallel dumps are forthcoming.