pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: raf <raf@raf.org>
To: pgsql-admin@lists.postgresql.org
Subject: Re: Newbie needs help with space issue
Date: Wed, 22 Apr 2020 13:51:32 +1000
Message-ID: <20200422035132.7xxbyti7p7ir2y3r@raf.org> (raw)
In-Reply-To: <CAKkXB5Hx0h+qzWgkxTKJXp_pGKbVTzZLmepPhP2rQjcJrxDVfQ@mail.gmail.com>
References: <CAKkXB5Hx0h+qzWgkxTKJXp_pGKbVTzZLmepPhP2rQjcJrxDVfQ@mail.gmail.com>

Jesse Josserand wrote:

> I apologize in advance for bothering you, but I've not been able to get
> answers from the community by searches I've done, nor have I figured out
> how to post a question there.
> 
> I'm working for a gov't entity here in Mississippi and while I have
> extensive Oracle and MySQL experience, as well as Linux admin experience
> (which is what I was hired for), I've been given PostgreSQL DBA
> responsibilities since the last DBA quit abruptly (probably due to poor
> architecture and documentation here -- another thing I'm resolving).
> 
> I'm having serious space issues in a production environment and psql
> commands and queries are not helping me isolate it nor determine the root
> cause... possibly due to my naivete.
> 
> Would you be so kind as to give me some insight as to how to best determine
> what is growing to fast and why? I have a 20G disk that recently was
> increased to 40G and am now in less than 3 months almost out of space there
> again.
> 
> Yours truly,
> Jesse Josserand, CTO
> IT Web Services, LLC <https://itwebservicesllc.com/; and
> Ace Consulting Solutions, Inc. <https://aceconsultingsolutionsinc.com/;

Hi,

Here's a query to list individual table sizes:

    select
        t.tablename as "object",
        pg_size_pretty(pg_relation_size(cast(t.tablename as text))) as "data",
        pg_size_pretty(pg_total_relation_size(cast(t.tablename as text))) as "total"
    from
        pg_tables t
    where
        t.schemaname = 'public'
    order by
        pg_total_relation_size(cast(t.tablename as text)) desc

I think the last column includes index sizes.

Running this repeatedly over time should show what's growing.

cheers,
raf






view thread (6+ messages)  latest in thread

Message-ID: <20200422035132.7xxbyti7p7ir2y3r@raf.org>
Permalink:  ../20200422035132.7xxbyti7p7ir2y3r@raf.org/
Also on:    postgresql.org/message-id/20200422035132.7xxbyti7p7ir2y3r@raf.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: raf@raf.org
  Subject: Re: Newbie needs help with space issue
  In-Reply-To: <20200422035132.7xxbyti7p7ir2y3r@raf.org>
  References: <CAKkXB5Hx0h+qzWgkxTKJXp_pGKbVTzZLmepPhP2rQjcJrxDVfQ@mail.gmail.com> <20200422035132.7xxbyti7p7ir2y3r@raf.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox