Part VII. Internals

This part contains assorted information that might be of use to Postgres Pro developers.

Table of Contents

53. Overview of Postgres Pro Internals
53.1. The Path of a Query
53.2. How Connections Are Established
53.3. The Parser Stage
53.4. The Postgres Pro Rule System
53.5. Planner/Optimizer
53.6. Executor
54. System Catalogs
54.1. Overview
54.2. pg_aggregate
54.3. pg_am
54.4. pg_amop
54.5. pg_amproc
54.6. pg_attrdef
54.7. pg_attribute
54.8. pg_authid
54.9. pg_auth_members
54.10. pg_cast
54.11. pg_class
54.12. pg_collation
54.13. pg_constraint
54.14. pg_conversion
54.15. pg_database
54.16. pg_db_role_setting
54.17. pg_default_acl
54.18. pg_depend
54.19. pg_description
54.20. pg_enum
54.21. pg_event_trigger
54.22. pg_extension
54.23. pg_foreign_data_wrapper
54.24. pg_foreign_server
54.25. pg_foreign_table
54.26. pg_index
54.27. pg_inherits
54.28. pg_init_privs
54.29. pg_language
54.30. pg_largeobject
54.31. pg_largeobject_metadata
54.32. pg_namespace
54.33. pg_opclass
54.34. pg_operator
54.35. pg_opfamily
54.36. pg_partitioned_table
54.37. pg_policy
54.38. pg_proc
54.39. pg_profile
54.40. pg_publication
54.41. pg_publication_rel
54.42. pg_range
54.43. pg_replication_origin
54.44. pg_rewrite
54.45. pg_role_password
54.46. pg_seclabel
54.47. pg_sequence
54.48. pg_shdepend
54.49. pg_shdescription
54.50. pg_shseclabel
54.51. pg_statistic
54.52. pg_statistic_ext
54.53. pg_statistic_ext_data
54.54. pg_subscription
54.55. pg_subscription_rel
54.56. pg_tablespace
54.57. pg_transform
54.58. pg_trigger
54.59. pg_ts_config
54.60. pg_ts_config_map
54.61. pg_ts_dict
54.62. pg_ts_parser
54.63. pg_ts_template
54.64. pg_type
54.65. pg_user_mapping
54.66. System Views
54.67. pg_available_extensions
54.68. pg_available_extension_versions
54.69. pg_backend_memory_contexts
54.70. pg_config
54.71. pg_cursors
54.72. pg_file_settings
54.73. pg_group
54.74. pg_hba_file_rules
54.75. pg_indexes
54.76. pg_locks
54.77. pg_matviews
54.78. pg_policies
54.79. pg_prepared_statements
54.80. pg_autoprepared_statements
54.81. pg_prepared_xacts
54.82. pg_publication_tables
54.83. pg_replication_origin_status
54.84. pg_replication_slots
54.85. pg_roles
54.86. pg_rules
54.87. pg_seclabels
54.88. pg_sequences
54.89. pg_settings
54.90. pg_shadow
54.91. pg_shmem_allocations
54.92. pg_stats
54.93. pg_stats_ext
54.94. pg_stats_ext_exprs
54.95. pg_tables
54.96. pg_timezone_abbrevs
54.97. pg_timezone_names
54.98. pg_user
54.99. pg_user_mappings
54.100. pg_views
55. Frontend/Backend Protocol
55.1. Overview
55.2. Message Flow
55.3. SASL Authentication
55.4. Streaming Replication Protocol
55.5. Logical Streaming Replication Protocol
55.6. Message Data Types
55.7. Message Formats
55.8. Error and Notice Message Fields
55.9. Logical Replication Message Formats
55.10. Summary of Changes since Protocol 2.0
56. Writing a Procedural Language Handler
57. Writing a Foreign Data Wrapper
57.1. Foreign Data Wrapper Functions
57.2. Foreign Data Wrapper Callback Routines
57.3. Foreign Data Wrapper Helper Functions
57.4. Foreign Data Wrapper Query Planning
57.5. Row Locking in Foreign Data Wrappers
58. Writing a Table Sampling Method
58.1. Sampling Method Support Functions
59. Writing a Custom Scan Provider
59.1. Creating Custom Scan Paths
59.2. Creating Custom Scan Plans
59.3. Executing Custom Scans
60. Genetic Query Optimizer
60.1. Query Handling as a Complex Optimization Problem
60.2. Genetic Algorithms
60.3. Genetic Query Optimization (GEQO) in Postgres Pro
60.4. Further Reading
61. Table Access Method Interface Definition
62. Index Access Method Interface Definition
62.1. Basic API Structure for Indexes
62.2. Index Access Method Functions
62.3. Index Scanning
62.4. Index Locking Considerations
62.5. Index Uniqueness Checks
62.6. Index Cost Estimation Functions
63. Generic WAL Records
64. B-Tree Indexes
64.1. Introduction
64.2. Behavior of B-Tree Operator Classes
64.3. B-Tree Support Functions
64.4. Implementation
65. GiST Indexes
65.1. Introduction
65.2. Built-in Operator Classes
65.3. Extensibility
65.4. Implementation
65.5. Examples
66. SP-GiST Indexes
66.1. Introduction
66.2. Built-in Operator Classes
66.3. Extensibility
66.4. Implementation
67. GIN Indexes
67.1. Introduction
67.2. Built-in Operator Classes
67.3. Extensibility
67.4. Implementation
67.5. GIN Tips and Tricks
67.6. Limitations
67.7. Examples
68. BRIN Indexes
68.1. Introduction
68.2. Built-in Operator Classes
68.3. Extensibility
69. Hash Indexes
69.1. Overview
69.2. Implementation
70. Database Physical Storage
70.1. Database File Layout
70.2. TOAST
70.3. Free Space Map
70.4. Visibility Map
70.5. The Initialization Fork
70.6. Database Page Layout
70.7. Heap-Only Tuples (HOT)
71. How the Planner Uses Statistics
71.1. Row Estimation Examples
71.2. Multivariate Statistics Examples
71.3. Planner Statistics and Security
72. Backup Manifest Format
72.1. Backup Manifest Top-level Object
72.2. Backup Manifest File Object
72.3. Backup Manifest WAL Range Object