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是創建數據庫的默認模板。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章