Part VII. Internals

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

Table of Contents

47. Overview of LightDB Internals
47.1. The Path of a Query
47.2. How Connections Are Established
47.3. The Parser Stage
47.4. The LightDB Rule System
47.5. Planner/Optimizer
47.6. Executor
48. System Catalogs
48.1. Overview
48.2. lt_attri_ext
48.3. lt_database_ext
48.4. lt_global_temp_table_ext
48.5. lt_object_ext
48.6. lt_package
48.7. lt_partition_ext
48.8. lt_proc_ext
48.9. lt_trigger_ext
48.10. lt_recyclebin
48.11. lt_type_ext
48.12. lt_variable
48.13. lt_namespace_ext
48.14. pg_aggregate
48.15. pg_am
48.16. pg_amop
48.17. pg_amproc
48.18. pg_attrdef
48.19. pg_attribute
48.20. pg_authid
48.21. pg_auth_members
48.22. pg_cast
48.23. pg_class
48.24. pg_collation
48.25. pg_constraint
48.26. pg_conversion
48.27. pg_database
48.28. pg_db_role_setting
48.29. pg_default_acl
48.30. pg_depend
48.31. pg_description
48.32. pg_enum
48.33. pg_event_trigger
48.34. pg_extension
48.35. pg_foreign_data_wrapper
48.36. pg_foreign_server
48.37. pg_foreign_table
48.38. pg_index
48.39. pg_inherits
48.40. pg_init_privs
48.41. pg_language
48.42. pg_largeobject
48.43. pg_largeobject_metadata
48.44. pg_namespace
48.45. pg_opclass
48.46. pg_operator
48.47. pg_opfamily
48.48. pg_partitioned_table
48.49. pg_policy
48.50. pg_proc
48.51. pg_publication
48.52. pg_publication_rel
48.53. pg_range
48.54. pg_replication_origin
48.55. pg_rewrite
48.56. pg_seclabel
48.57. pg_sequence
48.58. pg_shdepend
48.59. pg_shdescription
48.60. pg_shseclabel
48.61. pg_statistic
48.62. pg_statistic_ext
48.63. pg_statistic_ext_data
48.64. pg_subscription
48.65. pg_subscription_rel
48.66. pg_tablespace
48.67. pg_trigger
48.68. pg_ts_config
48.69. pg_ts_config_map
48.70. pg_ts_dict
48.71. pg_ts_parser
48.72. pg_ts_template
48.73. pg_type
48.74. pg_user_mapping
48.75. System Views
48.76. pg_available_extensions
48.77. pg_available_extension_versions
48.78. pg_config
48.79. pg_cursors
48.80. pg_file_settings
48.81. pg_group
48.82. pg_hba_file_rules
48.83. pg_indexes
48.84. pg_locks
48.85. pg_policies
48.86. pg_prepared_statements
48.87. pg_prepared_xacts
48.88. pg_publication_tables
48.89. pg_replication_origin_status
48.90. pg_replication_slots
48.91. pg_roles
48.92. pg_rules
48.93. pg_seclabels
48.94. pg_sequences
48.95. pg_settings
48.96. pg_shadow
48.97. pg_shmem_allocations
48.98. pg_stats
48.99. pg_stats_ext
48.100. pg_tables
48.101. pg_timezone_abbrevs
48.102. pg_timezone_names
48.103. pg_user
48.104. pg_user_mappings
48.105. pg_views
48.106. Oracle Compatible System View
49. Frontend/Backend Protocol
49.1. Overview
49.2. Message Flow
49.3. SASL Authentication
49.4. Streaming Replication Protocol
49.5. Logical Streaming Replication Protocol
49.6. Message Data Types
49.7. Message Formats
49.8. Error and Notice Message Fields
49.9. Logical Replication Message Formats
49.10. Summary of Changes since Protocol 2.0
50. LightDB Coding Conventions
50.1. Formatting
50.2. Reporting Errors Within the Server
50.3. Error Message Style Guide
50.4. Miscellaneous Coding Conventions
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
53.5. Row Locking in Foreign Data Wrappers
54. Writing a Table Sampling Method
54.1. Sampling Method Support Functions
55. Writing a Custom Scan Provider
55.1. Creating Custom Scan Paths
55.2. Creating Custom Scan Plans
55.3. Executing Custom Scans
56. Table Access Method Interface Definition
57. Index Access Method Interface Definition
57.1. Basic API Structure for Indexes
57.2. Index Access Method Functions
57.3. Index Scanning
57.4. Index Locking Considerations
57.5. Index Uniqueness Checks
57.6. Index Cost Estimation Functions
58. Generic WAL Records
59. B-Tree Indexes
59.1. Introduction
59.2. Behavior of B-Tree Operator Classes
59.3. B-Tree Support Functions
59.4. Implementation
60. GIN Indexes
60.1. Introduction
60.2. Built-in Operator Classes
60.3. Extensibility
60.4. Implementation
60.5. GIN Tips and Tricks
60.6. Limitations
60.7. Examples
61. Hash Indexes
61.1. Overview
61.2. Implementation
62. Database Physical Storage
62.1. Database File Layout
62.2. TOAST
62.3. Free Space Map
62.4. Visibility Map
62.5. The Initialization Fork
62.6. Database Page Layout
62.7. Heap-Only Tuples (HOT)
63. System Catalog Declarations and Initial Contents
63.1. System Catalog Declaration Rules
63.2. System Catalog Initial Data
63.3. BKI File Format
63.4. BKI Commands
63.5. Structure of the Bootstrap BKI File
63.6. BKI Example
64. How the Planner Uses Statistics
64.1. Row Estimation Examples
64.2. Multivariate Statistics Examples
64.3. Planner Statistics and Security
65. Backup Manifest Format
65.1. Backup Manifest Top-level Object
65.2. Backup Manifest File Object
65.3. Backup Manifest WAL Range Object