From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Dave Page <dpage(at)vale-housing(dot)co(dot)uk> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: DBSize backend integration |
Date: | 2005-06-24 19:44:33 |
Message-ID: | 200506241944.j5OJiXM14929@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Dave Page wrote:
> The following functions are currently in contrib/dbsize. As Bruce has
> suggested, we should discuss which functions should or shouldn't be
> moved into the backend, and which should be renamed.
>
> int8 pg_database_size(oid)
> int8 database_size(name)
>
> Both return the database size in bytes, the first by oid, the second by
> name. Michael has indicated that he finds the second form useful, and we
> already use the first form in pgAdmin. Either form can emulate the other
> with a simple subselect. I would suggest that the second form be renamed
> to match the first for consistency, if it is decided that they be kept.
Seems we should just name it one name and use function overloading to
support name and oid.
> int8 pg_tablespace_size(oid)
>
> This returns the size of the tablespace in bytes. If both forms of the
> database_size function are included, then a 'by name' equivalent should
> probably be added.
Yep.
> int8 pg_relation_size(oid)
> int8 relation_size(text)
>
> As per *database_size(*), but per relation.
>
> text pg_size_pretty(int8)
>
> Converts a size in bytes to B/KB/MB/GB etc.
>
> int8 indexes_size(text)
>
> Returns the total size of the indexes on the named relation. A
> convenience function with questionable usefulness (IMO). Currently
> implemented as an SQL function.
>
> int8 total_relation_size(text)
>
> Returns relation_size(text) + indexes_size(text) +
> relation_size(text->toast tables). As per indexes_size, currently
> implemented as an SQL function.
>
> setof record relation_size_components(text)
>
> A 'view' returning the sizes of each component of the named relation
> (relation, indexes, toast tables etc). Broken at present because it
> isn't schema aware.
>
>
> My personal view is that pg_database_size, pg_relation_size and
> pg_tablespace_size, as well as pg_size_pretty should be included. If
> others consider that the by name versions are also useful, then they
> should be included, but renamed for consistency. The other three
> functions should be dropped IMO.
So drop total_relation_size(), relation_size_components(), and what
else?
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Page | 2005-06-24 19:56:28 | Re: Server instrumentation patch |
Previous Message | Dave Page | 2005-06-24 19:30:01 | DBSize backend integration |