Skip to content

Commit 998fbd3

Browse files
author
Commitfest Bot
committed
[CF 7200] v3 - GiST intrapage indexing
This branch was automatically generated by a robot using patches from an email thread registered at: https://commitfest.postgresql.org/patch/7200 The branch will be overwritten each time a new patch version is posted to the thread, and also periodically to check for bitrot caused by changes on the master branch. Patch(es): https://www.postgresql.org/message-id/2AF68DEC-8CD1-4460-B02D-ACE1850E6484@yandex-team.ru Author(s): Andrey Borodin
2 parents 3c982c9 + 0bde39d commit 998fbd3

13 files changed

Lines changed: 813 additions & 37 deletions

File tree

src/backend/access/gist/README

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,36 @@ cases where a parent page's downlink key is "enlarged" after we look at it.
115115
Any such enlargement would be to add child items that we aren't interested
116116
in 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

119149
Insert Algorithm
120150
----------------

0 commit comments

Comments
 (0)