PostgreSQL数据库中表与文件的对应关系

前端之家收集整理的这篇文章主要介绍了PostgreSQL数据库中表与文件的对应关系前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
postgres=# create table tab_lei (c1 int);
CREATE TABLE
postgres=# 
postgres=# \x
Expanded display is on.
postgres=# select relname,relfilenode from pg_class where relname='tab_lei';
-[ RECORD 1 ]--------
relname     | tab_lei
relfilenode | 49414

postgres=# select oid,datname from pg_database where datname='postgres';
-[ RECORD 1 ]-----
oid     | 13212
datname | postgres
postgres=# insert into tab_lei values(111);
INSERT 0 1
postgres=# 
postgres=# select pg_relation_filepath('tab_lei');
 pg_relation_filepath 
----------------------
 base/13212/49414
(1 row)

postgres=# 
postgres=# \q
[postgres@pgserver data]$ cd $PGDATA/base
[postgres@pgserver base]$ pwd
/usr/local/pgsql/data/base
[postgres@pgserver base]$ ls
1  13211  13212  16384  24838
[postgres@pgserver base]$ cd 13212
[postgres@pgserver 13212]$ ls -lrt |grep 49414
-rw-------  1 postgres postgres   8192 Mar 13 16:38 49414

猜你在找的Postgre SQL相关文章