Re: Database size on disk

From: dinesh kumar <dineshkumar02(at)gmail(dot)com>
To: "Quiroga, Damian" <damian(dot)quiroga(at)intel(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Database size on disk
Date: 2015-10-05 21:02:11
Message-ID: CALnrH7qrOUvBXy3aWABfC31anYq_ZBJ8sjLTUXNmkGWhDbOPkw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Oct 5, 2015 at 12:47 PM, Quiroga, Damian <damian(dot)quiroga(at)intel(dot)com>
wrote:

> Hi,
>
>
>
> I’m looking for some advice on how to determine the DB size on disk to
> trigger some cleanup tasks (deleting old data) if some threshold is reached.
>
>
>
> Let’s say that for simplicity I don’t want to ask for the size on disk to
> the OS, but rather to PostgreSQL itself. And I only have a single database
> other than the defaults (‘template’, etc).
>
>
>
> In that scenario is using pg_database_size() reasonable? Does that
> function return the actual size on disk or is it a calculation? Is there a
> better alternative?
>
>
>

Yes, pg_database_size() gives the size from disk level. IIRC, it do "du -h
<DB oid folder>" kind of method.

> Thanks,
>
>
>
> Damian
>

--

Regards,
Dinesh
manojadinesh.blogspot.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Kevin Grittner 2015-10-05 21:17:52 Re: Serialization errors despite KEY SHARE/NO KEY UPDATE
Previous Message Quiroga, Damian 2015-10-05 19:47:03 Database size on disk