Part VII. Internals

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

Table of Contents

52. Overview of Postgres Pro Internals
52.1. The Path of a Query
52.2. How Connections are Established
52.3. The Parser Stage
52.4. The Postgres Pro Rule System
52.5. Planner/Optimizer
52.6. Executor
53. System Catalogs
53.1. Overview
53.2. pg_aggregate
53.3. pg_am
53.4. pg_amop
53.5. pg_amproc
53.6. pg_attrdef
53.7. pg_attribute
53.8. pg_authid
53.9. pg_auth_members
53.10. pg_cast
53.11. pg_class
53.12. pg_collation
53.13. pg_constraint
53.14. pg_conversion
53.15. pg_database
53.16. pg_db_role_setting
53.17. pg_default_acl
53.18. pg_depend
53.19. pg_description
53.20. pg_enum
53.21. pg_event_trigger
53.22. pg_extension
53.23. pg_foreign_data_wrapper
53.24. pg_foreign_server
53.25. pg_foreign_table
53.26. pg_index
53.27. pg_inherits
53.28. pg_init_privs
53.29. pg_language
53.30. pg_largeobject
53.31. pg_largeobject_metadata
53.32. pg_namespace
53.33. pg_opclass
53.34. pg_operator
53.35. pg_opfamily
53.36. pg_partitioned_table
53.37. pg_pltemplate
53.38. pg_policy
53.39. pg_proc
53.40. pg_publication
53.41. pg_publication_rel
53.42. pg_range
53.43. pg_replication_origin
53.44. pg_rewrite
53.45. pg_seclabel
53.46. pg_sequence
53.47. pg_shdepend
53.48. pg_shdescription
53.49. pg_shseclabel
53.50. pg_statistic
53.51. pg_statistic_ext
53.52. pg_subscription
53.53. pg_subscription_rel
53.54. pg_tablespace
53.55. pg_transform
53.56. pg_trigger
53.57. pg_ts_config
53.58. pg_ts_config_map
53.59. pg_ts_dict
53.60. pg_ts_parser
53.61. pg_ts_template
53.62. pg_type
53.63. pg_user_mapping
53.64. System Views
53.65. pg_available_extensions
53.66. pg_available_extension_versions
53.67. pg_config
53.68. pg_cursors
53.69. pg_file_settings
53.70. pg_group
53.71. pg_hba_file_rules
53.72. pg_indexes
53.73. pg_locks
53.74. pg_matviews
53.75. pg_policies
53.76. pg_prepared_statements
53.77. pg_autoprepared_statements
53.78. pg_prepared_xacts
53.79. pg_publication_tables
53.80. pg_recovery_settings
53.81. pg_replication_origin_status
53.82. pg_replication_slots
53.83. pg_roles
53.84. pg_rules
53.85. pg_seclabels
53.86. pg_sequences
53.87. pg_settings
53.88. pg_shadow
53.89. pg_stats
53.90. pg_tables
53.91. pg_timezone_abbrevs
53.92. pg_timezone_names
53.93. pg_user
53.94. pg_user_mappings
53.95. pg_views
54. Frontend/Backend Protocol
54.1. Overview
54.2. Message Flow
54.3. SASL Authentication
54.4. Streaming Replication Protocol
54.5. Logical Streaming Replication Protocol
54.6. Message Data Types
54.7. Message Formats
54.8. Error and Notice Message Fields
54.9. Logical Replication Message Formats
54.10. Summary of Changes since Protocol 2.0
55. Writing A Procedural Language Handler
56. Writing A Foreign Data Wrapper
56.1. Foreign Data Wrapper Functions
56.2. Foreign Data Wrapper Callback Routines
56.3. Foreign Data Wrapper Helper Functions
56.4. Foreign Data Wrapper Query Planning
56.5. Row Locking in Foreign Data Wrappers
57. Writing A Table Sampling Method
57.1. Sampling Method Support Functions
58. Writing A Custom Scan Provider
58.1. Creating Custom Scan Paths
58.2. Creating Custom Scan Plans
58.3. Executing Custom Scans
59. Genetic Query Optimizer
59.1. Query Handling as a Complex Optimization Problem
59.2. Genetic Algorithms
59.3. Genetic Query Optimization (GEQO) in Postgres Pro
59.4. Further Reading
60. Index Access Method Interface Definition
60.1. Basic API Structure for Indexes
60.2. Index Access Method Functions
60.3. Index Scanning
60.4. Index Locking Considerations
60.5. Index Uniqueness Checks
60.6. Index Cost Estimation Functions
61. Generic WAL Records
62. B-Tree Indexes
62.1. Introduction
62.2. Behavior of B-Tree Operator Classes
62.3. B-Tree Support Functions
62.4. Implementation
63. GiST Indexes
63.1. Introduction
63.2. Built-in Operator Classes
63.3. Extensibility
63.4. Implementation
63.5. Examples
64. SP-GiST Indexes
64.1. Introduction
64.2. Built-in Operator Classes
64.3. Extensibility
64.4. Implementation
64.5. Examples
65. GIN Indexes
65.1. Introduction
65.2. Built-in Operator Classes
65.3. Extensibility
65.4. Implementation
65.5. GIN Tips and Tricks
65.6. Limitations
65.7. Examples
66. BRIN Indexes
66.1. Introduction
66.2. Built-in Operator Classes
66.3. Extensibility
67. Database Physical Storage
67.1. Database File Layout
67.2. TOAST
67.3. Free Space Map
67.4. Visibility Map
67.5. The Initialization Fork
67.6. Database Page Layout
68. System Catalog Declarations and Initial Contents
68.1. System Catalog Declaration Rules
68.2. System Catalog Initial Data
68.3. BKI File Format
68.4. BKI Commands
68.5. Structure of the Bootstrap BKI File
68.6. BKI Example
69. How the Planner Uses Statistics
69.1. Row Estimation Examples
69.2. Multivariate Statistics Examples
69.3. Planner Statistics and Security