pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Melvin Davidson <melvin6925@gmail.com>
To: Jimmy Augustine <jimmy.augustine@enyx.fr>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: PostgreSQL 9.6 Temporary files
Date: Mon, 19 Mar 2018 10:25:51 -0700
Message-ID: <0305cab0-ff73-09f0-6f9a-c3a065f69a02@aklaver.com> (raw)
In-Reply-To: <CANu8FixxaprfCCVJ_VYWCJi=Uu7sPFDeykEKsMwGCe8n5K8Xrg@mail.gmail.com>
References: <CAF3uhZEOcin4X743uiB-bbvs6yRtov8QB=MDFDi1mSPnHDcd+Q@mail.gmail.com>
	<8348151d-96a8-c693-8dc1-21dcfb3e587e@aklaver.com>
	<CAF3uhZHW9mdSygjEy3fCoGL7X7R+s358N2AD+T6HRmJj6FjF4w@mail.gmail.com>
	<b9c42dc4-bac7-0a6d-a4cb-f4ba21aaf9c6@aklaver.com>
	<CAF3uhZHu5BL7FP+S73EKzFBJCeinRkqhtdMVcYksDr032tw4Pg@mail.gmail.com>
	<CANu8FixxaprfCCVJ_VYWCJi=Uu7sPFDeykEKsMwGCe8n5K8Xrg@mail.gmail.com>

On 03/19/2018 10:17 AM, Melvin Davidson wrote:
> 
> 

> *
> *I think your problem is that SELECT 
> pg_size_pretty(pg_total_relation_size('table_name')); only looks at the 
> current database


> *
> *but SELECT pg_size_pretty(pg_database_size('Database Name')); looks at 
> ALL databases.

Not according to here:

https://www.postgresql.org/docs/10/static/functions-admin.html#FUNCTIONS-ADMIN-DBOBJECT
> 
> *
> *Try this query instead to show individual database sizes.
> 
> SELECT oid,
>         datname,
>         pg_size_pretty(pg_database_size(datname))as size_pretty,
>         pg_database_size(datname) as size,
>         (SELECT pg_size_pretty (SUM( pg_database_size(datname))::bigint)
>            FROM pg_database)  AS total,
>         ((pg_database_size(datname) / (SELECT SUM( 
> pg_database_size(datname))
>                                         FROM pg_database) ) * 
> 100)::numeric(6,3) AS pct
>    FROM pg_database
>    ORDER BY datname;
> *
> 
> -- 
> *Melvin Davidson**
> Maj. Database & Exploration Specialist**
> Universe Exploration Command – UXC***
> Employment by invitation only!


-- 
Adrian Klaver
adrian.klaver@aklaver.com




view thread (22+ messages)  latest in thread

Message-ID: <0305cab0-ff73-09f0-6f9a-c3a065f69a02@aklaver.com>
Permalink:  ../0305cab0-ff73-09f0-6f9a-c3a065f69a02@aklaver.com/
Also on:    postgresql.org/message-id/0305cab0-ff73-09f0-6f9a-c3a065f69a02@aklaver.com

 · 

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-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, melvin6925@gmail.com, jimmy.augustine@enyx.fr
  Subject: Re: PostgreSQL 9.6 Temporary files
  In-Reply-To: <0305cab0-ff73-09f0-6f9a-c3a065f69a02@aklaver.com>
  References: <CAF3uhZEOcin4X743uiB-bbvs6yRtov8QB=MDFDi1mSPnHDcd+Q@mail.gmail.com> <8348151d-96a8-c693-8dc1-21dcfb3e587e@aklaver.com> <CAF3uhZHW9mdSygjEy3fCoGL7X7R+s358N2AD+T6HRmJj6FjF4w@mail.gmail.com> <b9c42dc4-bac7-0a6d-a4cb-f4ba21aaf9c6@aklaver.com> <CAF3uhZHu5BL7FP+S73EKzFBJCeinRkqhtdMVcYksDr032tw4Pg@mail.gmail.com> <CANu8FixxaprfCCVJ_VYWCJi=Uu7sPFDeykEKsMwGCe8n5K8Xrg@mail.gmail.com> <0305cab0-ff73-09f0-6f9a-c3a065f69a02@aklaver.com>

* 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