Giter Club home page Giter Club logo

b-plus-tree's Introduction

Build Status

Memory based B+ tree in C++

Definition of the B-tree

Let h >= 0 be an integer, and k a natural number. A directed tree T is in the class (k, h) of B-trees if T is either empty (i.e. h=0) or has the following properties:

  • Each path from the root to any leaf has the same length h, also called the height of T, i.e. h is eequal to the number of nodes in path.

  • Each node except the root and the leaves has at least (k + 1) sons. The root is a leaf or has at least two sons.

  • Each node has at most (2k + 1) sons.

Properties of the B-tree

  • Each page holds between k and 2k keys (index elements) except the root page which may hold between 1 and 2k keys.

  • Let the number of keys on a page P, which is not a leaf, be L. Then P has L+1 sons.

  • Within each page P the keys are sequential in increasing order: x1, x2, ... xL, where k <= L <= 2k except for the root page for which 1 <= L <= 2k.

  • Furthermore, P contains (L + 1) pointers P0, P1 ... PL to the sons of P. On leaf pages these pointers are undefined (i.e. null pointers).

  • Let P(pi) be the page to which Pi points, let K(Pi) be the set of keys on the pages of that maximal subtree of which P(Pi) is the root. Then for the B-trees considered here the following conditions shall always hold:

    1. for each y in K(p0) y < xi
    2. for each y in K(pi) xi < y < xi+1 for i = 1,2,...,L-1
    3. for each y in K(pL) xL < y

References, books

  • A. Silberschatz, H.F. Korth, S. Sudarshan, "Database System Concepts", 6th ed. (McGraw Hill, 2011)

  • R. Ramakrishnan, J. Gehrke, "Database Management Systems ", 3rd ed. (McGraw Hill, 2003)

  • A. Drozdek, D.L. Simon "Data Structures in C", (PWS, 1995)

References, articles

  • R. Bayer E.M. McCreight, "Organization and maintenance of large ordered indexes", Acta Informatica, Volume 1, Issue 3, pp. 173–189, Year 1972, PDF

  • R. Bayer, "Symmetric binary B-Trees: Data structure and maintenance algorithms", Acta Informatica, Volume 1, Issue 4, pp. 290–306, Year 1972, Abstract

  • R. Bayer, K. Unterauer, "Prefix B-trees", ACM Transactions on Database Systems, Volume 2, Issue 1, pp. 11-26, Year 1977, Abstract

  • D. Comer, "Ubiquitous B-Tree", ACM Computing Surveys, Volume 11, Issue 2, Pages 121-137, Year 1979, PDF

  • J. Zhou "A B+-tree Index fot the Know-It-All Database Framework", 2003, PDF

  • D. Lomet, "The Evolution of Effective B-tree: Page Organization and Techniques: A Personal Account", SIGMOD Record, Volume 30, No. 3, 2001, PDF

  • R. ORLANDIC, H.M. MAHMOUD "STORAGE OVERHEAD OF O-TREES, B-TREES AND PREFIX B-TREES: A COMPARATIVE ANALYSIS", International Journal of Foundations of Computer Science, PDF

  • G. Graefe, "Write-Optimized B-Trees ", Proceedings of the 30th VLDB Conference, 2004, PDF

  • G. Graefe, "A Survey of B-Tree Logging and Recovery Technique", ACM Transactions on Database Systems, Vol. 35, No. 3, Article 16, 2012, PDF

  • G. Graefe, "Modern B-Tree Techniques", Foundations and Trends in Databases, Vol. 3, No. 4, pp. 203–402, Year 2010, PDF

  • G. Graefe, "A Survey of B-Tree Locking Technique", ACM Transactions on Database Systems, Vol. 35, No. 3, Article 16, Year 2010, PDF

  • P. Wang, "An In-Depth Analysis of Concurrent B-tree Algorithms", Massachusetts Institute of Technology Report MIT/LCS/TR-496, Year 1991, PDF

  • Y.-S. KWONG,D. WOOD, "A New Method for Concurrency in B-Trees", IEEE TRANSACTIONS ON SOFTWARE ENGINEERING, VOL. SE-8, NO. 3, pp. 211-222, Year 1982, PDF

  • M.K. Aguilera, W. Golab, M.A. Shah, "A Practical Scalable Distributed B-Tree", VLDB, Year 2008, PDF

Similar projects in C++:

  • cpp-btree

  • STX

  • From Wikipedia: B+Tree (Caution! The code has the bug in deletion procedure!)

Author

b-plus-tree's People

Contributors

romz-pl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

b-plus-tree's Issues

Minimal key value

Current implementation requires that there exists the Key::Dummy() value of the key, which is lower then all possible key values in the tree. See function LeafNode::insert and condition in "while loop".

This requirement must be removed.
This requirement limits number of available types used as the key.

Internal node representation

In the current implementation, internal node has the same number of Key and pointers. However, the specification of B+Tree requires that number of pointers is one less than the number of keys. Moreover, the additional (surplus) key is compared during insertion process, see function LeafNode::insert.

This problem must be removed!

It is expected that the new implementation will have number of keys one less than the number of pointers, as is required by B+tree specification.

Bug in deleting procedure

The tests in file main.cpp proves that the deleting procedure is erroneously.

More systematic tests are needed to specify the place in code responsible for this bug.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.