Skip to content

Commit

Permalink
update sql docs
Browse files Browse the repository at this point in the history
  • Loading branch information
fengzhao committed Aug 6, 2024
1 parent b48df35 commit 93cee8f
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions docs/postgresql/03.体系架构.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,13 @@ CREATE TABLESPACE myspace LOCATION '/data/postgres/testspace';

-- 查找已创建的表空间
SELECT * FROM pg_tablespace;

oid | spcname | spcowner | spcacl | spcoptions
------+------------+----------+--------+------------
1663 | pg_default | 10 | |
1664 | pg_global | 10 | |


-- 表空间名及目录位置
SELECT spcname, pg_tablespace_location(oid) FROM pg_tablespace;

Expand Down Expand Up @@ -265,7 +272,7 @@ AND t.spcname='myspace';

下图展示了一个PostgreSQL数据库集簇的例子。

base子目录中的每一个子目录都对应一个数据库,数据库中每个表和索引都会在相应子目录下存储为(至少)一个文件;还有几个包含特定数据的子目录,以及配置文件。 虽然PostgreSQL支持表空间(Tablespace) ,但该术语的含义与其他RDBMS不同。 PostgreSQL中的表空间对应一个包含基础目录之外数据的目录。
**base子目录中的每一个子目录都对应一个数据库**,数据库中每个表和索引都会在相应子目录下存储为(至少)一个文件;还有几个包含特定数据的子目录,以及配置文件。 虽然PostgreSQL支持表空间(Tablespace) ,但该术语的含义与其他RDBMS不同。 PostgreSQL中的表空间对应一个包含基础目录之外数据的目录。


![物理架构](image-1.png)
Expand Down Expand Up @@ -304,7 +311,14 @@ base子目录中的每一个子目录都对应一个数据库,数据库中每
> 例如当数据库`sampledb`的OID为16384时,它对应的子目录名称即为16384。
```SQL
SELECT * FROM pg_database;
postgres=# SELECT oid,datname,datdba,encoding FROM pg_database;
oid | datname | datdba | encoding
-----+-----------+--------+----------
5 | postgres | 10 | 6
1 | template1 | 10 | 6
4 | template0 | 10 | 6
(3 rows)

```


Expand Down

0 comments on commit 93cee8f

Please sign in to comment.