Supported Versions: Current (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
47. Overview of PostgreSQL Internals
47.1. The Path of a Query
47.2. How Connections are Established
47.3. The Parser Stage
47.4. The PostgreSQL Rule System
47.5. Planner/Optimizer
47.6. Executor
48. System Catalogs
48.1. Overview
48.2. pg_aggregate
48.3. pg_am
48.4. pg_amop
48.5. pg_amproc
48.6. pg_attrdef
48.7. pg_attribute
48.8. pg_authid
48.9. pg_auth_members
48.10. pg_cast
48.11. pg_class
48.12. pg_collation
48.13. pg_constraint
48.14. pg_conversion
48.15. pg_database
48.16. pg_db_role_setting
48.17. pg_default_acl
48.18. pg_depend
48.19. pg_description
48.20. pg_enum
48.21. pg_event_trigger
48.22. pg_extension
48.23. pg_foreign_data_wrapper
48.24. pg_foreign_server
48.25. pg_foreign_table
48.26. pg_index
48.27. pg_inherits
48.28. pg_language
48.29. pg_largeobject
48.30. pg_largeobject_metadata
48.31. pg_namespace
48.32. pg_opclass
48.33. pg_operator
48.34. pg_opfamily
48.35. pg_pltemplate
48.36. pg_proc
48.37. pg_range
48.38. pg_rewrite
48.39. pg_replication_slots
48.40. pg_seclabel
48.41. pg_shdepend
48.42. pg_shdescription
48.43. pg_shseclabel
48.44. pg_statistic
48.45. pg_tablespace
48.46. pg_trigger
48.47. pg_ts_config
48.48. pg_ts_config_map
48.49. pg_ts_dict
48.50. pg_ts_parser
48.51. pg_ts_template
48.52. pg_type
48.53. pg_user_mapping
48.54. System Views
48.55. pg_available_extensions
48.56. pg_available_extension_versions
48.57. pg_cursors
48.58. pg_group
48.59. pg_indexes
48.60. pg_locks
48.61. pg_matviews
48.62. pg_prepared_statements
48.63. pg_prepared_xacts
48.64. pg_roles
48.65. pg_rules
48.66. pg_seclabels
48.67. pg_settings
48.68. pg_shadow
48.69. pg_stats
48.70. pg_tables
48.71. pg_timezone_abbrevs
48.72. pg_timezone_names
48.73. pg_user
48.74. pg_user_mappings
48.75. pg_views
49. Frontend/Backend Protocol
49.1. Overview
49.2. Message Flow
49.3. Streaming Replication Protocol
49.4. Message Data Types
49.5. Message Formats
49.6. Error and Notice Message Fields
49.7. Summary of Changes since Protocol 2.0
50. PostgreSQL Coding Conventions
50.1. Formatting
50.2. Reporting Errors Within the Server
50.3. Error Message Style Guide
51. Native Language Support
51.1. For the Translator
51.2. For the Programmer
52. Writing A Procedural Language Handler
53. Writing A Foreign Data Wrapper
53.1. Foreign Data Wrapper Functions
53.2. Foreign Data Wrapper Callback Routines
53.3. Foreign Data Wrapper Helper Functions
53.4. Foreign Data Wrapper Query Planning
54. Genetic Query Optimizer
54.1. Query Handling as a Complex Optimization Problem
54.2. Genetic Algorithms
54.3. Genetic Query Optimization (GEQO) in PostgreSQL
54.4. Further Reading
55. Index Access Method Interface Definition
55.1. Catalog Entries for Indexes
55.2. Index Access Method Functions
55.3. Index Scanning
55.4. Index Locking Considerations
55.5. Index Uniqueness Checks
55.6. Index Cost Estimation Functions
56. GiST Indexes
56.1. Introduction
56.2. Built-in Operator Classes
56.3. Extensibility
56.4. Implementation
56.5. Examples
57. SP-GiST Indexes
57.1. Introduction
57.2. Built-in Operator Classes
57.3. Extensibility
57.4. Implementation
57.5. Examples
58. GIN Indexes
58.1. Introduction
58.2. Built-in Operator Classes
58.3. Extensibility
58.4. Implementation
58.5. GIN Tips and Tricks
58.6. Limitations
58.7. Examples
59. Database Physical Storage
59.1. Database File Layout
59.2. TOAST
59.3. Free Space Map
59.4. Visibility Map
59.5. The Initialization Fork
59.6. Database Page Layout
60. BKI Backend Interface
60.1. BKI File Format
60.2. BKI Commands
60.3. Structure of the Bootstrap BKI File
60.4. Example
61. How the Planner Uses Statistics
61.1. Row Estimation Examples
61.2. Planner Statistics and Security