aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2014-11-24 13:41:47 +0200
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2014-11-24 13:43:33 +0200
commit49b86fb1c97878ea2e3a8118df072c95f60077ac (patch)
treea6697c0b8b2ee5a4399fd3c2e54c9bdc9a3e92e8 /src
parent0bd624d63b056205fda17a2d694d91db16468e3f (diff)
downloadpostgresql-49b86fb1c97878ea2e3a8118df072c95f60077ac.tar.gz
postgresql-49b86fb1c97878ea2e3a8118df072c95f60077ac.zip
Add a few paragraphs to B-tree README explaining L&Y algorithm.
This gives an overview of what Lehman & Yao's paper is all about, so that you can understand the rest of the README without having to read the paper. Per discussion with Peter Geoghegan and others.
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/nbtree/README21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/backend/access/nbtree/README b/src/backend/access/nbtree/README
index 4820f76e3bb..213542c27f3 100644
--- a/src/backend/access/nbtree/README
+++ b/src/backend/access/nbtree/README
@@ -11,8 +11,25 @@ use a simplified version of the deletion logic described in Lanin and
Shasha (V. Lanin and D. Shasha, A Symmetric Concurrent B-Tree Algorithm,
Proceedings of 1986 Fall Joint Computer Conference, pp 380-389).
-The Lehman and Yao Algorithm and Insertions
--------------------------------------------
+The basic Lehman & Yao Algorithm
+--------------------------------
+
+Compared to a classic B-tree, L&Y adds a right-link pointer to each page,
+to the page's right sibling. It also adds a "high key" to each page, which
+is an upper bound on the keys that are allowed on that page. These two
+additions make it possible detect a concurrent page split, which allows the
+tree to be searched without holding any read locks (except to keep a single
+page from being modified while reading it).
+
+When a search follows a downlink to a child page, it compares the page's
+high key with the search key. If the search key is greater than the high
+key, the page must've been split concurrently, and you must follow the
+right-link to find the new page containing the key range you're looking
+for. This might need to be repeated, if the page has been split more than
+once.
+
+Differences to the Lehman & Yao algorithm
+-----------------------------------------
We have made the following changes in order to incorporate the L&Y algorithm
into Postgres: