PostgreSQL目录结构之global目录

global目录

目录位置一般为$PGDATA/global,是存放共享系统表的位置,文件种类也类似base目录。大多数系统目录都是在数据库创建的过程中从模版数据库中拷贝过来的, 因此都是数据库相关的。少数目录在物理上是在一个集簇的所有数据库间中共享的,这些将在每一个目录单独的描述中介绍。

系统表详情

目录名用途
pg_aggregate聚集函数
pg_am索引访问方法
pg_amop访问方法操作符
pg_amproc访问方法支持函数
pg_attrdef列默认值
pg_attribute表列(“属性”)
pg_authid认证标识符(角色)
pg_auth_members认证标识符成员关系
pg_cast转换(数据类型转换)
pg_class表、索引、序列、视图 (“关系”)
pg_collation排序规则(locale信息)
pg_constraint检查约束、唯一约束、主键约束、外键约束
pg_conversion编码转换信息
pg_database本数据库集簇中的数据库
pg_db_role_setting每角色和每数据库的设置
pg_default_acl对象类型的默认权限
pg_depend数据库对象间的依赖
pg_description数据库对象上的描述或注释
pg_enum枚举标签和值定义
pg_event_trigger事件触发器
pg_extension已安装扩展
pg_foreign_data_wrapper外部数据包装器定义
pg_foreign_server外部服务器定义
pg_foreign_table外部表信息
pg_index索引信息
pg_inherits表继承层次
pg_init_privs对象初始特权
pg_language编写函数的语言
pg_largeobject大对象的数据页
pg_largeobject_metadata大对象的元数据
pg_namespace模式
pg_opclass访问方法操作符类
pg_operator操作符
pg_opfamily访问方法操作符族
pg_partitioned_table表的分区键的信息
pg_pltemplate过程语言的模板数据
pg_policy行安全策略
pg_proc函数和过程
pg_publication用于逻辑复制的发布
pg_publication_rel发布映射的关系
pg_range范围类型的信息
pg_replication_origin已注册的复制源
pg_rewrite查询重写规则
pg_seclabel数据库对象上的安全标签
pg_sequence有关序列的信息
pg_shdepend共享对象上的依赖
pg_shdescription共享对象上的注释
pg_shseclabel共享数据库对象上的安全标签
pg_statistic规划器统计
pg_statistic_ext扩展的规划器统计信息
pg_subscription逻辑复制订阅
pg_subscription_rel订阅的关系状态
pg_tablespace本数据库集簇内的表空间
pg_transform转换(将数据类型转换为过程语言需要的形式)
pg_trigger触发器
pg_ts_config文本搜索配置
pg_ts_config_map文本搜索配置的记号映射
pg_ts_dict文本搜索字典
pg_ts_parser文本搜索分析器
pg_ts_template文本搜索模板
pg_type数据类型
pg_user_mapping将用户映射到外部服务器

查看系统表

#查看testdb系统表
testdb=# select oid,relname,pg_relation_filepath(oid) from pg_class where relfilenode=0 order by 1;
 oid  |                 relname                 | pg_relation_filepath 
------+-----------------------------------------+----------------------
 1136 | pg_pltemplate                           | global/1136
 1137 | pg_pltemplate_name_index                | global/1137
 1213 | pg_tablespace                           | global/1213
 1214 | pg_shdepend                             | global/1214
 1232 | pg_shdepend_depender_index              | global/1232
 1233 | pg_shdepend_reference_index             | global/1233
 1247 | pg_type                                 | base/16384/1247
 1249 | pg_attribute                            | base/16384/1249
 1255 | pg_proc                                 | base/16384/1255
 1259 | pg_class                                | base/16384/1259
 1260 | pg_authid                               | global/1260
 1261 | pg_auth_members                         | global/1261
 1262 | pg_database                             | global/1262
 2396 | pg_shdescription                        | global/2396
 2397 | pg_shdescription_o_c_index              | global/2397
 2658 | pg_attribute_relid_attnam_index         | base/16384/2658
 2659 | pg_attribute_relid_attnum_index         | base/16384/2659
 2662 | pg_class_oid_index                      | base/16384/2662
 2663 | pg_class_relname_nsp_index              | base/16384/2663
 2671 | pg_database_datname_index               | global/2671
 2672 | pg_database_oid_index                   | global/2672
 2676 | pg_authid_rolname_index                 | global/2676
 2677 | pg_authid_oid_index                     | global/2677
 2690 | pg_proc_oid_index                       | base/16384/2690
 2691 | pg_proc_proname_args_nsp_index          | base/16384/2691
 2694 | pg_auth_members_role_member_index       | global/2694
 2695 | pg_auth_members_member_role_index       | global/2695
 2697 | pg_tablespace_oid_index                 | global/2697
 2698 | pg_tablespace_spcname_index             | global/2698
 2703 | pg_type_oid_index                       | base/16384/2703
 2704 | pg_type_typname_nsp_index               | base/16384/2704
 2836 | pg_toast_1255                           | base/16384/2836
 2837 | pg_toast_1255_index                     | base/16384/2837
 2846 | pg_toast_2396                           | global/2846
 2847 | pg_toast_2396_index                     | global/2847
 2964 | pg_db_role_setting                      | global/2964
 2965 | pg_db_role_setting_databaseid_rol_index | global/2965
 2966 | pg_toast_2964                           | global/2966
 2967 | pg_toast_2964_index                     | global/2967
 3455 | pg_class_tblspc_relfilenode_index       | base/16384/3455
 3592 | pg_shseclabel                           | global/3592
 3593 | pg_shseclabel_object_index              | global/3593
 4060 | pg_toast_3592                           | global/4060
 4061 | pg_toast_3592_index                     | global/4061
 6000 | pg_replication_origin                   | global/6000
 6001 | pg_replication_origin_roiident_index    | global/6001
 6002 | pg_replication_origin_roname_index      | global/6002
 6100 | pg_subscription                         | global/6100
 6114 | pg_subscription_oid_index               | global/6114
 6115 | pg_subscription_subname_index           | global/6115
(50 rows)
#查看template1系统表
template1=# select oid,relname,pg_relation_filepath(oid) from pg_class where relfilenode=0 order by 1;
 oid  |                 relname                 | pg_relation_filepath 
------+-----------------------------------------+----------------------
 1136 | pg_pltemplate                           | global/1136
 1137 | pg_pltemplate_name_index                | global/1137
 1213 | pg_tablespace                           | global/1213
 1214 | pg_shdepend                             | global/1214
 1232 | pg_shdepend_depender_index              | global/1232
 1233 | pg_shdepend_reference_index             | global/1233
 1247 | pg_type                                 | base/1/1247
 1249 | pg_attribute                            | base/1/1249
 1255 | pg_proc                                 | base/1/1255
 1259 | pg_class                                | base/1/1259
 1260 | pg_authid                               | global/1260
 1261 | pg_auth_members                         | global/1261
 1262 | pg_database                             | global/1262
 2396 | pg_shdescription                        | global/2396
 2397 | pg_shdescription_o_c_index              | global/2397
 2658 | pg_attribute_relid_attnam_index         | base/1/2658
 2659 | pg_attribute_relid_attnum_index         | base/1/2659
 2662 | pg_class_oid_index                      | base/1/2662
 2663 | pg_class_relname_nsp_index              | base/1/2663
 2671 | pg_database_datname_index               | global/2671
 2672 | pg_database_oid_index                   | global/2672
 2676 | pg_authid_rolname_index                 | global/2676
 2677 | pg_authid_oid_index                     | global/2677
 2690 | pg_proc_oid_index                       | base/1/2690
 2691 | pg_proc_proname_args_nsp_index          | base/1/2691
 2694 | pg_auth_members_role_member_index       | global/2694
 2695 | pg_auth_members_member_role_index       | global/2695
 2697 | pg_tablespace_oid_index                 | global/2697
 2698 | pg_tablespace_spcname_index             | global/2698
 2703 | pg_type_oid_index                       | base/1/2703
 2704 | pg_type_typname_nsp_index               | base/1/2704
 2836 | pg_toast_1255                           | base/1/2836
 2837 | pg_toast_1255_index                     | base/1/2837
 2846 | pg_toast_2396                           | global/2846
 2847 | pg_toast_2396_index                     | global/2847
 2964 | pg_db_role_setting                      | global/2964
 2965 | pg_db_role_setting_databaseid_rol_index | global/2965
 2966 | pg_toast_2964                           | global/2966
 2967 | pg_toast_2964_index                     | global/2967
 3455 | pg_class_tblspc_relfilenode_index       | base/1/3455
 3592 | pg_shseclabel                           | global/3592
 3593 | pg_shseclabel_object_index              | global/3593
 4060 | pg_toast_3592                           | global/4060
 4061 | pg_toast_3592_index                     | global/4061
 6000 | pg_replication_origin                   | global/6000
 6001 | pg_replication_origin_roiident_index    | global/6001
 6002 | pg_replication_origin_roname_index      | global/6002
 6100 | pg_subscription                         | global/6100
 6114 | pg_subscription_oid_index               | global/6114
 6115 | pg_subscription_subname_index           | global/6115
(50 rows)

可以看到path为base的是与具体数据库关联的系统表,path为global的是共享的系统表。base中的系统表文件一般是从template1中拷贝的,对应的文件名也是一样的,因为template1是创建数据库的默认模板。

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一只努力的微服务

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值