pg_dumpall is PostgreSQL's cluster-wide backup tool that creates logical dumps of everything in your PostgreSQL instance. While pg_dump handles single databases, pg_dumpall grabs the whole damn thing: databases, users, roles, tablespaces, and all the global objects that pg_dump can't touch.
Here's the brutal reality: pg_dumpall is slow. Painfully slow. A 100GB cluster can take 2-3 hours, and there's no progress indicator. You run it and pray nothing crashes halfway through. Unlike pg_dump which supports parallel processing with -j
, pg_dumpall is single-threaded all the way.
The Password Prompt Hell: pg_dumpall connects to every database in your cluster separately. Without a .pgpass
file, you'll be typing passwords every few minutes like some kind of authentication slave. Set up your password file or lose your sanity.
When You Actually Need This Tool: Despite the pain, pg_dumpall is your only option for:
- Migrating entire PostgreSQL clusters between servers
- Backing up all databases plus user accounts and permissions
- Cloning development environments that need identical user setups
- Version upgrades where you need everything preserved
Production Reality Check: Most teams end up using pg_dump for individual databases and only reach for pg_dumpall when they need to replicate the entire cluster setup. The restore process is also all-or-nothing - if something fails midway, you're starting over from scratch.
The tool requires superuser access because it needs to read everything, including system catalogs and role information. Try running this as a regular user and you'll get permission errors that'll make you question your life choices.