From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Melvin Davidson <melvin6925(at)gmail(dot)com>, Jimmy Augustine <jimmy(dot)augustine(at)enyx(dot)fr> |
Cc: | "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: PostgreSQL 9.6 Temporary files |
Date: | 2018-03-19 17:25:51 |
Message-ID: | 0305cab0-ff73-09f0-6f9a-c3a065f69a02@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Jimmy Augustine | 2018-03-19 17:27:42 | Re: PostgreSQL 9.6 Temporary files |
Previous Message | Andreas Kretschmer | 2018-03-19 17:25:11 | Re: PostgreSQL 9.6 Temporary files |