Postgresql 数据库文件存储位置在哪儿?
PostgresQL 存储数据于data文件夹下,本人的目录为: C:\Program Files\PostgreSQL\10\data。
其中,每个数据库都会在base 文件夹下有一个子文件夹,且子文件夹以数据库的oid命名。数据库的oid可以通过表pg_database获取。
Testpg=# select oid, datname from pg_database ;
oid | datname
--------+-------------------
12938 | postgres
1 | template1
12937 | template0
16393 | pem
404609 | Testpg100
405086 | postgis_25_sample
407547 | Testpg1
415074 | Testpg
(8 行记录)
数据库Testpg的 oid 为 415074,即数据库Testpg中的数据都存储在415074文件夹下。
数据库Testpg中有一张表linetable,查询该表中数据存放的位置:
Testpg=# select pg_relation_filepath('linetable');
pg_relation_filepath
----------------------
base/415074/416880
(1 行记录)
————————————————
版权声明:本文为CSDN博主「万里归来少年心」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/liyazhen2011/article/details/88993728
THE END