Re: pg_database_size differs from df -s

From: Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: pg_database_size differs from df -s
Date: 2012-06-06 15:58:28
Message-ID: 4FCF7E24.4000000@frank.uvena.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Am 06.06.2012 17:49, schrieb Tom Lane:
> Frank Lanitz <frank(at)frank(dot)uvena(dot)de> writes:
>> I've got an issue I'm not sure I might have a misunderstanding. When
>> calling
>
>> select sum(pg_database_size(datid)) as total_size from pg_stat_database
>
>> the result is much bigger than running a df -s over the postgres folder
>> - Its about factor 5 to 10 depending on database.
>
> Did you mean "du -s"?

Yepp, sure. Was to confused about the two numbers. ;)

>> My understanding was, pg_database_size is the database size on disc. Am
>> I misunderstanding the docu here?
>
> For me, pg_database_size gives numbers that match up fairly well with
> what "du" says. I would not expect an exact match, since du probably
> knows about filesystem overhead (such as metadata) whereas
> pg_database_size does not. Something's fishy if it's off by any large
> factor, though. Perhaps you have some tables in a nondefault
> tablespace, where du isn't seeing them?

Nope. Its a pretty much clean database without any fancy stuff.

Cheers,
Frank

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Manoj Govindassamy 2012-06-06 16:16:16 Re: Postgres 9.1 Synchronous Replication and stuck queries during sync repl setup
Previous Message Gabriele Bartolini 2012-06-06 15:51:46 Re: Postgres 9.1 Synchronous Replication and stuck queries during sync repl setup