@@ -115,6 +115,36 @@ cases where a parent page's downlink key is "enlarged" after we look at it.
115115Any such enlargement would be to add child items that we aren't interested
116116in returning anyway.
117117
118+ Intrapage Indexing
119+ ------------------
120+
121+ Internal pages can contain a second, page-local level of GiST keys. A skip
122+ tuple stores the Union key of a group and is followed immediately by the real
123+ downlinks covered by that key. Its TID has InvalidBlockNumber, distinguishing
124+ it from real downlinks, and its offset field stores the number of following
125+ tuples in the group. Groups do not overlap or contain other skip tuples.
126+
127+ A scan first applies Consistent to the skip tuple. If it does not match, the
128+ whole group can be skipped. If it matches, the scan examines each real tuple
129+ normally. Skip tuples are never followed as downlinks or returned as heap
130+ TIDs. Ordered searches use the same rule: the group key only rejects a group
131+ and does not contribute a queue item or distance.
132+
133+ Insertion uses the same page-local level while choosing a subtree. Once a
134+ candidate downlink has established the best penalty for the first key column,
135+ a group whose union key has a worse penalty is skipped. Otherwise Penalty is
136+ evaluated for each member as usual. Later key columns continue to break ties
137+ between individual downlinks in the normal way.
138+
139+ Skip tuples are derived metadata. Removing them must leave an ordinary valid
140+ GiST page with exactly the same downlinks. Page updates rebuild the affected
141+ group from its real tuples, while page splits and both build methods account
142+ for metadata space. Before VACUUM deletes a downlink, it moves that downlink
143+ out of its group and decrements the group count. Existing pages without skip
144+ tuples therefore need no conversion. The current implementation creates skip
145+ tuples only on internal pages; adding them to leaf pages would also require
146+ maintaining group boundaries during tuple-level vacuuming and LP_DEAD cleanup.
147+
118148
119149Insert Algorithm
120150----------------
0 commit comments