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
=
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
=
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是创建数据库的默认模板。