Similar to this question about MySQL -- I need to find out the size of a dump file prior dumping but for a PostgreSQL Database. I could not find any reference to this in the documentation

2 Answers 2


A very rough estimate is to compute the size of all tables with:

select pg_size_pretty(sum(pg_table_size(tablename::regclass))) 
from pg_tables 
where schemaname not in ('pg_catalog','information_schema');

It's hard to predict the size of the dump file. large fields will be compressed using LZ77 so the result could be larger than the table files. integers, dates, and timestamps, expressed in ASCII are larger than they are on disk.

Dumps don't have slack space, or indices, so the result could be smaller that file sizes of the database.

If you compress the dump it could compress by 90%

If you want certainty you really have to suck it and see. Eg pipe pg_dump output to a byte counter

 pg_dump  datname | wc --bytes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.