1.手動查看:sql
查看數據庫mydb1的表空間路徑數據庫
mydb1=> select datname,dattablespace from pg_database where datname='mydb1';
datname | dattablespace
---------+---------------
mydb1 | 18727
(1 row)post
mydb1=> select oid,spcname from pg_tablespace where oid=18727;
oid | spcname
-------+---------
18727 | my1_ts
(1 row)spa
mydb1=> \db
List of tablespaces
Name | Owner | Location
------------+----------+--------------------------------
my1_ts | mymotif | /opt/PostgreSQL/9.4/data/my1ts
my2_ts | mymotif | /opt/PostgreSQL/9.4/data/my2ts
mymotif_ts | mymotif | /opt/PostgreSQL/9.4/data
pg_default | postgres |
pg_global | postgres |
(5 rows)code
查看數據庫mydb1的oidio
mydb1=> SELECT oid,datname from pg_database ; oid | datname -------+----------- 1 | template1 12172 | template0 12177 | postgres 16459 | mymotif 16498 | mydb 16523 | testdb 17381 | mypostgis 18770 | mydb1 (8 rows)
$ ls -l data/my1ts/PG_9.4_201409291/
總用量 16
drwx------ 2 postgres postgres 4096 9月 14 22:30 16459
drwx------ 2 postgres postgres 12288 9月 15 23:40 18770table
目錄(或文件)18770即是mydb1大小。test
2.sql語句查詢:List
mydb1=> select pg_size_pretty(pg_database_size('mydb1'));
pg_size_pretty
----------------
6724 kB
(1 row)select