diff options
author | Bruce Momjian <bruce@momjian.us> | 2004-09-02 00:55:22 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2004-09-02 00:55:22 +0000 |
commit | 528ac10c7c73883f5b12db2f7bd627652f869bab (patch) | |
tree | ce83bf5b310235949daca826ea5a2c242c301f4e /contrib/dbsize/dbsize.sql.in | |
parent | e814e4bfe53159a3afb5b6960285b651f32118f3 (diff) |
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'
Andreas Pflug
Diffstat (limited to 'contrib/dbsize/dbsize.sql.in')
-rw-r--r-- | contrib/dbsize/dbsize.sql.in | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/contrib/dbsize/dbsize.sql.in b/contrib/dbsize/dbsize.sql.in index b00a36fa200..a4ddc7e41fd 100644 --- a/contrib/dbsize/dbsize.sql.in +++ b/contrib/dbsize/dbsize.sql.in @@ -5,3 +5,19 @@ CREATE FUNCTION database_size (name) RETURNS bigint CREATE FUNCTION relation_size (text) RETURNS bigint AS 'MODULE_PATHNAME', 'relation_size' LANGUAGE C WITH (isstrict); + +CREATE FUNCTION pg_tablespace_size(oid) RETURNS bigint + AS 'MODULE_PATHNAME', 'pg_tablespace_size' + LANGUAGE C STABLE STRICT; + +CREATE FUNCTION pg_database_size(oid) RETURNS bigint + AS 'MODULE_PATHNAME', 'pg_database_size' + LANGUAGE C STABLE STRICT; + +CREATE FUNCTION pg_relation_size(oid) RETURNS bigint + AS 'MODULE_PATHNAME', 'pg_relation_size' + LANGUAGE C STABLE STRICT; + +CREATE FUNCTION pg_size_pretty(bigint) RETURNS text + AS 'MODULE_PATHNAME', 'pg_size_pretty' + LANGUAGE C STABLE STRICT; |