dbsize contrib
The current implementation of dbsize doesn't handle tables in
tablespaces correctly, and is quite restricted on objects covered (only
tables and databases, but not tablespaces and indexes).
The attached patch contributes:
- database_size(name)
- relation_size(text)
These are the well-known functions, tablespace-aware.
- pg_tablespace_size(oid)
- pg_database_size(oid)
- pg_relation_size(oid)
Tablespace-aware implementations, used by the upper functions.
pg_relation_size will report sizes of indexes as well.
- pg_size_pretty(bigint)
Formatting of sizes, to display '146MB' instead of '152885668'
Regards,
Andreas
Attachments:
dbsize.difftext/x-patch; name=dbsize.diffDownload+282-123
On Sun, 29 Aug 2004, Andreas Pflug wrote:
The current implementation of dbsize doesn't handle tables in
tablespaces correctly, and is quite restricted on objects covered (only
tables and databases, but not tablespaces and indexes).The attached patch contributes:
- database_size(name)
- relation_size(text)
I sent in a dbsize patch to make these functions tablespace aware...
These are the well-known functions, tablespace-aware.
- pg_tablespace_size(oid)
- pg_database_size(oid)
- pg_relation_size(oid)
Tablespace-aware implementations, used by the upper functions.
pg_relation_size will report sizes of indexes as well.- pg_size_pretty(bigint)
Formatting of sizes, to display '146MB' instead of '152885668'
Nice.
Gavin
Gavin Sherry wrote:
The attached patch contributes:
- database_size(name)
- relation_size(text)I sent in a dbsize patch to make these functions tablespace aware...
AFAIR your patch was applied, but it misses tables in non-default
tablespaces.
Regards,
Andreas
On Mon, 30 Aug 2004, Andreas Pflug wrote:
Gavin Sherry wrote:
The attached patch contributes:
- database_size(name)
- relation_size(text)I sent in a dbsize patch to make these functions tablespace aware...
AFAIR your patch was applied, but it misses tables in non-default
tablespaces.
Ahh. There is a thoughto in my patch. The ifdef should have been
HAVE_SYMLINK not SYMLINK. With HAVE_SYMLINK the current code works fine.
That being said, your patch seems to clean up the code some whilst adding
more functionality.
Gavin
Patch applied. Thanks.
Can I get some documentation in the README for all the new
functionality.
---------------------------------------------------------------------------
Andreas Pflug wrote:
The current implementation of dbsize doesn't handle tables in
tablespaces correctly, and is quite restricted on objects covered (only
tables and databases, but not tablespaces and indexes).The attached patch contributes:
- database_size(name)
- relation_size(text)
These are the well-known functions, tablespace-aware.- pg_tablespace_size(oid)
- pg_database_size(oid)
- pg_relation_size(oid)
Tablespace-aware implementations, used by the upper functions.
pg_relation_size will report sizes of indexes as well.- pg_size_pretty(bigint)
Formatting of sizes, to display '146MB' instead of '152885668'Regards,
Andreas
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
Bruce Momjian wrote:
Patch applied. Thanks.
Can I get some documentation in the README for all the new
functionality.
Here it is.
Regards,
Andreas
Attachments:
dbsizedoc.difftext/x-patch; name=dbsizedoc.diffDownload+43-7
Applied and new file attached. I cleaned it up a little. One problem
is that the sample query generates a syntax error.
---------------------------------------------------------------------------
Andreas Pflug wrote:
Bruce Momjian wrote:
Patch applied. Thanks.
Can I get some documentation in the README for all the new
functionality.Here it is.
Regards,
Andreas
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073