How to efficiently dump PostgreSQL databases – select * from depesz;
depesz.com·18h
🐘PostgreSQL
Preview
Report Post

Recently, on irc, there have been some talks with people using various pg_dump/pg_dumpall calls to get dumps of database.

I voiced my ideas, but figured it could be good subject for a blog post.

First things first – we have two tools available:

  • pg_dumpall
  • pg_dump

pg_dumpall dumps all databases in given PostgreSQL installation (cluster), and does it to plain text file. Everything goes there. Additionally, it dumps global things – roles and tablespaces, which cannot be dumped by pg_dump.

The major benefit of pg_dumpall is that it’s single command, and you get results.

There is huge number of drawbacks though:

  • dump is large, because it’s uncompressed
  • dumping is slow, because it’s done sequentially, with single w…

Similar Posts

Loading similar posts...