Re: DB Size - How much is growing - PostgreSQL 9.2

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "drum(dot)lucas(at)gmail(dot)com" <drum(dot)lucas(at)gmail(dot)com>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: DB Size - How much is growing - PostgreSQL 9.2
Date: 2016-04-18 23:03:12
Message-ID: CAKFQuwYkz93H+SQJdikrB-fUN7SZ==tvdspSPSC_6DrvkK-5iQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Mon, Apr 18, 2016 at 3:46 PM, drum(dot)lucas(at)gmail(dot)com <drum(dot)lucas(at)gmail(dot)com>
wrote:

> Hi all,
>
> I'm using the following query to get the actual size of my DB:
>
>> select t1.datname AS db_name,
>> pg_size_pretty(pg_database_size(t1.datname)) as db_size
>> from pg_database t1
>> order by pg_database_size(t1.datname) desc;
>
>
> However I need to know how big is the database over the last month...
> Need to know how much has the DB grown up by month...
>
> I did had a Munin and MRTG graphs but the server went down and we don't
> have access to it anymore...
>
> Is there any way to me get those data?
>
>
​Take a measurement now, wait a month, take another measurement, the
extrapolate backwards...​

​There is no way to execute a query within a running PostgreSQL
cluster/database and obtain its size at any other time besides that exact
moment.

Without access to some past measurement knowing the present size does you
little good when it comes to estimating change - you need at least two data
points. If you happen to have a pg_dump from the past and one from now you
could use that for extrapolation purposes.

David J.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message drum.lucas@gmail.com 2016-04-20 23:00:12 Tablespace - PostgreSQL 9.2
Previous Message drum.lucas@gmail.com 2016-04-18 22:46:25 DB Size - How much is growing - PostgreSQL 9.2