Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] Dbsize backend integration

From: "Michael Paesold" <mpaesold(at)gmx(dot)at>
To: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>,"Dave Page" <dpage(at)vale-housing(dot)co(dot)uk>
Cc: "PostgreSQL-patches" <pgsql-patches(at)postgresql(dot)org>,"PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] Dbsize backend integration
Date: 2005-06-29 06:55:27
Message-ID: 026801c57c77$8dbbba50$0f01a8c0@zaphod (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
Bruce Momjian wrote:

> Dave Page wrote:

>> pg_relation_size(text)   - Get relation size by name/schema.name
>> pg_relation_size(oid)    - Get relation size by OID
>> pg_tablespace_size(name) - Get tablespace size by name
>> pg_tablespace_size(oid)  - Get tablespace size by OID
>> pg_database_size(name)   - Get database size by name
>> pg_database_size(oid)    - Get database size by OID
>> pg_table_size(text)   - Get table size (including all indexes and
>> toast tables) by name/schema.name
>> pg_table_size(oid)    - Get table size (including all indexes and
>> toast tables) by OID
>> pg_size_pretty(int8)     - Pretty print (and round) the byte size
>> specified (eg, 123456 = 121KB)

> OK, so you went with relation as heap/index/toast only, and table as the
> total of them.  I am not sure that makes sense because we usually equate
> relation with table, and an index isn't a relation, really.
>
> Do we have to use pg_object_size?  Is there a better name?  Are
> indexes/toasts even objects?

Relation is not an ideal names, but I heard people talk about heap relation 
and index relation. Indexes and tables (and sequences) are treated in a 
similar way quite often. Think of ALTER TABLE example_index RENAME TO 
another_index. This is even less obvious.  Of course in relational theory, 
an index would not be a relation, because an index is just implementation 
detail.

I don't like object_size any better, since that makes me rather think of 
large objects or rows as objects (object id...).

Perhaps pg_table_size should be split into pg_table_size and 
pg_indexes_size, where pg_indexes_size is the aggregate of all indexes on a 
table und pg_table_size is just table+toast+toast-index.

If noone has a better idea for pg_relation_size, I would rather keep it for 
consistency with the contrib module, and because it's not too far off.

Best Regards,
Michael Paesold 


In response to

Responses

pgsql-hackers by date

Next:From: Dawid KuroczkoDate: 2005-06-29 07:09:27
Subject: Re: ENUM like data type
Previous:From: Greg StarkDate: 2005-06-29 06:51:20
Subject: Re: Wierd panic with 7.4.7

pgsql-patches by date

Next:From: Christopher Kings-LynneDate: 2005-06-29 07:33:40
Subject: Dump comments on large objects in text mode
Previous:From: laserDate: 2005-06-29 05:30:14
Subject: Re: Proposed TODO: --encoding option for pg_dump

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group