Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jR6QH-00089f-Tp for pgsql-admin@arkaria.postgresql.org; Wed, 22 Apr 2020 03:51:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jR6QF-0003ii-OT for pgsql-admin@arkaria.postgresql.org; Wed, 22 Apr 2020 03:51:39 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jR6QF-0003iP-Gy for pgsql-admin@lists.postgresql.org; Wed, 22 Apr 2020 03:51:39 +0000 Received: from ook.raf.org ([139.99.156.21]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jR6QC-0003g4-OD for pgsql-admin@lists.postgresql.org; Wed, 22 Apr 2020 03:51:38 +0000 Received: from localhost (localhost [127.0.0.1]) by ook.raf.org (Postfix) with ESMTP id 0E8075DE35 for ; Wed, 22 Apr 2020 13:51:33 +1000 (AEST) X-Virus-Scanned: Debian amavisd-new at ook.raf.org Received: from ook.raf.org ([127.0.0.1]) by localhost (ook.raf.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Lr2Km1gTTu7U for ; Wed, 22 Apr 2020 13:51:32 +1000 (AEST) Received: by ook.raf.org (Postfix, from userid 1001) id B06895DEBC; Wed, 22 Apr 2020 13:51:32 +1000 (AEST) Date: Wed, 22 Apr 2020 13:51:32 +1000 From: raf To: pgsql-admin@lists.postgresql.org Subject: Re: Newbie needs help with space issue Message-ID: <20200422035132.7xxbyti7p7ir2y3r@raf.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 and > Ace Consulting Solutions, Inc. 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