Data guides
PostgreSQL: see how much data you have, then export it.
Pick a system to see two things: how to check how much data is in it, and how to export a copy. No form, no sign-in.
PostgreSQL
Data, dev & IT
How to see how much data is in PostgreSQL
- Connect to the server with psql or an admin tool as a superuser
- Run SELECT datname, pg_size_pretty(pg_database_size(datname)) FROM pg_database;
- Note the size of each database
- Add up the databases you need to keep
Record database size on disk; it includes indexes, and backups or WAL archives are stored separately.
PostgreSQL’s official instructions
How to get a copy of your PostgreSQL data
- Get a database user with read access to all tables
- On a computer with PostgreSQL tools, open a terminal
- Run pg_dump -Fc -d yourdb -f yourdb.dump for each database
- Run pg_dumpall --globals-only to save roles
- Store the files somewhere secure
Someone with database access runs pg_dump to export a database as an SQL script or an archive file. pg_dumpall covers the whole server, including roles.
pg_dump exports one database at a time and leaves out roles, so check whether you have several databases.
These instructions are written by DataFrenzy from each vendor’s public help pages. Menu names can vary by plan and change over time; the official link on each guide is the final word. Screenshots come from each vendor’s own help pages and videos or, where noted, from third-party tutorials credited under the image; dashed outlines are illustrations, not screenshots. Looking up a size or preparing an export never sends anything to DataFrenzy.