Re: PostgreSQL database size is not reasonable

2017-12-12 Thread Tom Lane
Mariel Cherkassky  writes:
> The system catalogs located in the global directory but the global
> directory isnt so big(500K).

You're operating under false assumptions.  Only catalogs marked
relisshared are in that directory, other ones are in the per-database
directories.

Somebody mentioned pg_largeobject upthread --- that would definitely
be a candidate to be big, if you're using large objects at all.

regards, tom lane



Re: PostgreSQL database size is not reasonable

2017-12-12 Thread Tom Lane
"David G. Johnston"  writes:
> On Tue, Dec 12, 2017 at 8:15 AM, Mariel Cherkassky <
> mariel.cherkas...@gmail.com> wrote:
>> And the bigger question, Where are the missing 180G ?

> ​In the toaster probably...

pg_total_relation_size should have counted the toast tables,
as well as the indexes, if memory serves.

What I'm wondering about is the system catalogs, which Mariel's
query explicitly excluded.  180G would be awful darn large for
those, but maybe there's a bloat problem somewhere.

Otherwise, try to identify the largest individual files in the
database directory ...

regards, tom lane



RE: PostgreSQL database size is not reasonable

2017-12-12 Thread Craig McIlwee

On Tue, Dec 12, 2017 at 8:15 AM, Mariel Cherkassky 
> wrote:

​A​nd the bigger question, Where are the missing 180G ?

​In the toaster probably...



https://www.postgresql.org/docs/current/static/storage-toast.html



Basically large data values are store in another table different than both the 
main table and indexes.



David J.


The query also says C.relkind <> 'i' which means it’s excluding indexes.  Also 
note that pg_catalog is excluded but LOB data would be stored in 
pg_catalog.pg_largeobject.  That could account for some overlooked space as 
well.

Craig