pg_tablespace_size()

一个返回指定表空间大小的函数

pg_tablespace_size() 是一个系统函数,它返回指定 表空间 的大小(以字节为单位)。

pg_tablespace_size()PostgreSQL 8.1 中被添加。

用法

pg_tablespace_size ( name ) → bigint

pg_tablespace_size ( oid ) → bigint

pg_tablespace_size() 可以使用表空间的 OID 或名称进行调用,并以字节为单位返回表空间的大小。

变更历史

pg_tablespace_size() 最初是在 PostgreSQL 8.0 中被添加到(已废弃的) dbsize contrib 模块 中的。

示例

psql\db+ 命令使用的查询

postgres=# \db+
********* QUERY **********
SELECT spcname AS "Name",
  pg_catalog.pg_get_userbyid(spcowner) AS "Owner",
  pg_catalog.pg_tablespace_location(oid) AS "Location",
  pg_catalog.array_to_string(spcacl, E'\n') AS "Access privileges",
  spcoptions AS "Options",
  pg_catalog.pg_size_pretty(pg_catalog.pg_tablespace_size(oid)) AS "Size",
  pg_catalog.shobj_description(oid, 'pg_tablespace') AS "Description"
FROM pg_catalog.pg_tablespace
ORDER BY 1;
**************************

                                          List of tablespaces
    Name    |  Owner   |         Location           | Access privileges | Options |    Size    | Description
------------+----------+----------------------------+-------------------+---------+------------+-------------
 pg_default | postgres |                            |                   |         | 31 MB      |
 pg_global  | postgres |                            |                   |         | 575 kB     |
 tblspace_1 | postgres | /var/lib/pgsql/tblspc_dir1 |                   |         | 8192 bytes |
 tblspace_2 | postgres | /var/lib/pgsql/tblspc_dir2 |                   |         | 0 bytes    |
(4 rows)

分类

管理 / 系统管理, 表空间

另请参阅

pg_tablespace_databases(), pg_tablespace_location(), 表空间, pg_tablespace

反馈

请在此处提交关于 "pg_tablespace_size()" 的任何评论、建议或更正:链接