数据库
首页 > 数据库> > PostgreSQL查看索引、表对应的relfileno

PostgreSQL查看索引、表对应的relfileno

作者:互联网

pg_class就相当于oracle中dba_segments+dba_objects的并集。

查看某个文件或索引的relfileno

mydb2=# select relfilenode from pg_catalog.pg_class where relname='idx_my_tb2';
relfilenode
-------------
49307

[zjh@hs-10-20-30-193 data]$ find . -name "49307"
./base/49300/49307

查看某个relfileno对应的对象

例如,查询4930x这批的对象

mydb2=# select * from pg_catalog.pg_class where relfilenode=49302;
  oid  | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | relt
ablespace | relpages | reltuples | relallvisible | reltoastrelid | relhasindex | relisshared 
| relpersistence | relkind | relnatts | relchecks | relhasrules | relhastriggers | relhassubc
lass | relrowsecurity | relforcerowsecurity | relispopulated | relreplident | relispartition 
| relrewrite | relfrozenxid | relminmxid | relacl | reloptions | relpartbound 
-------+---------+--------------+---------+-----------+----------+-------+-------------+-----
----------+----------+-----------+---------------+---------------+-------------+-------------
+----------------+---------+----------+-----------+-------------+----------------+-----------
-----+----------------+---------------------+----------------+--------------+----------------
+------------+--------------+------------+--------+------------+--------------
 49302 | my_tb2  |         2200 |   49304 |         0 |       10 |     2 |       49302 |     
        0 |        0 |         0 |             0 |             0 | t           | f           
| p              | r       |        2 |         0 | f           | f              | f         
     | f              | f                   | t              | d            | f              
|          0 |          587 |          1 |        |            | 
(1 row)

可知是对象my_tb2,类型定义在pg_type中,可以参见https://www.cnblogs.com/orangeform/archive/2012/05/25/2305415.html

 

标签:49302,PostgreSQL,tb2,索引,pg,relfilenode,relfileno,my
来源: https://www.cnblogs.com/zhjh256/p/15014060.html