# Part VII. Internals

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

**Table of Contents**

[51. Overview of PostgreSQL Internals](overview.html)

[51.1. The Path of a Query](query-path.html)

[51.2. How Connections Are Established](connect-estab.html)

[51.3. The Parser Stage](parser-stage.html)

[51.4. The PostgreSQL Rule System](rule-system.html)

[51.5. Planner/Optimizer](planner-optimizer.html)

[51.6. Executor](executor.html)

[52. System Catalogs](catalogs.html)

[52.1. Overview](catalogs-overview.html)

[52.2. `pg_aggregate`](catalog-pg-aggregate.html)

[52.3. `pg_am`](catalog-pg-am.html)

[52.4. `pg_amop`](catalog-pg-amop.html)

[52.5. `pg_amproc`](catalog-pg-amproc.html)

[52.6. `pg_attrdef`](catalog-pg-attrdef.html)

[52.7. `pg_attribute`](catalog-pg-attribute.html)

[52.8. `pg_authid`](catalog-pg-authid.html)

[52.9. `pg_auth_members`](catalog-pg-auth-members.html)

[52.10. `pg_cast`](catalog-pg-cast.html)

[52.11. `pg_class`](catalog-pg-class.html)

[52.12. `pg_collation`](catalog-pg-collation.html)

[52.13. `pg_constraint`](catalog-pg-constraint.html)

[52.14. `pg_conversion`](catalog-pg-conversion.html)

[52.15. `pg_database`](catalog-pg-database.html)

[52.16. `pg_db_role_setting`](catalog-pg-db-role-setting.html)

[52.17. `pg_default_acl`](catalog-pg-default-acl.html)

[52.18. `pg_depend`](catalog-pg-depend.html)

[52.19. `pg_description`](catalog-pg-description.html)

[52.20. `pg_enum`](catalog-pg-enum.html)

[52.21. `pg_event_trigger`](catalog-pg-event-trigger.html)

[52.22. `pg_extension`](catalog-pg-extension.html)

[52.23. `pg_foreign_data_wrapper`](catalog-pg-foreign-data-wrapper.html)

[52.24. `pg_foreign_server`](catalog-pg-foreign-server.html)

[52.25. `pg_foreign_table`](catalog-pg-foreign-table.html)

[52.26. `pg_index`](catalog-pg-index.html)

[52.27. `pg_inherits`](catalog-pg-inherits.html)

[52.28. `pg_init_privs`](catalog-pg-init-privs.html)

[52.29. `pg_language`](catalog-pg-language.html)

[52.30. `pg_largeobject`](catalog-pg-largeobject.html)

[52.31. `pg_largeobject_metadata`](catalog-pg-largeobject-metadata.html)

[52.32. `pg_namespace`](catalog-pg-namespace.html)

[52.33. `pg_opclass`](catalog-pg-opclass.html)

[52.34. `pg_operator`](catalog-pg-operator.html)

[52.35. `pg_opfamily`](catalog-pg-opfamily.html)

[52.36. `pg_partitioned_table`](catalog-pg-partitioned-table.html)

[52.37. `pg_policy`](catalog-pg-policy.html)

[52.38. `pg_proc`](catalog-pg-proc.html)

[52.39. `pg_publication`](catalog-pg-publication.html)

[52.40. `pg_publication_rel`](catalog-pg-publication-rel.html)

[52.41. `pg_range`](catalog-pg-range.html)

[52.42. `pg_replication_origin`](catalog-pg-replication-origin.html)

[52.43. `pg_rewrite`](catalog-pg-rewrite.html)

[52.44. `pg_seclabel`](catalog-pg-seclabel.html)

[52.45. `pg_sequence`](catalog-pg-sequence.html)

[52.46. `pg_shdepend`](catalog-pg-shdepend.html)

[52.47. `pg_shdescription`](catalog-pg-shdescription.html)

[52.48. `pg_shseclabel`](catalog-pg-shseclabel.html)

[52.49. `pg_statistic`](catalog-pg-statistic.html)

[52.50. `pg_statistic_ext`](catalog-pg-statistic-ext.html)

[52.51. `pg_statistic_ext_data`](catalog-pg-statistic-ext-data.html)

[52.52. `pg_subscription`](catalog-pg-subscription.html)

[52.53. `pg_subscription_rel`](catalog-pg-subscription-rel.html)

[52.54. `pg_tablespace`](catalog-pg-tablespace.html)

[52.55. `pg_transform`](catalog-pg-transform.html)

[52.56. `pg_trigger`](catalog-pg-trigger.html)

[52.57. `pg_ts_config`](catalog-pg-ts-config.html)

[52.58. `pg_ts_config_map`](catalog-pg-ts-config-map.html)

[52.59. `pg_ts_dict`](catalog-pg-ts-dict.html)

[52.60. `pg_ts_parser`](catalog-pg-ts-parser.html)

[52.61. `pg_ts_template`](catalog-pg-ts-template.html)

[52.62. `pg_type`](catalog-pg-type.html)

[52.63. `pg_user_mapping`](catalog-pg-user-mapping.html)

[52.64. System Views](views-overview.html)

[52.65. `pg_available_extensions`](view-pg-available-extensions.html)

[52.66. `pg_available_extension_versions`](view-pg-available-extension-versions.html)

[52.67. `pg_backend_memory_contexts`](view-pg-backend-memory-contexts.html)

[52.68. `pg_config`](view-pg-config.html)

[52.69. `pg_cursors`](view-pg-cursors.html)

[52.70. `pg_file_settings`](view-pg-file-settings.html)

[52.71. `pg_group`](view-pg-group.html)

[52.72. `pg_hba_file_rules`](view-pg-hba-file-rules.html)

[52.73. `pg_indexes`](view-pg-indexes.html)

[52.74. `pg_locks`](view-pg-locks.html)

[52.75. `pg_matviews`](view-pg-matviews.html)

[52.76. `pg_policies`](view-pg-policies.html)

[52.77. `pg_prepared_statements`](view-pg-prepared-statements.html)

[52.78. `pg_prepared_xacts`](view-pg-prepared-xacts.html)

[52.79. `pg_publication_tables`](view-pg-publication-tables.html)

[52.80. `pg_replication_origin_status`](view-pg-replication-origin-status.html)

[52.81. `pg_replication_slots`](view-pg-replication-slots.html)

[52.82. `pg_roles`](view-pg-roles.html)

[52.83. `pg_rules`](view-pg-rules.html)

[52.84. `pg_seclabels`](view-pg-seclabels.html)

[52.85. `pg_sequences`](view-pg-sequences.html)

[52.86. `pg_settings`](view-pg-settings.html)

[52.87. `pg_shadow`](view-pg-shadow.html)

[52.88. `pg_shmem_allocations`](view-pg-shmem-allocations.html)

[52.89. `pg_stats`](view-pg-stats.html)

[52.90. `pg_stats_ext`](view-pg-stats-ext.html)

[52.91. `pg_stats_ext_exprs`](view-pg-stats-ext-exprs.html)

[52.92. `pg_tables`](view-pg-tables.html)

[52.93. `pg_timezone_abbrevs`](view-pg-timezone-abbrevs.html)

[52.94. `pg_timezone_names`](view-pg-timezone-names.html)

[52.95. `pg_user`](view-pg-user.html)

[52.96. `pg_user_mappings`](view-pg-user-mappings.html)

[52.97. `pg_views`](view-pg-views.html)

[53. Frontend/Backend Protocol](protocol.html)

[53.1. Overview](protocol-overview.html)

[53.2. Message Flow](protocol-flow.html)

[53.3. SASL Authentication](sasl-authentication.html)

[53.4. Streaming Replication Protocol](protocol-replication.html)

[53.5. Logical Streaming Replication Protocol](protocol-logical-replication.html)

[53.6. Message Data Types](protocol-message-types.html)

[53.7. Message Formats](protocol-message-formats.html)

[53.8. Error and Notice Message Fields](protocol-error-fields.html)

[53.9. Logical Replication Message Formats](protocol-logicalrep-message-formats.html)

[53.10. Summary of Changes since Protocol 2.0](protocol-changes.html)

[54. PostgreSQL Coding Conventions](source.html)

[54.1. Formatting](source-format.html)

[54.2. Reporting Errors Within the Server](error-message-reporting.html)

[54.3. Error Message Style Guide](error-style-guide.html)

[54.4. Miscellaneous Coding Conventions](source-conventions.html)

[55. Native Language Support](nls.html)

[55.1. For the Translator](nls-translator.html)

[55.2. For the Programmer](nls-programmer.html)

[56. Writing a Procedural Language Handler](plhandler.html)

[57. Writing a Foreign Data Wrapper](fdwhandler.html)

[57.1. Foreign Data Wrapper Functions](fdw-functions.html)

[57.2. Foreign Data Wrapper Callback Routines](fdw-callbacks.html)

[57.3. Foreign Data Wrapper Helper Functions](fdw-helpers.html)

[57.4. Foreign Data Wrapper Query Planning](fdw-planning.html)

[57.5. Row Locking in Foreign Data Wrappers](fdw-row-locking.html)

[58. Writing a Table Sampling Method](tablesample-method.html)

[58.1. Sampling Method Support Functions](tablesample-support-functions.html)

[59. Writing a Custom Scan Provider](custom-scan.html)

[59.1. Creating Custom Scan Paths](custom-scan-path.html)

[59.2. Creating Custom Scan Plans](custom-scan-plan.html)

[59.3. Executing Custom Scans](custom-scan-execution.html)

[60. Genetic Query Optimizer](geqo.html)

[60.1. Query Handling as a Complex Optimization Problem](geqo-intro.html)

[60.2. Genetic Algorithms](geqo-intro2.html)

[60.3. Genetic Query Optimization (GEQO) in PostgreSQL](geqo-pg-intro.html)

[60.4. Further Reading](geqo-biblio.html)

[61. Table Access Method Interface Definition](tableam.html)

[62. Index Access Method Interface Definition](indexam.html)

[62.1. Basic API Structure for Indexes](index-api.html)

[62.2. Index Access Method Functions](index-functions.html)

[62.3. Index Scanning](index-scanning.html)

[62.4. Index Locking Considerations](index-locking.html)

[62.5. Index Uniqueness Checks](index-unique-checks.html)

[62.6. Index Cost Estimation Functions](index-cost-estimation.html)

[63. Generic WAL Records](generic-wal.html)

[64. B-Tree Indexes](btree.html)

[64.1. Introduction](btree-intro.html)

[64.2. Behavior of B-Tree Operator Classes](btree-behavior.html)

[64.3. B-Tree Support Functions](btree-support-funcs.html)

[64.4. Implementation](btree-implementation.html)

[65. GiST Indexes](gist.html)

[65.1. Introduction](gist-intro.html)

[65.2. Built-in Operator Classes](gist-builtin-opclasses.html)

[65.3. Extensibility](gist-extensibility.html)

[65.4. Implementation](gist-implementation.html)

[65.5. Examples](gist-examples.html)

[66. SP-GiST Indexes](spgist.html)

[66.1. Introduction](spgist-intro.html)

[66.2. Built-in Operator Classes](spgist-builtin-opclasses.html)

[66.3. Extensibility](spgist-extensibility.html)

[66.4. Implementation](spgist-implementation.html)

[66.5. Examples](spgist-examples.html)

[67. GIN Indexes](gin.html)

[67.1. Introduction](gin-intro.html)

[67.2. Built-in Operator Classes](gin-builtin-opclasses.html)

[67.3. Extensibility](gin-extensibility.html)

[67.4. Implementation](gin-implementation.html)

[67.5. GIN Tips and Tricks](gin-tips.html)

[67.6. Limitations](gin-limit.html)

[67.7. Examples](gin-examples.html)

[68. BRIN Indexes](brin.html)

[68.1. Introduction](brin-intro.html)

[68.2. Built-in Operator Classes](brin-builtin-opclasses.html)

[68.3. Extensibility](brin-extensibility.html)

[69. Hash Indexes](hash-index.html)

[69.1. Overview](hash-intro.html)

[69.2. Implementation](hash-implementation.html)

[70. Database Physical Storage](storage.html)

[70.1. Database File Layout](storage-file-layout.html)

[70.2. TOAST](storage-toast.html)

[70.3. Free Space Map](storage-fsm.html)

[70.4. Visibility Map](storage-vm.html)

[70.5. The Initialization Fork](storage-init.html)

[70.6. Database Page Layout](storage-page-layout.html)

[71. System Catalog Declarations and Initial Contents](bki.html)

[71.1. System Catalog Declaration Rules](system-catalog-declarations.html)

[71.2. System Catalog Initial Data](system-catalog-initial-data.html)

[71.3. BKI File Format](bki-format.html)

[71.4. BKI Commands](bki-commands.html)

[71.5. Structure of the Bootstrap BKI File](bki-structure.html)

[71.6. BKI Example](bki-example.html)

[72. How the Planner Uses Statistics](planner-stats-details.html)

[72.1. Row Estimation Examples](row-estimation-examples.html)

[72.2. Multivariate Statistics Examples](multivariate-statistics-examples.html)

[72.3. Planner Statistics and Security](planner-stats-security.html)

[73. Backup Manifest Format](backup-manifest-format.html)

[73.1. Backup Manifest Top-level Object](backup-manifest-toplevel.html)

[73.2. Backup Manifest File Object](backup-manifest-files.html)

[73.3. Backup Manifest WAL Range Object](backup-manifest-wal-ranges.html)

