pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
PostgreSQL 9.6 Temporary files
22+ messages / 4 participants
[nested] [flat]

* PostgreSQL 9.6 Temporary files
@ 2018-03-19 16:31  Jimmy Augustine <jimmy.augustine@enyx.fr>
  0 siblings, 2 replies; 22+ messages in thread

From: Jimmy Augustine @ 2018-03-19 16:31 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

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.

Could you tell me what are those temporary files and where are they at? Can
I delete some of them?

All values come from pgAdmin 4 and checked by my own SQL
queries(postgresql-9.6).
I already run vacuum full and there is few dead tuples.

Best regards,
Jimmy AUGUSTINE

^ permalink  raw  reply  [nested|flat] 22+ messages in thread

* Re: PostgreSQL 9.6 Temporary files
@ 2018-03-19 16:44  Andreas Kretschmer <andreas@a-kretschmer.de>
  parent: Jimmy Augustine <jimmy.augustine@enyx.fr>
  1 sibling, 1 reply; 22+ messages in thread

From: Andreas Kretschmer @ 2018-03-19 16:44 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org; Jimmy Augustine <jimmy.augustine@enyx.fr>

On 19 March 2018 17:31:20 CET, Jimmy Augustine <jimmy.augustine@enyx.fr> 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.


Indexes?


>I also see that I have 68GB of temporary files however I only found

Where can you see that?


>2.4MB
>at postgres/data/base/pgsql_tmp.
>
>Could you tell me what are those temporary files and where are they at?
>Can
>I delete some of them?


No, never delete files in datadir!

>
>All values come from pgAdmin 4 and checked by my own SQL
>queries(postgresql-9.6).
>I already run vacuum full and there is few dead tuples.

A few dead tuples arn't a real problem.


>
>Best regards,
>Jimmy AUGUSTINE


-- 
2ndQuadrant - The PostgreSQL Support Company




^ permalink  raw  reply  [nested|flat] 22+ messages in thread

* Re: PostgreSQL 9.6 Temporary files
@ 2018-03-19 16:45  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Jimmy Augustine <jimmy.augustine@enyx.fr>
  1 sibling, 2 replies; 22+ messages in thread

From: Adrian Klaver @ 2018-03-19 16:45 UTC (permalink / raw)
  To: Jimmy Augustine <jimmy.augustine@enyx.fr>; pgsql-general@lists.postgresql.org

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?

> 
> Could you tell me what are those temporary files and where are they at? 
> Can I delete some of them?
> 
> All values come from pgAdmin 4 and checked by my own SQL 
> queries(postgresql-9.6).

Can you show actual queries used?

> I already run vacuum full and there is few dead tuples.
> 
> Best regards,
> Jimmy AUGUSTINE


-- 
Adrian Klaver
adrian.klaver@aklaver.com




^ permalink  raw  reply  [nested|flat] 22+ messages in thread

* Re: PostgreSQL 9.6 Temporary files
@ 2018-03-19 17:01  Melvin Davidson <melvin6925@gmail.com>
  parent: Adrian Klaver <adrian.klaver@aklaver.com>
  1 sibling, 1 reply; 22+ messages in thread

From: Melvin Davidson @ 2018-03-19 17:01 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: Jimmy Augustine <jimmy.augustine@enyx.fr>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On Mon, Mar 19, 2018 at 12:45 PM, Adrian Klaver <adrian.klaver@aklaver.com>
wrote:

> 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?
>
>
>> Could you tell me what are those temporary files and where are they at?
>> Can I delete some of them?
>>
>> All values come from pgAdmin 4 and checked by my own SQL
>> queries(postgresql-9.6).
>>
>
> Can you show actual queries used?
>
> I already run vacuum full and there is few dead tuples.
>>
>> Best regards,
>> Jimmy AUGUSTINE
>>
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>
> > 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.


*I am not sure what your query was that deteremined table and index sizes,
but try using the query instead.*

*Note that total_size is the size of the table and all it's indexes.*




























*SELECT n.nspname as schema,       c.relname as table,       a.rolname as
owner,       c.relfilenode as filename,       c.reltuples::bigint,
pg_size_pretty(pg_relation_size(quote_ident(n.nspname) || '.' ||
quote_ident(c.relname) )) as size,
pg_size_pretty(pg_total_relation_size(quote_ident(n.nspname) || '.' ||
quote_ident(c.relname) )) as total_size,
pg_relation_size(quote_ident(n.nspname) || '.' || quote_ident(c.relname) )
as size_bytes,       pg_total_relation_size(quote_ident(n.nspname) || '.'
|| quote_ident(c.relname) ) as total_size_bytes,       CASE WHEN
c.reltablespace = 0            THEN 'pg_default'            ELSE (SELECT
t.spcname                     FROM pg_tablespace t WHERE (t.oid =
c.reltablespace) )                            END as tablespaceFROM
pg_class c  JOIN pg_namespace n ON (n.oid = c.relnamespace)  JOIN pg_authid
a ON ( a.oid = c.relowner )  WHERE quote_ident(nspname) NOT LIKE 'pg_%'
AND quote_ident(relname) NOT LIKE 'pg_%'     AND quote_ident(relname) NOT
LIKE 'information%'     AND quote_ident(relname) NOT LIKE 'sql_%'     AND
quote_ident(relkind) IN ('r')ORDER BY total_size_bytes DESC, 1, 2;-- *



*Melvin DavidsonMaj. Database & Exploration SpecialistUniverse Exploration
Command – UXCEmployment by invitation only!*

^ permalink  raw  reply  [nested|flat] 22+ messages in thread

* Re: PostgreSQL 9.6 Temporary files
@ 2018-03-19 17:02  Jimmy Augustine <jimmy.augustine@enyx.fr>
  parent: Andreas Kretschmer <andreas@a-kretschmer.de>
  0 siblings, 0 replies; 22+ messages in thread

From: Jimmy Augustine @ 2018-03-19 17:02 UTC (permalink / raw)
  To: Andreas Kretschmer <andreas@a-kretschmer.de>; +Cc: pgsql-general@lists.postgresql.org

Hi Andreas thanks for your response,

2018-03-19 17:44 GMT+01:00 Andreas Kretschmer <andreas@a-kretschmer.de>:

> On 19 March 2018 17:31:20 CET, Jimmy Augustine <jimmy.augustine@enyx.fr>
> 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.
>
>
> Indexes?
>
> Indexes are included into 80 GB that I mentioned.

>I also see that I have 68GB of temporary files however I only found
>
> Where can you see that?
>
> I used pgAdmin 4 and I see statistics on my global database.

>2.4MB
> >at postgres/data/base/pgsql_tmp.
> >
> >Could you tell me what are those temporary files and where are they at?
> >Can
> >I delete some of them?
>
>
> No, never delete files in datadir!
>
> >
> >All values come from pgAdmin 4 and checked by my own SQL
> >queries(postgresql-9.6).
> >I already run vacuum full and there is few dead tuples.
>
> A few dead tuples arn't a real problem.
>
>
> >
> >Best regards,
> >Jimmy AUGUSTINE
>
>
> --
> 2ndQuadrant - The PostgreSQL Support Company
>

^ permalink  raw  reply  [nested|flat] 22+ messages in thread

* Re: PostgreSQL 9.6 Temporary files
@ 2018-03-19 17:04  Jimmy Augustine <jimmy.augustine@enyx.fr>
  parent: Adrian Klaver <adrian.klaver@aklaver.com>
  1 sibling, 1 reply; 22+ messages in thread

From: Jimmy Augustine @ 2018-03-19 17:04 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pgsql-general@lists.postgresql.org

2018-03-19 17:45 GMT+01:00 Adrian Klaver <adrian.klaver@aklaver.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'));


>
>> Could you tell me what are those temporary files and where are they at?
>> Can I delete some of them?
>>
>> All values come from pgAdmin 4 and checked by my own SQL
>> queries(postgresql-9.6).
>>
>
> Can you show actual queries used?
>
>
> I already run vacuum full and there is few dead tuples.
>>
>> Best regards,
>> Jimmy AUGUSTINE
>>
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>

^ permalink  raw  reply  [nested|flat] 22+ messages in thread

* Re: PostgreSQL 9.6 Temporary files
@ 2018-03-19 17:09  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Jimmy Augustine <jimmy.augustine@enyx.fr>
  0 siblings, 1 reply; 22+ messages in thread

From: Adrian Klaver @ 2018-03-19 17:09 UTC (permalink / raw)
  To: Jimmy Augustine <jimmy.augustine@enyx.fr>; +Cc: pgsql-general@lists.postgresql.org

On 03/19/2018 10:04 AM, Jimmy Augustine wrote:
> 
> 
> 2018-03-19 17:45 GMT+01:00 Adrian Klaver <adrian.klaver@aklaver.com 
> <mailto:adrian.klaver@aklaver.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?



-- 
Adrian Klaver
adrian.klaver@aklaver.com




^ permalink  raw  reply  [nested|flat] 22+ messages in thread

* Re: PostgreSQL 9.6 Temporary files
@ 2018-03-19 17:12  Jimmy Augustine <jimmy.augustine@enyx.fr>
  parent: Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 2 replies; 22+ messages in thread

From: Jimmy Augustine @ 2018-03-19 17:12 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pgsql-general@lists.postgresql.org

2018-03-19 18:09 GMT+01:00 Adrian Klaver <adrian.klaver@aklaver.com>:

> On 03/19/2018 10:04 AM, Jimmy Augustine wrote:
>
>>
>>
>> 2018-03-19 17:45 GMT+01:00 Adrian Klaver <adrian.klaver@aklaver.com
>> <mailto:adrian.klaver@aklaver.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.klaver@aklaver.com
>

^ permalink  raw  reply  [nested|flat] 22+ messages in thread

* Re: PostgreSQL 9.6 Temporary files
@ 2018-03-19 17:15  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Jimmy Augustine <jimmy.augustine@enyx.fr>
  1 sibling, 1 reply; 22+ messages in thread

From: Adrian Klaver @ 2018-03-19 17:15 UTC (permalink / raw)
  To: Jimmy Augustine <jimmy.augustine@enyx.fr>; +Cc: pgsql-general@lists.postgresql.org

On 03/19/2018 10:12 AM, Jimmy Augustine wrote:

> 
>              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.

In what section of pgAdmin4?

Or do you know what query it used?

> 
> 
>     -- 
>     Adrian Klaver
>     adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com




^ permalink  raw  reply  [nested|flat] 22+ messages in thread

* Re: PostgreSQL 9.6 Temporary files
@ 2018-03-19 17:17  Melvin Davidson <melvin6925@gmail.com>
  parent: Jimmy Augustine <jimmy.augustine@enyx.fr>
  1 sibling, 2 replies; 22+ messages in thread

From: Melvin Davidson @ 2018-03-19 17:17 UTC (permalink / raw)
  To: Jimmy Augustine <jimmy.augustine@enyx.fr>; +Cc: Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On Mon, Mar 19, 2018 at 1:12 PM, Jimmy Augustine <jimmy.augustine@enyx.fr>
wrote:

>
>
> 2018-03-19 18:09 GMT+01:00 Adrian Klaver <adrian.klaver@aklaver.com>:
>
>> On 03/19/2018 10:04 AM, Jimmy Augustine wrote:
>>
>>>
>>>
>>> 2018-03-19 17:45 GMT+01:00 Adrian Klaver <adrian.klaver@aklaver.com
>>> <mailto:adrian.klaver@aklaver.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.klaver@aklaver.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!

^ permalink  raw  reply  [nested|flat] 22+ messages in thread

* Re: PostgreSQL 9.6 Temporary files
@ 2018-03-19 17:17  Jimmy Augustine <jimmy.augustine@enyx.fr>
  parent: Melvin Davidson <melvin6925@gmail.com>
  0 siblings, 1 reply; 22+ messages in thread

From: Jimmy Augustine @ 2018-03-19 17:17 UTC (permalink / raw)
  To: Melvin Davidson <melvin6925@gmail.com>; +Cc: Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

Hi,

I used this command and I found the same value in total_size column.

2018-03-19 18:01 GMT+01:00 Melvin Davidson <melvin6925@gmail.com>:

>
>
> On Mon, Mar 19, 2018 at 12:45 PM, Adrian Klaver <adrian.klaver@aklaver.com
> > wrote:
>
>> 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?
>>
>>
>>> Could you tell me what are those temporary files and where are they at?
>>> Can I delete some of them?
>>>
>>> All values come from pgAdmin 4 and checked by my own SQL
>>> queries(postgresql-9.6).
>>>
>>
>> Can you show actual queries used?
>>
>> I already run vacuum full and there is few dead tuples.
>>>
>>> Best regards,
>>> Jimmy AUGUSTINE
>>>
>>
>>
>> --
>> Adrian Klaver
>> adrian.klaver@aklaver.com
>>
>> > 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.
>
>
> *I am not sure what your query was that deteremined table and index sizes,
> but try using the query instead.*
>
> *Note that total_size is the size of the table and all it's indexes.*
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *SELECT n.nspname as schema,       c.relname as table,       a.rolname as
> owner,       c.relfilenode as filename,       c.reltuples::bigint,
> pg_size_pretty(pg_relation_size(quote_ident(n.nspname) || '.' ||
> quote_ident(c.relname) )) as size,
> pg_size_pretty(pg_total_relation_size(quote_ident(n.nspname) || '.' ||
> quote_ident(c.relname) )) as total_size,
> pg_relation_size(quote_ident(n.nspname) || '.' || quote_ident(c.relname) )
> as size_bytes,       pg_total_relation_size(quote_ident(n.nspname) || '.'
> || quote_ident(c.relname) ) as total_size_bytes,       CASE WHEN
> c.reltablespace = 0            THEN 'pg_default'            ELSE (SELECT
> t.spcname                     FROM pg_tablespace t WHERE (t.oid =
> c.reltablespace) )                            END as tablespaceFROM
> pg_class c  JOIN pg_namespace n ON (n.oid = c.relnamespace)  JOIN pg_authid
> a ON ( a.oid = c.relowner )  WHERE quote_ident(nspname) NOT LIKE 'pg_%'
> AND quote_ident(relname) NOT LIKE 'pg_%'     AND quote_ident(relname) NOT
> LIKE 'information%'     AND quote_ident(relname) NOT LIKE 'sql_%'     AND
> quote_ident(relkind) IN ('r')ORDER BY total_size_bytes DESC, 1, 2;-- *
>
>
>
> *Melvin DavidsonMaj. Database & Exploration SpecialistUniverse Exploration
> Command – UXCEmployment by invitation only!*
>

^ permalink  raw  reply  [nested|flat] 22+ messages in thread

* Re: PostgreSQL 9.6 Temporary files
@ 2018-03-19 17:20  Melvin Davidson <melvin6925@gmail.com>
  parent: Jimmy Augustine <jimmy.augustine@enyx.fr>
  0 siblings, 0 replies; 22+ messages in thread

From: Melvin Davidson @ 2018-03-19 17:20 UTC (permalink / raw)
  To: Jimmy Augustine <jimmy.augustine@enyx.fr>; +Cc: Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On Mon, Mar 19, 2018 at 1:17 PM, Jimmy Augustine <jimmy.augustine@enyx.fr>
wrote:

> Hi,
>
> I used this command and I found the same value in total_size column.
>
> 2018-03-19 18:01 GMT+01:00 Melvin Davidson <melvin6925@gmail.com>:
>
>>
>>
>> On Mon, Mar 19, 2018 at 12:45 PM, Adrian Klaver <
>> adrian.klaver@aklaver.com> wrote:
>>
>>> 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?
>>>
>>>
>>>> Could you tell me what are those temporary files and where are they at?
>>>> Can I delete some of them?
>>>>
>>>> All values come from pgAdmin 4 and checked by my own SQL
>>>> queries(postgresql-9.6).
>>>>
>>>
>>> Can you show actual queries used?
>>>
>>> I already run vacuum full and there is few dead tuples.
>>>>
>>>> Best regards,
>>>> Jimmy AUGUSTINE
>>>>
>>>
>>>
>>> --
>>> Adrian Klaver
>>> adrian.klaver@aklaver.com
>>>
>>> > 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.
>>
>>
>> *I am not sure what your query was that deteremined table and index
>> sizes, but try using the query instead.*
>>
>> *Note that total_size is the size of the table and all it's indexes.*
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *SELECT n.nspname as schema,       c.relname as table,       a.rolname as
>> owner,       c.relfilenode as filename,       c.reltuples::bigint,
>> pg_size_pretty(pg_relation_size(quote_ident(n.nspname) || '.' ||
>> quote_ident(c.relname) )) as size,
>> pg_size_pretty(pg_total_relation_size(quote_ident(n.nspname) || '.' ||
>> quote_ident(c.relname) )) as total_size,
>> pg_relation_size(quote_ident(n.nspname) || '.' || quote_ident(c.relname) )
>> as size_bytes,       pg_total_relation_size(quote_ident(n.nspname) || '.'
>> || quote_ident(c.relname) ) as total_size_bytes,       CASE WHEN
>> c.reltablespace = 0            THEN 'pg_default'            ELSE (SELECT
>> t.spcname                     FROM pg_tablespace t WHERE (t.oid =
>> c.reltablespace) )                            END as tablespaceFROM
>> pg_class c  JOIN pg_namespace n ON (n.oid = c.relnamespace)  JOIN pg_authid
>> a ON ( a.oid = c.relowner )  WHERE quote_ident(nspname) NOT LIKE 'pg_%'
>> AND quote_ident(relname) NOT LIKE 'pg_%'     AND quote_ident(relname) NOT
>> LIKE 'information%'     AND quote_ident(relname) NOT LIKE 'sql_%'     AND
>> quote_ident(relkind) IN ('r')ORDER BY total_size_bytes DESC, 1, 2;-- *
>>
>>
>>
>> *Melvin DavidsonMaj. Database & Exploration SpecialistUniverse
>> Exploration Command – UXCEmployment by invitation only!*
>>
>
>


*>I used this command and I found the same value in total_size column. *

*Please be specific. Exactly WHAT is the SQL query? *


-- 
*Melvin Davidson*
*Maj. Database & Exploration Specialist*
*Universe Exploration Command – UXC*
Employment by invitation only!

^ permalink  raw  reply  [nested|flat] 22+ messages in thread

* Re: PostgreSQL 9.6 Temporary files
@ 2018-03-19 17:21  Jimmy Augustine <jimmy.augustine@enyx.fr>
  parent: Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 1 reply; 22+ messages in thread

From: Jimmy Augustine @ 2018-03-19 17:21 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

2018-03-19 18:15 GMT+01:00 Adrian Klaver <adrian.klaver@aklaver.com>:

> On 03/19/2018 10:12 AM, Jimmy Augustine wrote:
>
>
>>              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.
>>
>
> In what section of pgAdmin4?
>
In section "Statistics" when I click on my database.

Or do you know what query it used?
>
I have found this but not sure

SELECT temp_files AS "Temporary files"
     , temp_bytes AS "Size of temporary files"FROM   pg_stat_database db;


>>
>>     --     Adrian Klaver
>>     adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>>
>>
>>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>

^ permalink  raw  reply  [nested|flat] 22+ messages in thread

* Re: PostgreSQL 9.6 Temporary files
@ 2018-03-19 17:25  Andreas Kretschmer <andreas@a-kretschmer.de>
  parent: Jimmy Augustine <jimmy.augustine@enyx.fr>
  0 siblings, 1 reply; 22+ messages in thread

From: Andreas Kretschmer @ 2018-03-19 17:25 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org; Jimmy Augustine <jimmy.augustine@enyx.fr>; Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On 19 March 2018 18:21:42 CET, Jimmy Augustine <jimmy.augustine@enyx.fr> wrote:
>2018-03-19 18:15 GMT+01:00 Adrian Klaver <adrian.klaver@aklaver.com>:
>
>> On 03/19/2018 10:12 AM, Jimmy Augustine wrote:
>>
>>
>>>              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.
>>>
>>
>> In what section of pgAdmin4?
>>
>In section "Statistics" when I click on my database.
>
>Or do you know what query it used?
>>
>I have found this but not sure
>
>SELECT temp_files AS "Temporary files"
>   , temp_bytes AS "Size of temporary files"FROM   pg_stat_database db;


That's aggregated. Not current values.

Andreas


-- 
2ndQuadrant - The PostgreSQL Support Company




^ permalink  raw  reply  [nested|flat] 22+ messages in thread

* Re: PostgreSQL 9.6 Temporary files
@ 2018-03-19 17:25  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Melvin Davidson <melvin6925@gmail.com>
  1 sibling, 0 replies; 22+ messages in thread

From: Adrian Klaver @ 2018-03-19 17:25 UTC (permalink / raw)
  To: Melvin Davidson <melvin6925@gmail.com>; Jimmy Augustine <jimmy.augustine@enyx.fr>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

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




^ permalink  raw  reply  [nested|flat] 22+ messages in thread

* Re: PostgreSQL 9.6 Temporary files
@ 2018-03-19 17:27  Jimmy Augustine <jimmy.augustine@enyx.fr>
  parent: Melvin Davidson <melvin6925@gmail.com>
  1 sibling, 1 reply; 22+ messages in thread

From: Jimmy Augustine @ 2018-03-19 17:27 UTC (permalink / raw)
  To: Melvin Davidson <melvin6925@gmail.com>; +Cc: Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

I tried this query and my database size is equal to 162GB.

2018-03-19 18:17 GMT+01:00 Melvin Davidson <melvin6925@gmail.com>:

>
>
> On Mon, Mar 19, 2018 at 1:12 PM, Jimmy Augustine <jimmy.augustine@enyx.fr>
> wrote:
>
>>
>>
>> 2018-03-19 18:09 GMT+01:00 Adrian Klaver <adrian.klaver@aklaver.com>:
>>
>>> On 03/19/2018 10:04 AM, Jimmy Augustine wrote:
>>>
>>>>
>>>>
>>>> 2018-03-19 17:45 GMT+01:00 Adrian Klaver <adrian.klaver@aklaver.com
>>>> <mailto:adrian.klaver@aklaver.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.klaver@aklaver.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!
>

^ permalink  raw  reply  [nested|flat] 22+ messages in thread

* Re: PostgreSQL 9.6 Temporary files
@ 2018-03-19 17:29  Jimmy Augustine <jimmy.augustine@enyx.fr>
  parent: Andreas Kretschmer <andreas@a-kretschmer.de>
  0 siblings, 1 reply; 22+ messages in thread

From: Jimmy Augustine @ 2018-03-19 17:29 UTC (permalink / raw)
  To: Andreas Kretschmer <andreas@a-kretschmer.de>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>; Adrian Klaver <adrian.klaver@aklaver.com>

2018-03-19 18:25 GMT+01:00 Andreas Kretschmer <andreas@a-kretschmer.de>:

> On 19 March 2018 18:21:42 CET, Jimmy Augustine <jimmy.augustine@enyx.fr>
> wrote:
> >2018-03-19 18:15 GMT+01:00 Adrian Klaver <adrian.klaver@aklaver.com>:
> >
> >> On 03/19/2018 10:12 AM, Jimmy Augustine wrote:
> >>
> >>
> >>>              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.
> >>>
> >>
> >> In what section of pgAdmin4?
> >>
> >In section "Statistics" when I click on my database.
> >
> >Or do you know what query it used?
> >>
> >I have found this but not sure
> >
> >SELECT temp_files AS "Temporary files"
> >   , temp_bytes AS "Size of temporary files"FROM   pg_stat_database db;
>
>
> That's aggregated. Not current values.
>

Ah did you know some documentation about that ?

> Andreas
>
>
> --
> 2ndQuadrant - The PostgreSQL Support Company
>

^ permalink  raw  reply  [nested|flat] 22+ messages in thread

* Re: PostgreSQL 9.6 Temporary files
@ 2018-03-19 17:35  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Jimmy Augustine <jimmy.augustine@enyx.fr>
  0 siblings, 0 replies; 22+ messages in thread

From: Adrian Klaver @ 2018-03-19 17:35 UTC (permalink / raw)
  To: Jimmy Augustine <jimmy.augustine@enyx.fr>; Andreas Kretschmer <andreas@a-kretschmer.de>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On 03/19/2018 10:29 AM, Jimmy Augustine wrote:
> 
> 

> 
> 
>     That's aggregated. Not current values.
> 
> Ah did you know some documentation about that ?

https://www.postgresql.org/docs/10/static/monitoring-stats.html#PG-STAT-DATABASE-VIEW

> 
>     Andreas
> 
> 
>     --
>     2ndQuadrant - The PostgreSQL Support Company
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com




^ permalink  raw  reply  [nested|flat] 22+ messages in thread

* Re: PostgreSQL 9.6 Temporary files
@ 2018-03-19 18:32  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Jimmy Augustine <jimmy.augustine@enyx.fr>
  0 siblings, 1 reply; 22+ messages in thread

From: Adrian Klaver @ 2018-03-19 18:32 UTC (permalink / raw)
  To: Jimmy Augustine <jimmy.augustine@enyx.fr>; Melvin Davidson <melvin6925@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On 03/19/2018 10:27 AM, Jimmy Augustine wrote:
> I tried this query and my database size is equal to 162GB.
> 

Well you can always look in $DATA directly. The database will be under 
$DATA/base/<db oid>.

You can find the <db oid> like this:

select oid, datname from  pg_database where datname='<db name>';


-- 
Adrian Klaver
adrian.klaver@aklaver.com




^ permalink  raw  reply  [nested|flat] 22+ messages in thread

* Re: PostgreSQL 9.6 Temporary files
@ 2018-03-20 10:16  Jimmy Augustine <jimmy.augustine@enyx.fr>
  parent: Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 1 reply; 22+ messages in thread

From: Jimmy Augustine @ 2018-03-20 10:16 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: Melvin Davidson <melvin6925@gmail.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

Thanks all for your response,

$du -h $MY_DATA/base/$BASE_OID/ returns 162GB but when I execute this query:

SELECT stats.relname
           AS table,
       pg_size_pretty(pg_relation_size(statsio.relid))
           AS table_size,
       pg_size_pretty(pg_total_relation_size(statsio.relid)
           - pg_relation_size(statsio.relid))
           AS related_objects_size,
       pg_size_pretty(pg_total_relation_size(statsio.relid))
           AS total_table_size,
       stats.n_live_tup
           AS live_rows
  FROM pg_catalog.pg_statio_user_tables AS statsio
  JOIN pg_stat_user_tables AS stats
 USING (relname)
 WHERE stats.schemaname = current_schema
 UNION ALLSELECT 'TOTAL'
           AS table,
       pg_size_pretty(sum(pg_relation_size(statsio.relid)))
           AS table_size,
       pg_size_pretty(sum(pg_total_relation_size(statsio.relid)
           - pg_relation_size(statsio.relid)))
           AS related_objects_size,
       pg_size_pretty(sum(pg_total_relation_size(statsio.relid)))
           AS total_table_size,
       sum(stats.n_live_tup)
           AS live_rows
  FROM pg_catalog.pg_statio_user_tables AS statsio
  JOIN pg_stat_user_tables AS stats
 USING (relname)
 WHERE stats.schemaname = current_schema
 ORDER BY live_rows ASC;

I obtain 80GB in total_table_size (half of my database), where are
missing data at?


2018-03-19 19:32 GMT+01:00 Adrian Klaver <adrian.klaver@aklaver.com>:

> On 03/19/2018 10:27 AM, Jimmy Augustine wrote:
>
>> I tried this query and my database size is equal to 162GB.
>>
>>
> Well you can always look in $DATA directly. The database will be under
> $DATA/base/<db oid>.
>
> You can find the <db oid> like this:
>
> select oid, datname from  pg_database where datname='<db name>';
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>

^ permalink  raw  reply  [nested|flat] 22+ messages in thread

* Re: PostgreSQL 9.6 Temporary files
@ 2018-03-20 14:00  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Jimmy Augustine <jimmy.augustine@enyx.fr>
  0 siblings, 1 reply; 22+ messages in thread

From: Adrian Klaver @ 2018-03-20 14:00 UTC (permalink / raw)
  To: Jimmy Augustine <jimmy.augustine@enyx.fr>; +Cc: Melvin Davidson <melvin6925@gmail.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On 03/20/2018 03:16 AM, Jimmy Augustine wrote:
> Thanks all for your response,
> 
> $du -h $MY_DATA/base/$BASE_OID/ returns 162GB but when I execute this query:
> 
> |SELECT stats.relname AS table, 
> pg_size_pretty(pg_relation_size(statsio.relid)) AS table_size, 
> pg_size_pretty(pg_total_relation_size(statsio.relid) - 
> pg_relation_size(statsio.relid)) AS related_objects_size, 
> pg_size_pretty(pg_total_relation_size(statsio.relid)) AS 
> total_table_size, stats.n_live_tup AS live_rows FROM 
> pg_catalog.pg_statio_user_tables AS statsio JOIN pg_stat_user_tables AS 
> stats USING (relname) WHERE stats.schemaname = current_schemaUNION ALL 
> SELECT 'TOTAL' AS table, 
> pg_size_pretty(sum(pg_relation_size(statsio.relid))) AS table_size, 
> pg_size_pretty(sum(pg_total_relation_size(statsio.relid) - 
> pg_relation_size(statsio.relid))) AS related_objects_size, 
> pg_size_pretty(sum(pg_total_relation_size(statsio.relid))) AS 
> total_table_size, sum(stats.n_live_tup) AS live_rows FROM 
> pg_catalog.pg_statio_user_tables AS statsio JOIN pg_stat_user_tables AS 
> stats USING (relname) WHERE stats.schemaname = current_schemaORDER BY 
> live_rows ASC;
> 
> |
> 
> |I obtain 80GB in total_table_size (half of my database), where are 
> missing data at?

First of all you are using pg_statio_user_tables which does not count 
system tables.

Second pretty sure the use of current_schema is limiting the results to 
only one schema in the database.

> |
> 
> 
> 2018-03-19 19:32 GMT+01:00 Adrian Klaver <adrian.klaver@aklaver.com 
> <mailto:adrian.klaver@aklaver.com>>:
> 
>     On 03/19/2018 10:27 AM, Jimmy Augustine wrote:
> 
>         I tried this query and my database size is equal to 162GB.
> 
> 
>     Well you can always look in $DATA directly. The database will be
>     under $DATA/base/<db oid>.
> 
>     You can find the <db oid> like this:
> 
>     select oid, datname from  pg_database where datname='<db name>';
> 
> 
>     -- 
>     Adrian Klaver
>     adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com




^ permalink  raw  reply  [nested|flat] 22+ messages in thread

* Re: PostgreSQL 9.6 Temporary files
@ 2018-03-20 14:28  Jimmy Augustine <jimmy.augustine@enyx.fr>
  parent: Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 0 replies; 22+ messages in thread

From: Jimmy Augustine @ 2018-03-20 14:28 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: Melvin Davidson <melvin6925@gmail.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

2018-03-20 15:00 GMT+01:00 Adrian Klaver <adrian.klaver@aklaver.com>:

> On 03/20/2018 03:16 AM, Jimmy Augustine wrote:
>
>> Thanks all for your response,
>>
>> $du -h $MY_DATA/base/$BASE_OID/ returns 162GB but when I execute this
>> query:
>>
>> |SELECT stats.relname AS table, pg_size_pretty(pg_relation_size(statsio.relid))
>> AS table_size, pg_size_pretty(pg_total_relation_size(statsio.relid) -
>> pg_relation_size(statsio.relid)) AS related_objects_size,
>> pg_size_pretty(pg_total_relation_size(statsio.relid)) AS
>> total_table_size, stats.n_live_tup AS live_rows FROM
>> pg_catalog.pg_statio_user_tables AS statsio JOIN pg_stat_user_tables AS
>> stats USING (relname) WHERE stats.schemaname = current_schemaUNION ALL
>> SELECT 'TOTAL' AS table, pg_size_pretty(sum(pg_relation_size(statsio.relid)))
>> AS table_size, pg_size_pretty(sum(pg_total_relation_size(statsio.relid)
>> - pg_relation_size(statsio.relid))) AS related_objects_size,
>> pg_size_pretty(sum(pg_total_relation_size(statsio.relid))) AS
>> total_table_size, sum(stats.n_live_tup) AS live_rows FROM
>> pg_catalog.pg_statio_user_tables AS statsio JOIN pg_stat_user_tables AS
>> stats USING (relname) WHERE stats.schemaname = current_schemaORDER BY
>> live_rows ASC;
>>
>> |
>>
>> |I obtain 80GB in total_table_size (half of my database), where are
>> missing data at?
>>
>
> First of all you are using pg_statio_user_tables which does not count
> system tables.
>
> Second pretty sure the use of current_schema is limiting the results to
> only one schema in the database.
>

AHHH Thanks you I found missing data they are stored into pg_largeobject.

|
>>
>>
>> 2018-03-19 19:32 GMT+01:00 Adrian Klaver <adrian.klaver@aklaver.com
>> <mailto:adrian.klaver@aklaver.com>>:
>>
>>     On 03/19/2018 10:27 AM, Jimmy Augustine wrote:
>>
>>         I tried this query and my database size is equal to 162GB.
>>
>>
>>     Well you can always look in $DATA directly. The database will be
>>     under $DATA/base/<db oid>.
>>
>>     You can find the <db oid> like this:
>>
>>     select oid, datname from  pg_database where datname='<db name>';
>>
>>
>>     --     Adrian Klaver
>>     adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>>
>>
>>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>

^ permalink  raw  reply  [nested|flat] 22+ messages in thread


end of thread, other threads:[~2018-03-20 14:28 UTC | newest]

Thread overview: 22+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-03-19 16:31 PostgreSQL 9.6 Temporary files Jimmy Augustine <jimmy.augustine@enyx.fr>
2018-03-19 16:44 ` Andreas Kretschmer <andreas@a-kretschmer.de>
2018-03-19 17:02   ` Jimmy Augustine <jimmy.augustine@enyx.fr>
2018-03-19 16:45 ` Adrian Klaver <adrian.klaver@aklaver.com>
2018-03-19 17:01   ` Melvin Davidson <melvin6925@gmail.com>
2018-03-19 17:17     ` Jimmy Augustine <jimmy.augustine@enyx.fr>
2018-03-19 17:20       ` Melvin Davidson <melvin6925@gmail.com>
2018-03-19 17:04   ` Jimmy Augustine <jimmy.augustine@enyx.fr>
2018-03-19 17:09     ` Adrian Klaver <adrian.klaver@aklaver.com>
2018-03-19 17:12       ` Jimmy Augustine <jimmy.augustine@enyx.fr>
2018-03-19 17:15         ` Adrian Klaver <adrian.klaver@aklaver.com>
2018-03-19 17:21           ` Jimmy Augustine <jimmy.augustine@enyx.fr>
2018-03-19 17:25             ` Andreas Kretschmer <andreas@a-kretschmer.de>
2018-03-19 17:29               ` Jimmy Augustine <jimmy.augustine@enyx.fr>
2018-03-19 17:35                 ` Adrian Klaver <adrian.klaver@aklaver.com>
2018-03-19 17:17         ` Melvin Davidson <melvin6925@gmail.com>
2018-03-19 17:25           ` Adrian Klaver <adrian.klaver@aklaver.com>
2018-03-19 17:27           ` Jimmy Augustine <jimmy.augustine@enyx.fr>
2018-03-19 18:32             ` Adrian Klaver <adrian.klaver@aklaver.com>
2018-03-20 10:16               ` Jimmy Augustine <jimmy.augustine@enyx.fr>
2018-03-20 14:00                 ` Adrian Klaver <adrian.klaver@aklaver.com>
2018-03-20 14:28                   ` Jimmy Augustine <jimmy.augustine@enyx.fr>

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