mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-09 08:10:09 +08:00
528ac10c7c
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
24 lines
770 B
MySQL
24 lines
770 B
MySQL
CREATE FUNCTION database_size (name) RETURNS bigint
|
|
AS 'MODULE_PATHNAME', 'database_size'
|
|
LANGUAGE C WITH (isstrict);
|
|
|
|
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;
|