snippetsqlMinor
How to estimate the size of a PostgreSQL DB to be dumped through pg_dump
Viewed 0 times
postgresqlestimatethepg_dumpthroughsizedumpedhow
Problem
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
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
Solution
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');Code Snippets
select pg_size_pretty(sum(pg_table_size(tablename::regclass)))
from pg_tables
where schemaname not in ('pg_catalog','information_schema');Context
StackExchange Database Administrators Q#264427, answer score: 4
Revisions (0)
No revisions yet.