September 26, 2024: PostgreSQL 17 Released!
Supported Versions: Current (17) / 16 / 15 / 14 / 13 / 12
Development Versions: 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.

VII. Internals

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

Table of Contents
46. Overview of PostgreSQL Internals
46.1. The Path of a Query
46.2. How Connections are Established
46.3. The Parser Stage
46.4. The PostgreSQL Rule System
46.5. Planner/Optimizer
46.6. Executor
47. System Catalogs
47.1. Overview
47.2. pg_aggregate
47.3. pg_am
47.4. pg_amop
47.5. pg_amproc
47.6. pg_attrdef
47.7. pg_attribute
47.8. pg_authid
47.9. pg_auth_members
47.10. pg_cast
47.11. pg_class
47.12. pg_collation
47.13. pg_constraint
47.14. pg_conversion
47.15. pg_database
47.16. pg_db_role_setting
47.17. pg_default_acl
47.18. pg_depend
47.19. pg_description
47.20. pg_enum
47.21. pg_event_trigger
47.22. pg_extension
47.23. pg_foreign_data_wrapper
47.24. pg_foreign_server
47.25. pg_foreign_table
47.26. pg_index
47.27. pg_inherits
47.28. pg_language
47.29. pg_largeobject
47.30. pg_largeobject_metadata
47.31. pg_namespace
47.32. pg_opclass
47.33. pg_operator
47.34. pg_opfamily
47.35. pg_pltemplate
47.36. pg_proc
47.37. pg_range
47.38. pg_rewrite
47.39. pg_seclabel
47.40. pg_shdepend
47.41. pg_shdescription
47.42. pg_shseclabel
47.43. pg_statistic
47.44. pg_tablespace
47.45. pg_trigger
47.46. pg_ts_config
47.47. pg_ts_config_map
47.48. pg_ts_dict
47.49. pg_ts_parser
47.50. pg_ts_template
47.51. pg_type
47.52. pg_user_mapping
47.53. System Views
47.54. pg_available_extensions
47.55. pg_available_extension_versions
47.56. pg_cursors
47.57. pg_group
47.58. pg_indexes
47.59. pg_locks
47.60. pg_matviews
47.61. pg_prepared_statements
47.62. pg_prepared_xacts
47.63. pg_roles
47.64. pg_rules
47.65. pg_seclabels
47.66. pg_settings
47.67. pg_shadow
47.68. pg_stats
47.69. pg_tables
47.70. pg_timezone_abbrevs
47.71. pg_timezone_names
47.72. pg_user
47.73. pg_user_mappings
47.74. pg_views
48. Frontend/Backend Protocol
48.1. Overview
48.2. Message Flow
48.3. Streaming Replication Protocol
48.4. Message Data Types
48.5. Message Formats
48.6. Error and Notice Message Fields
48.7. Summary of Changes since Protocol 2.0
49. PostgreSQL Coding Conventions
49.1. Formatting
49.2. Reporting Errors Within the Server
49.3. Error Message Style Guide
50. Native Language Support
50.1. For the Translator
50.2. For the Programmer
51. Writing A Procedural Language Handler
52. Writing A Foreign Data Wrapper
52.1. Foreign Data Wrapper Functions
52.2. Foreign Data Wrapper Callback Routines
52.3. Foreign Data Wrapper Helper Functions
52.4. Foreign Data Wrapper Query Planning
53. Genetic Query Optimizer
53.1. Query Handling as a Complex Optimization Problem
53.2. Genetic Algorithms
53.3. Genetic Query Optimization (GEQO) in PostgreSQL
53.4. Further Reading
54. Index Access Method Interface Definition
54.1. Catalog Entries for Indexes
54.2. Index Access Method Functions
54.3. Index Scanning
54.4. Index Locking Considerations
54.5. Index Uniqueness Checks
54.6. Index Cost Estimation Functions
55. GiST Indexes
55.1. Introduction
55.2. Extensibility
55.3. Implementation
55.4. Examples
56. SP-GiST Indexes
56.1. Introduction
56.2. Extensibility
56.3. Implementation
56.4. Examples
57. GIN Indexes
57.1. Introduction
57.2. Extensibility
57.3. Implementation
57.4. GIN Tips and Tricks
57.5. Limitations
57.6. Examples
58. Database Physical Storage
58.1. Database File Layout
58.2. TOAST
58.3. Free Space Map
58.4. Visibility Map
58.5. The Initialization Fork
58.6. Database Page Layout
59. BKI Backend Interface
59.1. BKI File Format
59.2. BKI Commands
59.3. Structure of the Bootstrap BKI File
59.4. Example
60. How the Planner Uses Statistics
60.1. Row Estimation Examples
60.2. Planner Statistics and Security