test=> select pg_relation_filepath('test');
pg_relation_filepath
----------------------
base/16384/16394
(1 row)
[postgres9.6@db 16384]$ pwd
/home/postgres9.6/data/base/16384
[postgres9.6@db 16384]$ ll 16394
-rw------- 1 postgres9.6 postgres 8192 Feb 6 11:46 16394
test=> drop table test;
DROP TABLE
[postgres9.6@db 16384]$ pwd
/home/postgres9.6/data/base/16384
[postgres9.6@db 16384]$ ll 16394
-rw------- 1 postgres9.6 postgres 0 Feb 6 11:48 16394
过一会再查询:
[postgres9.6@db 16384]$ ll 16394
ls: cannot access 16394: No such file or directory
pg_relation_filepath
----------------------
base/16384/16394
(1 row)
[postgres9.6@db 16384]$ pwd
/home/postgres9.6/data/base/16384
[postgres9.6@db 16384]$ ll 16394
-rw------- 1 postgres9.6 postgres 8192 Feb 6 11:46 16394
test=> drop table test;
DROP TABLE
[postgres9.6@db 16384]$ pwd
/home/postgres9.6/data/base/16384
[postgres9.6@db 16384]$ ll 16394
-rw------- 1 postgres9.6 postgres 0 Feb 6 11:48 16394
过一会再查询:
[postgres9.6@db 16384]$ ll 16394
ls: cannot access 16394: No such file or directory

本文介绍了如何使用PostgreSQL内置函数pg_relation_filepath查询指定表的物理文件存储位置,并展示了通过SQL语句查询到的文件路径及文件状态变化情况。
1090

被折叠的 条评论
为什么被折叠?



