微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐