B-tree based storage engine for storing hierarchical structures
Disclosed embodiments may provide techniques for performing database operations using a hierarchy-enhanced B-tree index. A computer-implemented method can include executing a query to access a data item by traversing a root node of a hierarchy-enhanced B-tree index to a particular leaf node connected to the root node. In some instances, the particular leaf node indicates a first unstructured-data record. The method can also include determining that the particular leaf node includes a sequential data structure. The sequential data structure identifies a hierarchical relationship between the first unstructured-data record and other unstructured-data records indicated by one or more other leaf nodes. The method can also include using the sequential data structure to access the one or more other leaf nodes without additional path traversals of the hierarchy-enhanced B-tree index. The method can also include retrieving the data item by parsing the other unstructured-data records.
1 . A method comprising:
receiving a query to access a data item from a non-relational database, wherein the non-relational database stores a plurality of unstructured-data records across one or more storage systems;
executing the query to traverse a root node of a hierarchy-enhanced B-tree index to a particular leaf node of a set of leaf nodes connected to the root node, wherein the particular leaf node indicates a first unstructured-data record;
determining that the particular leaf node includes a sequential data structure, wherein the sequential data structure identifies a hierarchical relationship between the first unstructured-data record and other unstructured-data records indicated by one or more other leaf nodes, and wherein the sequential data structure includes:
a first set of pointers that originate from the first unstructured-data record and sequentially traverse through each of the other unstructured-data records; and
a second set of pointers, wherein each of the second set of pointers originate from a corresponding unstructured-data record of the other unstructured-data records and point directly towards the first unstructured-data record;
using at least one of the first and second sets of pointers of the sequential data structure to access the one or more other leaf nodes without additional path traversals of the hierarchy-enhanced B-tree index, wherein using the sequential data structure without the additional path traversals of the hierarchy-enhanced B-tree index increases efficiency of database-management systems in accessing the first unstructured-data record and other unstructured-data records having the hierarchical relationship;
retrieving the data item by parsing the other unstructured-data records; and
generating a response to the query that includes the data item.
2 . The method of claim 1 , further comprising:
receiving a request to remove a second unstructured-data record of the other unstructured-data records; and
updating the sequential data structure to indicate a modified hierarchical relationship that excludes the second unstructured-data record.
3 . The method of claim 1 , further comprising:
receiving a request to move a second unstructured-data record of the other unstructured-data records to be listed under a third unstructured-data record indicated by another leaf node;
updating the sequential data structure to indicate a modified hierarchical relationship that excludes the second unstructured-data record; and
generating a second sequential data structure to indicate a second hierarchical relationship that associates the second unstructured-data record and the third unstructured-data record.
4 . The method of claim 1 , wherein the response additionally includes another data item associated with the first unstructured-data record.
5 . The method of claim 1 , wherein the data item is accessed from a second unstructured-data record of the other unstructured-data records, and wherein the response additionally includes a data path between the first unstructured-data record and the second unstructured-data record.
6 . The method of claim 1 , wherein the response additionally includes a list of the other unstructured-data records.
7 . A system comprising:
one or more processors; and
a non-transitory computer-readable medium storing instructions that when executed by the one or more processors, cause the one or more processors to perform operations including:
receiving a query to access a data item from a non-relational database, wherein the non-relational database stores a plurality of unstructured-data records across one or more storage systems;
executing the query to traverse a root node of a hierarchy-enhanced B-tree index to a particular leaf node of a set of leaf nodes connected to the root node, wherein the particular leaf node indicates a first unstructured-data record;
determining that the particular leaf node includes a sequential data structure, wherein the sequential data structure identifies a hierarchical relationship between the first unstructured-data record and other unstructured-data records indicated by one or more other leaf nodes, and wherein the sequential data structure includes:
a first set of pointers that originate from the first unstructured-data record and sequentially traverse through each of the other unstructured-data records; and
a second set of pointers, wherein each of the second set of pointers originate from a corresponding unstructured-data record of the other unstructured-data records and point directly towards the first unstructured-data record;
using at least one of the first and second sets of pointers of the sequential data structure to access the one or more other leaf nodes without additional path traversals of the hierarchy-enhanced B-tree index, wherein using the sequential data structure without the additional path traversals of the hierarchy-enhanced B-tree index increases efficiency of database-management systems in accessing the first unstructured-data record and other unstructured-data records having the hierarchical relationship;
retrieving the data item by parsing the other unstructured-data records; and
generating a response to the query that includes the data item.
8 . The system of claim 6 , wherein the first unstructured-data record is associated with an initial version, wherein the instructions further cause the one or more processors to perform operations comprising:
receiving a request to create an updated version of the first unstructured-data record;
generating a new leaf node that indicates the updated version of the first unstructured-data record;
connecting the new leaf node to the root node; and
updating the sequential data structure to incorporate the new leaf node.
9 . The system of claim 6 , wherein the instructions further cause the one or more processors to perform operations comprising:
receiving a request to remove a second unstructured-data record of the other unstructured-data records; and
updating the sequential data structure to indicate a modified hierarchical relationship that excludes the second unstructured-data record.
10 . The system of claim 6 , wherein the instructions further cause the one or more processors to perform operations comprising:
receiving a request to move a second unstructured-data record of the other unstructured-data records to be listed under a third unstructured-data record indicated by another leaf node;
updating the sequential data structure to indicate a modified hierarchical relationship that excludes the second unstructured-data record; and
generating a second sequential data structure to indicate a second hierarchical relationship that associates the second unstructured-data record and the third unstructured-data record.
11 . The system of claim 6 , wherein the response additionally includes another data item associated with the first unstructured-data record.
12 . The system of claim 6 , wherein the data item is accessed from a second unstructured-data record of the other unstructured-data records, and wherein the response additionally includes a data path between the first unstructured-data record and the second unstructured-data record.
13 . The system of claim 6 , wherein the response additionally includes a list of the other unstructured-data records.
14 . A non-transitory computer-readable medium storing instructions that when executed by one or more processors, cause the one or more processors to perform operations including:
receiving a query to access a data item from a non-relational database, wherein the non-relational database stores a plurality of unstructured-data records across one or more storage systems;
executing the query to traverse a root node of a hierarchy-enhanced B-tree index to a particular leaf node of a set of leaf nodes connected to the root node, wherein the particular leaf node indicates a first unstructured-data record;
determining that the particular leaf node includes a sequential data structure, wherein the sequential data structure identifies a hierarchical relationship between the first unstructured-data record and other unstructured-data records indicated by one or more other leaf nodes, and wherein the sequential data structure includes:
a first set of pointers that originate from the first unstructured-data record and point towards each of the other unstructured-data records; and
a second set of pointers, wherein each of the second set of pointers originate from a corresponding unstructured-data record of the other unstructured-data records and point directly towards the first unstructured-data record;
using at least one of the second set of pointers of the sequential data structure to access the one or more other leaf nodes without additional path traversals of the hierarchy-enhanced B-tree index, wherein using the sequential data structure without the additional path traversals of the hierarchy-enhanced B-tree index increases efficiency of database-management systems in accessing the first unstructured-data record and other unstructured-data records having the hierarchical relationship; retrieving the data item by parsing the other unstructured-data records; and
generating a response to the query that includes the data item.
15 . The non-transitory computer-readable medium of claim 13 , wherein the first unstructured-data record is associated with an initial version, wherein the instructions further cause the one or more processors to perform operations comprising:
receiving a request to create an updated version of the first unstructured-data record;
generating a new leaf node that indicates the updated version of the first unstructured-data record;
connecting the new leaf node to the root node; and
updating the sequential data structure to incorporate the new leaf node.
16 . The non-transitory computer-readable medium of claim 13 , wherein the instructions further cause the one or more processors to perform operations comprising:
receiving a request to remove a second unstructured-data record of the other unstructured-data records; and
updating the sequential data structure to indicate a modified hierarchical relationship that excludes the second unstructured-data record.
17 . The non-transitory computer-readable medium of claim 13 , wherein the instructions further cause the one or more processors to perform operations comprising:
receiving a request to move a second unstructured-data record of the other unstructured-data records to be listed under a third unstructured-data record indicated by another leaf node;
updating the sequential data structure to indicate a modified hierarchical relationship that excludes the second unstructured-data record; and
generating a second sequential data structure to indicate a second hierarchical relationship that associates the second unstructured-data record and the third unstructured-data record.
18 . The non-transitory computer-readable medium of claim 13 , wherein the response additionally includes another data item associated with the first unstructured-data record.
19 . The non-transitory computer-readable medium of claim 13 , wherein the data item is accessed from a second unstructured-data record of the other unstructured-data records, and wherein the response additionally includes a data path between the first unstructured-data record and the second unstructured-data record.
20 . The method of claim 1 , wherein the first unstructured-data record is associated with an initial version, the method further comprising:
receiving a request to create an updated version of the first unstructured-data record;
generating a new leaf node that indicates the updated version of the first unstructured-data record;
connecting the new leaf node to the root node; and
updating the sequential data structure to incorporate the new leaf node.