From: | Jimmy Augustine <jimmy(dot)augustine(at)enyx(dot)fr> |
---|---|
To: | Melvin Davidson <melvin6925(at)gmail(dot)com> |
Cc: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, "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:27:42 |
Message-ID: | CAF3uhZE=2B8S7W36uRXHXG1j6dkj7K4Sa9joV65sdau5RO3ZOg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I tried this query and my database size is equal to 162GB.
2018-03-19 18:17 GMT+01:00 Melvin Davidson <melvin6925(at)gmail(dot)com>:
>
>
> On Mon, Mar 19, 2018 at 1:12 PM, Jimmy Augustine <jimmy(dot)augustine(at)enyx(dot)fr>
> wrote:
>
>>
>>
>> 2018-03-19 18:09 GMT+01:00 Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>:
>>
>>> On 03/19/2018 10:04 AM, Jimmy Augustine wrote:
>>>
>>>>
>>>>
>>>> 2018-03-19 17:45 GMT+01:00 Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com
>>>> <mailto:adrian(dot)klaver(at)aklaver(dot)com>>:
>>>>
>>>> On 03/19/2018 09:31 AM, Jimmy Augustine wrote:
>>>>
>>>> Dear Friends,
>>>>
>>>> I am newbie to postgresql.
>>>> I have 162 GB on my database but when I check size of all
>>>> tables, I approximately obtain 80 GB.
>>>> I also see that I have 68GB of temporary files however I only
>>>> found 2.4MB at postgres/data/base/pgsql_tmp.
>>>>
>>>>
>>>> Exactly how did you determine this?
>>>>
>>>> I used this command and sum result for all database :
>>>> SELECT pg_size_pretty(pg_total_relation_size('table_name'));
>>>>
>>>> And this for complete database :
>>>> SELECT pg_size_pretty(pg_database_size('Database Name'));
>>>>
>>>>
>>> So where did the 68GB number for temporary files come from?
>>>
>>> I don't measure this value by my own. I was disappointed by the gap
>> between the two queries, so I checked pgAdmin 4 and I saw this value.
>>
>>>
>>> --
>>> Adrian Klaver
>>> adrian(dot)klaver(at)aklaver(dot)com
>>>
>>
>>
>
>
> *>I don't measure this value by my own. I was disappointed by the gap
> between the two queries, so I checked pgAdmin 4 and I saw this value. *
>
> *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.*
>
>
>
>
>
>
>
>
>
>
>
>
> *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!
>
From | Date | Subject | |
---|---|---|---|
Next Message | Jimmy Augustine | 2018-03-19 17:29:35 | Re: PostgreSQL 9.6 Temporary files |
Previous Message | Adrian Klaver | 2018-03-19 17:25:51 | Re: PostgreSQL 9.6 Temporary files |