Re: Determining size of a database before dumping - Mailing list pgsql-general

From Madison Kelly
Subject Re: Determining size of a database before dumping
Date
Msg-id 4521819A.6030101@alteeve.com
Whole thread Raw
In response to Re: Determining size of a database before dumping  (Alexander Staubo <alex@purefiction.net>)
List pgsql-general
Alexander Staubo wrote:
> On Oct 2, 2006, at 22:17 , Madison Kelly wrote:
>
>>   I am (re)writing a backup program and I want to add a section for
>> backing up pSQL DBs. In the planning steps (making sure a given
>> destination has enough space) I try to calculate how much space will
>> be needed by a 'pg_dump' run *before* actually dumping it.
>>
>>   Is there a relatively easy way to do that? Moreso, if it possible to
>> do this from an unpriviledged account? If not, is there a way to add
>> the permissions to a specific pg user to allow that user to perform this?
>
> You could dump the database to /dev/null, piping it through wc to catch
> the size, but that would of course be wasteful.
>
> You could count the disk space usage of the actual stored tuples, though
> this will necessarily be inexact:
>
>   http://www.postgresql.org/docs/8.1/static/diskusage.html
>
> Or you could count the size of the physical database files
> (/var/lib/postgresql or wherever). While these would be estimates, you
> could at least guarantee that the dump would not *exceed* the esimtate.
>
> Keep in mind that pg_dump can compress the dump and (iirc) will do so by
> default when you use the custom format (-Fc or --format=c).
>
> Alexander.

Heh, that looks like just the article I would have wanted if I had
properly RTFM. :D

Many thanks!!

Madi

pgsql-general by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Re: Performance and Generic Config after install
Next
From: Tom Lane
Date:
Subject: Re: Determining size of a database before dumping