Supported Versions: Current (16) / 15 / 14 / 13 / 12
Development Versions: 17 / devel
Unsupported versions: 11 / 10 / 9.6 / 9.5 / 9.4 / 9.3 / 9.2 / 9.1 / 9.0 / 8.4 / 8.3 / 8.2 / 8.1 / 8.0 / 7.4
This documentation is for an unsupported version of PostgreSQL.
You may want to view the same page for the current version, or one of the other supported versions listed above instead.

Part VII. Internals

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

Table of Contents

50. Overview of PostgreSQL Internals
50.1. The Path of a Query
50.2. How Connections Are Established
50.3. The Parser Stage
50.4. The PostgreSQL Rule System
50.5. Planner/Optimizer
50.6. Executor
51. System Catalogs
51.1. Overview
51.2. pg_aggregate
51.3. pg_am
51.4. pg_amop
51.5. pg_amproc
51.6. pg_attrdef
51.7. pg_attribute
51.8. pg_authid
51.9. pg_auth_members
51.10. pg_cast
51.11. pg_class
51.12. pg_collation
51.13. pg_constraint
51.14. pg_conversion
51.15. pg_database
51.16. pg_db_role_setting
51.17. pg_default_acl
51.18. pg_depend
51.19. pg_description
51.20. pg_enum
51.21. pg_event_trigger
51.22. pg_extension
51.23. pg_foreign_data_wrapper
51.24. pg_foreign_server
51.25. pg_foreign_table
51.26. pg_index
51.27. pg_inherits
51.28. pg_init_privs
51.29. pg_language
51.30. pg_largeobject
51.31. pg_largeobject_metadata
51.32. pg_namespace
51.33. pg_opclass
51.34. pg_operator
51.35. pg_opfamily
51.36. pg_parameter_acl
51.37. pg_partitioned_table
51.38. pg_policy
51.39. pg_proc
51.40. pg_publication
51.41. pg_publication_namespace
51.42. pg_publication_rel
51.43. pg_range
51.44. pg_replication_origin
51.45. pg_rewrite
51.46. pg_seclabel
51.47. pg_sequence
51.48. pg_shdepend
51.49. pg_shdescription
51.50. pg_shseclabel
51.51. pg_statistic
51.52. pg_statistic_ext
51.53. pg_statistic_ext_data
51.54. pg_subscription
51.55. pg_subscription_rel
51.56. pg_tablespace
51.57. pg_transform
51.58. pg_trigger
51.59. pg_ts_config
51.60. pg_ts_config_map
51.61. pg_ts_dict
51.62. pg_ts_parser
51.63. pg_ts_template
51.64. pg_type
51.65. pg_user_mapping
52. System Views
52.1. Overview
52.2. pg_available_extensions
52.3. pg_available_extension_versions
52.4. pg_backend_memory_contexts
52.5. pg_config
52.6. pg_cursors
52.7. pg_file_settings
52.8. pg_group
52.9. pg_hba_file_rules
52.10. pg_ident_file_mappings
52.11. pg_indexes
52.12. pg_locks
52.13. pg_matviews
52.14. pg_policies
52.15. pg_prepared_statements
52.16. pg_prepared_xacts
52.17. pg_publication_tables
52.18. pg_replication_origin_status
52.19. pg_replication_slots
52.20. pg_roles
52.21. pg_rules
52.22. pg_seclabels
52.23. pg_sequences
52.24. pg_settings
52.25. pg_shadow
52.26. pg_shmem_allocations
52.27. pg_stats
52.28. pg_stats_ext
52.29. pg_stats_ext_exprs
52.30. pg_tables
52.31. pg_timezone_abbrevs
52.32. pg_timezone_names
52.33. pg_user
52.34. pg_user_mappings
52.35. pg_views
52.36. pg_wait_events
53. Frontend/Backend Protocol
53.1. Overview
53.2. Message Flow
53.3. SASL Authentication
53.4. Streaming Replication Protocol
53.5. Logical Streaming Replication Protocol
53.6. Message Data Types
53.7. Message Formats
53.8. Error and Notice Message Fields
53.9. Logical Replication Message Formats
53.10. Summary of Changes since Protocol 2.0
54. PostgreSQL Coding Conventions
54.1. Formatting
54.2. Reporting Errors Within the Server
54.3. Error Message Style Guide
54.4. Miscellaneous Coding Conventions
55. Native Language Support
55.1. For the Translator
55.2. For the Programmer
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 PostgreSQL
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. Write Ahead Logging for Extensions
63.1. Generic WAL Records
63.2. Custom WAL Resource Managers
64. Built-in Index Access Methods
64.1. B-Tree Indexes
64.2. GiST Indexes
64.3. SP-GiST Indexes
64.4. GIN Indexes
64.5. BRIN Indexes
64.6. Hash Indexes
65. Database Physical Storage
65.1. Database File Layout
65.2. TOAST
65.3. Free Space Map
65.4. Visibility Map
65.5. The Initialization Fork
65.6. Database Page Layout
65.7. Heap-Only Tuples (HOT)
66. Transaction Processing
66.1. Transactions and Identifiers
66.2. Transactions and Locking
66.3. Subtransactions
66.4. Two-Phase Transactions
67. System Catalog Declarations and Initial Contents
67.1. System Catalog Declaration Rules
67.2. System Catalog Initial Data
67.3. BKI File Format
67.4. BKI Commands
67.5. Structure of the Bootstrap BKI File
67.6. BKI Example
68. How the Planner Uses Statistics
68.1. Row Estimation Examples
68.2. Multivariate Statistics Examples
68.3. Planner Statistics and Security
69. Backup Manifest Format
69.1. Backup Manifest Top-level Object
69.2. Backup Manifest File Object
69.3. Backup Manifest WAL Range Object