PostgreSQL教程

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。

 

这篇关于PostgreSQL查看索引、表对应的relfileno的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!