Effective use of TRIE data structure in database

Through hierarchical trie structure and bitmap optimization, the performance problem of B-tree index in high-cardinality and low-cardinality queries is solved, efficient storage and query of trie in sparse filling are realized, and it adapts to the needs of large alphabets and multiple data types. , which simplifies query optimization and execution plan generation.

CN110637291BActive Publication Date: 2024-08-23CENSHARE GMBH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201880032378.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2017-03-15
Filing Date
2018-03-15
Publication Date
2024-08-23
Estimated Expiration
2038-03-15

AI Technical Summary

Technical Problem

In existing databases and information retrieval systems, B-tree indexes have increased access time when processing large amounts of data, low cardinality query performance is poor, and it is difficult to handle multi-dimensional queries and range queries. Trie data structures have low storage space efficiency when sparsely populated, and Difficult to accommodate large alphabets and multiple data types.

Method used

Adopt a hierarchical trie structure, use bitmaps to optimize trie storage and query, reduce storage space through chain node and terminal optimization, combine logical bitmaps and content bitmaps for bitmap compression, and support flexible data types and large alphabets. storage, and simplify query optimization through lazy evaluation and functional composition.

Benefits of technology

It achieves good query performance under both high and low cardinality keys, reduces storage space requirements, supports flexible data types and storage of large alphabets, and simplifies query optimization and execution plan generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN110637291B_ABST
    Figure CN110637291B_ABST
Patent Text Reader

Abstract

The present invention provides a time-saving method for executing queries in a database or information retrieval system, the method comprising performing operations such as intersection, union, difference and XOR on two or more key sets stored in the database or information retrieval system. In the novel execution model, all data sources are tries. Two or more input tries are combined according to corresponding set operations to obtain key sets associated with nodes of the corresponding result trie. The intersection operations performed in this manner can be used for efficient range queries, especially when two or more data items are involved in the query. The physical algebra of the implementation of the bitmap-based trie directly corresponds to the logical algebra of set operations and allows efficient implementation by bitwise Boolean operations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates generally to the efficient use of trie data structures in database and information retrieval systems, and to querying such systems with high performance. Background Art

[0002] Databases and information retrieval systems are used to process structured and unstructured information. Typically, structured data is the domain of databases (such as relational databases), while unstructured information is the domain of information retrieval systems (such as full-text search). A database engine is the part of a database management system (or other application) that stores and retrieves data. For information retrieval systems, this function is performed by a search engine.

[0003] Indexing is used to improve the performance of a database or information retrieval system. Without an index for a query (also called a lookup or access by "key"), the entire database or information base would have to be scanned to deliver the result, which would be too slow to be useful.

[0004] A database index is comparable to the index provided by a book: to find a particular keyword, a user does not have to read the entire book, but instead looks for a keyword in an index that contains references to pages related to that keyword. This is also the basic principle behind search engines: for any given search term, they quickly find documents containing that search term by consulting the appropriate index. An example query for an information retrieval system is a full-text search, for which the term (word) is stored as a key and the document ID is also stored as a key (see below). Figures 70A-70F ). For example, if the term "apple" can be found in documents with IDs 10 and 33, two composite keys ("apple", 10) and ("apple", 33) are stored in the index. These terms are stored as keys so that searches for "apple" and "pear" can be performed, for example.

[0005] The classic approach to indexing is to use a so-called B-tree index. Invented in 1972 by R. Bayer and E. McCreight, the B-tree is still the main data structure used for this purpose. However, B-tree indexes have major disadvantages. For example, the time to access the data increases logarithmically with the amount of data. An increase in the size of the data by one order of magnitude will approximately double the access time, an increase in the size of the data by two orders of magnitude will triple the access time, and so on. In addition, B-tree indexes do not help to improve the query performance of so-called low-cardinality criteria. For example, creating an index on the attribute "gender" with the values ​​"male", "female" and "unknown" will not improve performance compared to scanning and filtering all records. Finally, since B-tree indexes cannot be efficiently joined (combined), multidimensional queries, i.e. queries involving multiple conditions / attributes, are difficult to handle efficiently.

[0006] M. Boehm et al., “Efficient In-Memory Indexing with Generalized Prefix-Trees”, in: T. et al. (eds.), BTW.LNI, Vol. 180, pp. 227-246, Kaiserslautern, Germany (2011), suggest using a "trie" or trie data structure to store and process database indexes. A trie is a tree data structure and is sometimes referred to as a "radix tree" or "prefix tree". The term trie originates from the word "reTRIEval". Instead of storing keys inside nodes, the path to the nodes of a trie defines the keys associated therewith, with the root node representing an empty key. More specifically, each node is associated with a key portion, the value of which (sometimes referred to herein as the "value of the node") can be indicated by a pointer from a parent node. The value is selected from a predefined alphabet of possible values. The path from the root node in a trie to another node (e.g., to a leaf node) defines the key (or "key prefix" in the case of an internal node, i.e., a node that is not a leaf node) with which the node is associated, where the key is a cascade of the key portions associated with the nodes on the path. The time complexity of trie does not depend on the number of keys present in the trie but on the key length.

[0007] Space-efficient trie data structure

[0008] One way to implement a trie data structure is to store the nodes separately in memory, with each node including: node type information indicating whether the node is a leaf node; an array of pointers to its child nodes (at least if the node is not a leaf node); and in the case of a leaf node, a possible payload, such as a value associated with a key. Using this approach, traversal from node to node is a constant time operation, because the corresponding child pointer corresponds to an array entry representing the corresponding key portion. However, since the corresponding array includes and stores many empty entries, memory usage can be very inefficient for nodes with only a few child nodes. This is especially true when using larger alphabets, because they require storing a large number of child-pointers.

[0009] In order to use memory space more efficiently, implementations of trie data structures have been developed that avoid storing null pointers. Such solutions may include storing only a list of non-null pointers and their corresponding key part values, rather than an array containing all possible pointers. The disadvantage of this approach is that for traversal from node to node, the list in the corresponding parent node must be scanned, or if the list is sorted by the value of the key part, a binary search must be performed. In addition, since a specific pointer for a specific value of the key part needs to be identified, the associated value of the key part must also be stored, which reduces memory space efficiency.

[0010] Other ways of storing trie data structures in a compact format have been developed. For example, Dr. Bagwell, "Fast And Space Efficient Trie Searches", Technical Report, EPFL, Switzerland (2000), discloses a trie data structure based on a bitmap. This trie data structure uses a bitmap to mark all non-null pointers of a parent node. In particular, the set bits in the bitmap mark valid (non-null) branches. Each parent node also includes one or more pointers, each of which is associated with a bit set in the bitmap and points to the child nodes of the parent node. The value of the key portion of the child node is determined by the value of the bit (set) in the bitmap included by the parent node, where the bit is associated with the pointer to the child node.

[0011] The pointer has a predetermined length or size and can be stored in the same or opposite order as the bits set in the bitmap. Based on the number of the least significant bits set in the bitmap, the memory address of the pointer associated with the bit set in the bitmap can be easily calculated. Since the number of the least significant bits set can be effectively calculated using a simple bit operation and a CTPOP (count fill) operation that determines the number of set bits, the determination of the corresponding pointer and therefore the next child node is fast. For example, this count fill method is available in the Java programming language and is called "Long.bitCount()". CTPOP itself can be implemented very efficiently using a "bit-hack", and many modern CPUs even provide CTPOP as an internal instruction.

[0012] Since the bitmap indicates the alphabet values ​​associated with valid branches, only existing (non-null) pointers need to be stored. Therefore, memory usage can be reduced. On the other hand, the address of a particular pointer can be easily determined in constant time based on the level of its associated bit among the set bits in the bitmap. Finally, the value of the bit associated with the pointer to the child node represents the key part value of the child node in an efficient manner. Therefore, compared with the key part value based on Figure 4Compared to the list trie data structure shown in , the bitmap-based trie data structure provides a more efficient way to handle memory allocation and processing tries.

[0013] However, the inventors have found that in many application scenarios, the memory space is used inefficiently. This is particularly true when the trie is sparsely populated and / or degenerates into a chain of nodes (each node has a single child pointer and wastes space). Therefore, it is desirable to further reduce the storage space required to store a trie used by a database application or information retrieval system, and in particular to reduce the amount of memory required to store pointers and / or bitmaps used to implement the trie, without significantly increasing the speed required to traverse the trie.

[0014] Key Encoding

[0015] Typically, the alphabet base of the trie used in the prior art is relatively large, such as 256, so as to be able to accommodate characters from a larger alphabet (such as Unicode). Using 256 different values, 8 bits (2 8 =256) or 1 byte. However, in the case where the trie uses a bitmap as described above, the width of the bitmap increases with the cardinality of the alphabet. For example, an alphabet with a cardinality of 256 requires a bitmap size of 256 bits. Such a large bitmap may be space-inefficient, especially when the trie is sparsely populated, because 256 bits need to be allocated to each node, although only a small portion of them may be used. In addition, since the bit width of the registers of modern computers is typically only 64 bits, a large bitmap with, for example, 256 bits cannot be processed in a time-saving manner. If the trie is to accommodate characters of an even larger alphabet, the efficiency problem will increase further. Therefore, the cardinality of the alphabet whose characters can be stored in the prior art trie in a space-saving and time-saving manner is limited.

[0016] Furthermore, tries are used in the prior art only to store predefined data types, where the data types are typically limited to primitive data types such as numbers or characters. Such use imposes constraints on the keys that can be stored in a trie and makes the trie data structure less suitable for storing database or information retrieval system indexes.

[0017] Therefore, another object of the present invention is to provide a trie that can be used in a flexible manner, and / or a method of using a trie in a flexible manner. In fact, an object of the present invention is to provide a trie data structure that can be used as a general database or information retrieval system index, and a method of using a trie data structure as a general database or information retrieval system index. In addition, an object of the present invention is to provide a trie that stores keys of a database index in such a way that database queries involving more than one data item can be processed in a time-saving manner.

[0018] Query Execution

[0019] Queries executed in a database are usually expressed in logical algebra (e.g., SQL). For query execution, the query must be converted into physical algebra: a physical query execution plan (QEP). The query is rewritten, optimized, and a QEP is prepared so that the query execution engine (QEE) executes the QEP generated by the previous steps on the database.

[0020] For processing, a QEP typically includes a collection of related operators that are intended to produce a query result. Most databases represent a QEP by a tree, where nodes are operators, leaf nodes are data sources, and edges are relationships between operators in the form of producer-consumer.

[0021] Many database engines follow an iterator-based execution model in QEE, where operators implement the following methods: Open (prepare the operator to produce data), Next (produce new data units at the demand of the operator's consumer), Close (complete execution and release resources). Calling one of these operations starting from the root operator will propagate it to its operator child nodes, and so on until the data source (and leaf nodes) is reached. In this way, control flows from consumers down to producers, and data flows from producers up to consumers in the query execution plan operator tree. This approach provides clean design and encapsulation because each operator does not require global knowledge.

[0022] However, such an execution model has serious drawbacks. First, since each operator does not have global knowledge, optimizations that would be beneficial from a global perspective cannot be applied. In addition, since the query plan is static, it can be difficult to apply adaptive optimizations during query execution. As a result, there is a strong reliance on the query optimizer to create a good QEP involving complex algorithms. And finally, the iterator method delivers only one unit of data, such as logging each operator call. This approach is inefficient for operators that combine large subresult sets that themselves return small result sets.

[0023] As an example of one of these shortcomings, if the query to be executed on the database is an expression such as "A intersects (B and C)", where A returns a short list of record IDs, such as (1, 2, ... 10), but B and C return long lists, such as (1, 2, ... 10.000) and (20.000, ... 50.000), if the query optimizer does not have predictive capabilities and does not rewrite the query to (A intersects B) and (A intersects C) before it is executed, the query is very inefficient.

[0024] Therefore, it is desired to have a more time-saving method for executing a database or information retrieval system query, which includes performing operations such as intersection (AND), union (OR), and difference (AND NOT) on two or more sets of keys stored in the database or information retrieval system, or on an input set or result key set of the database or information retrieval system.

[0025] In addition, the range query performance of prior art databases decreases with the size of the index (the number of records included by the database and indexed by the index). Therefore, it is desirable to have a more time-efficient method of performing range queries that can scale well with increasing index size. Summary of the invention

[0026] One or more of these objects are achieved by the subject matter of the independent claims. Preferred embodiments are subject matter of the dependent claims.

[0027] The present invention provides indexing solutions for database applications, where B-trees and derivatives are still the main strategy, as well as indexing solutions for information retrieval applications, where inverted indexes are typically used. An inverted index is an index in which the terms list the documents that contain the index. The present invention can utilize a hierarchical trie structure to allow lazy evaluation as the trie is processed level by level. Therefore, the present invention can implement an inverted index using a trie on the first level as an associative array, where the terms are the keys stored in the trie. On the second level (i.e., as a leaf node of an associative array), the present invention can implement a list of documents (i.e., a set of IDs) using a trie as a collection. Therefore, the present invention allows a general solution to be used instead of B-trees and inverted indexes, which can therefore be called a "confluence index."

[0028] The index data structure and query processing model of the present invention are based on a bitwise trie and have the potential to replace prior art index structures: the data structure can be updated frequently, is suitable for keys with low and high cardinality, and saves space without compression / decompression (the data structure is compact or even concise in some cases). In addition, since it is based on a trie, it inherits O(|M|) constant time complexity for inserting, updating, deleting, and querying by key operations (where |M| is the key length). It is better than the usual O(logn) complexity of tree-based methods (where n is the number of keys in the index). It can then provide query time that is independent of database population. In a preferred embodiment, the results of set operators are "displayed" as tries in query processing. This allows functional composition and lazy evaluation. As a side effect, the physical algebra corresponds directly to the logical algebra, thereby simplifying the task of creating a suitable physical execution plan for a given query as typically done in a query optimizer.

[0029] A first embodiment of the present invention is a trie for an electronic database application or information retrieval system, the trie comprising one or more nodes, wherein a parent node comprised by the trie, preferably each parent node having more than one child node, comprises a bitmap and one or more pointers, wherein each pointer is associated with a bit set in the bitmap and points to a child node of the parent node. The trie is characterized in that a parent node comprised by the trie, preferably each parent node having only one child node, does not comprise a pointer to the child node, and / or the child node is stored in a predefined location in a memory relative to the parent node.

[0030] According to a second embodiment, in the first embodiment, a child node of a parent node having only one child node is stored in a location in the memory directly following the parent node.

[0031] According to a third embodiment, in the first or second embodiment, a node, preferably each child node, is associated with a key part, and a path from a root node in the trie to another node, in particular to a leaf node, defines a key, which is a cascade of the key parts associated with the nodes in the path.

[0032] Terminal Optimization

[0033] A fourth embodiment of the present invention is a trie for an electronic database application or information retrieval system, the trie comprising one or more nodes, wherein a parent node, preferably at least each parent node having more than one child node, comprised by the trie comprises a bitmap; a node, preferably each child node, is associated with a key portion; and the value of the key portion of a child node, preferably the value of the key portion of at least each child node whose parent node has more than one child node, is determined by the value of a (set) bit in the bitmap comprised by the parent node, depending on which bit the child node is associated with. The trie is characterized in that a node, preferably each node having only one child node and all its descendant nodes having at most one child node, is marked as a terminal branch node, and the value of the key portion associated with a terminal branch node, preferably each descendant node, preferably each descendant node, is not determined by the value of a (set) bit in the bitmap comprised by the parent node of the descendant node.

[0034] According to a fifth embodiment, in the fourth embodiment, the terminal branch node has more than one descendant node.

[0035] According to a sixth embodiment, in the fourth or fifth embodiment, the parent node of the terminal branch node has more than one child node.

[0036] According to the seventh embodiment, in the fourth to sixth embodiments, the flag as a terminal branch node is a bitmap with no bit set.

[0037] According to an eighth embodiment, in the seventh embodiment, the bitmap of the terminal branch node has the same length or format as a bitmap included by a parent node having more than one child node.

[0038] According to a 9th embodiment, in any one of the 4th to 8th embodiments, the terminal branch node, preferably each terminal branch node included by the trie and / or the descendant nodes of the terminal branch node, preferably each descendant node does not include a pointer to its child node, and / or the child node is stored in a predefined position in the memory relative to the parent node, preferably in a position directly behind the parent node in the memory.

[0039] According to a 10th embodiment, in any one of the 4th to 9th embodiments, the value of the key portion associated with the terminal branch node, preferably the descendant node of each terminal branch node, preferably each descendant node is included by the parent node of the descendant node.

[0040] According to the 11th embodiment, in any one of the 4th to 10th embodiments, the values ​​of the key parts associated with the terminal branch node, preferably the descendant nodes of each terminal branch node, preferably all the descendant nodes, are stored consecutively after the terminal branch node.

[0041] According to the 12th embodiment, in any one of the 4th to 11th embodiments, encoding of the value of the key portion associated with a terminal branch node, preferably a descendant node of each terminal branch node, preferably each descendant node, requires less memory space than a bitmap comprised by a parent node having more than one child node.

[0042] According to a 13th embodiment, in any one of the 4th to 12th embodiments, the value of the key part associated with the terminal branch node, preferably the descendant node of each terminal branch node, preferably each of the descendant nodes, is encoded as a binary number.

[0043] According to the 14th embodiment, in any one of the 4th to 13th embodiments, the bitmap included by the parent node, preferably each parent node having more than one child node, has 32, 64, 128 or 256 bits, and the key part associated with the terminal branch node, preferably the descendant node of each terminal branch node, preferably each of the descendant nodes is encoded by 5, 6, 7 or 8 bits respectively.

[0044] According to a 15th embodiment, in any one of the 4th to 14th embodiments, the value of the key part associated with the terminal branch node, preferably the descendant node of each of the terminal branch nodes, preferably each of the descendant nodes, is encoded as an integer value.

[0045] According to the 16th embodiment, in any one of the 4th to 14th embodiments, the descendant nodes of the terminal branch node of the parent node, preferably each descendant node of the parent node, do not include a bitmap in which the set bit determines the value of the key part associated with its child node.

[0046] According to the 17th embodiment, in any one of the 4th to 16th embodiments, the parent node included by the trie, preferably at least each parent node having more than one child node, includes one or more pointers, wherein each pointer is associated with a bit set in a bitmap included by the parent node and points to a child node of the parent node.

[0047] According to an eighteenth embodiment, in any one of the fourth to seventeenth embodiments, the trie is a trie according to any one of the first or second embodiments.

[0048] Bitmap compression

[0049] A 19th embodiment of the present invention is a trie for use in an electronic database application or information retrieval system, the trie comprising one or more nodes, wherein a node, preferably at least each parent node having more than one child node, comprises a bitmap in the form of a logical bitmap and a plurality of pointers, wherein each pointer is associated with a bit set in the logical bitmap and points to the child nodes of the node. The trie is characterized in that the logical bitmap is divided into a plurality of sections and encoded by a header bitmap and a plurality of content bitmaps; wherein each section is associated with a bit in the header bitmap; and wherein, for each section of the logical bitmap in which one or more bits are set, the bit associated with the section in the header bitmap is set and the section is stored as a content bitmap.

[0050] According to a 20th embodiment, in the 19th embodiment, for each section of the logical bitmap in which a bit is not set, the bit associated with the section in the header bitmap is not set and the section is not stored as a content bitmap.

[0051] According to a 21st embodiment, in any one of the 19th or 20th embodiments, each of the sections is contiguous.

[0052] According to a 22nd embodiment, in any one of the 19th to 21st embodiments, all the sectors have the same size.

[0053] According to a 23rd embodiment, in the 22nd embodiment, the size of the section is one byte.

[0054] According to a 24th embodiment, in any one of the 19th to 23rd embodiments, the number of extents stored as the content bitmap is equal to the number of bits set in the header bitmap.

[0055] According to a 25th embodiment, in any one of the 19th to 24th embodiments, the size of the header bitmap is one byte.

[0056] According to a 26th embodiment, in any one of the 19th to 25th embodiments, the content bitmap is stored in a predefined location in a memory relative to the header bitmap.

[0057] According to a 27th embodiment, in any one of the 19th to 26th embodiments, the content bitmap of the logical bitmap is stored in an array, a list, or in consecutive physical or virtual memory locations.

[0058] According to a 28th embodiment, in any one of the 19th to 27th embodiments, the content bitmaps are stored in the same or reverse order, wherein the set bits associated with their sections are arranged in the header bitmap.

[0059] According to the 29th embodiment, in any one of the 19th to 28th embodiments, among all the set bits in the header bitmap, the level of the content bitmap in all the content bitmaps of the logical bitmap corresponds to the level of the set bits associated with the section of the content bitmap.

[0060] According to the 30th embodiment, in any one of the 19th to 29th embodiments, the pointers included in the nodes, preferably each pointer of the nodes and / or each pointer of each node that is not a leaf node, are encoded in the encoding manner defined for the logical bitmap in any one of the 19th to 29th embodiments.

[0061] According to a 31st embodiment, in any one of the 19th to 30th embodiments, the trie is the trie in any one of the 1st to 18th embodiments.

[0062] According to the 32nd embodiment, in any one of the 19th to 31st embodiments, a node, preferably each child node, is associated with a key portion, and a path from a root node in the trie to another node, in particular to a leaf node, defines a key, which is a cascade of the key portions associated with the nodes in the path.

[0063] Keys containing control information

[0064] A 33rd embodiment of the present invention is a trie for an electronic database application or information retrieval system, the trie comprising one or more nodes, wherein a node, preferably each child node, is associated with a key portion; a path from a root node in the trie to another node, particularly to a leaf node, defines a key associated with the node, the key being a concatenation of key portions associated with nodes on the path. The trie is characterized in that the key comprises control information and content information.

[0065] According to the 34th embodiment, in the 33rd embodiment, the key includes one or more key parts including content information, and for each of the key parts, the control information includes a data type information element, which specifies the data type of the content information included by the key part.

[0066] According to a 35th embodiment, in the 34th embodiment, the key part, preferably each key part, includes a data type information element, which specifies the data type of the content information included by the key part.

[0067] According to the 36th embodiment, in the 35th embodiment, the data type information element is positioned by the content information element, preferably located before the content information element.

[0068] According to a 37th embodiment, in the 34th embodiment, the data type information elements are located together and preferably arranged in the same or opposite order as the content information elements whose data types they specify.

[0069] According to a 38th embodiment, in the 37th embodiment, the control information is located before the content information in the key.

[0070] According to a 39th embodiment, in any one of the 34th to 38th embodiments, the key includes two or more key parts including content information of different data types.

[0071] According to a 40th embodiment, in any one of the 34th to 39th embodiments, at least one of the data types is a fixed-size data type.

[0072] According to a 41st embodiment, in the 40th embodiment, the fixed-size data type is an integer, a long integer, or a double-precision floating point or a time / date primitive.

[0073] According to a 42nd embodiment, in any one of the 34th to 41st embodiments, at least one of the data types is a variable-size data type.

[0074] According to the 43rd embodiment, in the 42nd embodiment, the variable-size data type is a string, preferably a Unicode string, or a variable-precision integer.

[0075] According to a 44th embodiment, in any one of the 34th to 43rd embodiments, the information of the key portion is contained in two or more key parts.

[0076] According to the 45th embodiment, in any one of the 34th to 44th embodiments, the data type of the content information included by the key part is a variable-size data type, and the end of the content information element is marked by a specific bit or a specific symbol in a specific one of the key parts containing the key part.

[0077] According to a 46th embodiment, in any one of the 34th to 45th embodiments, the control information includes information identifying the last key portion.

[0078] According to a 47th embodiment, in any one of the 33rd to 46th embodiments, the control information includes information on whether the trie is used to store a dynamic set or an associative array.

[0079] According to a 48th embodiment, in any one of the 33rd to 47th embodiments, the trie is a trie according to any one of the 1st to 32nd embodiments.

[0080] According to the 49th embodiment, in any one of the 33rd to 48th embodiments, a node, preferably at least each parent node having more than one child node, includes a bitmap and multiple pointers, wherein each pointer is associated with a bit set in the bitmap and points to a child node of the node.

[0081] Interleaved multi-key

[0082] The 50th embodiment of the present invention is a trie for an electronic database application or information retrieval system, the trie comprising one or more nodes, wherein a node, preferably each child node, is associated with a key portion; a path from a root node in the trie to another node, particularly to a leaf node, defines a key associated with the node, the key being a concatenation of the key portions associated with the nodes on the path. The trie is characterized in that two or more data items are encoded in a key, at least one or two, preferably each of the data items consisting of two or more components; and the key contains two or more consecutive sections, at least one or two, preferably each of the sections comprising two or more components of the data items encoded in the key.

[0083] According to a 51st embodiment, in the 50th embodiment, each of the regions, preferably the regions, of the key contains at least one component and / or at most one component from each of the data items encoded in the key.

[0084] According to a 52nd embodiment, in any one of the 50th or 51st embodiments, for two or more sections, preferably all sections, of a key, components belonging to different data items are ordered in the same sequence within the sections.

[0085] According to a 53rd embodiment, in any one of the 50th to 52nd embodiments, the order of the sections comprising the components of the data item corresponds to the order of the components within the data item.

[0086] According to a 54th embodiment, in any one of the 50th to 53rd embodiments, the key portion associated with the child node, preferably each of the child nodes, corresponds to a portion of the component of the data item.

[0087] According to the 55th embodiment, in any one of the 50th to 53rd embodiments, the key portion associated with the child node, preferably each of the child nodes, corresponds to a component of the data item, and / or the component of the data item, preferably each data item, preferably each component corresponds to the key portion associated with a child node of the trie.

[0088] According to a 56th embodiment, in any one of the 50th to 53rd embodiments, the key portion associated with a child node, preferably each of the child nodes, corresponds to more than one component of the data item.

[0089] According to a 57th embodiment, in any one of the 50th to 56th embodiments, two or more, preferably all, data items of the key have the same number of components.

[0090] The type of data item and its weight

[0091] According to a 58th embodiment, in any one of the 50th to 57th embodiments, the two or more data items represent geographical location data.

[0092] According to a 59th embodiment, in any one of the 50th to 58th embodiments, the data item represents longitude, latitude or index, or a character string or a combination of two or more of these.

[0093] According to a 60th embodiment, in any one of the 50th to 59th embodiments, the components of the data item are binary-encoded bit groups of the data item.

[0094] According to a 61st embodiment, in the 60th embodiment, the bit group includes 6 bits.

[0095] According to a 62nd embodiment, in any one of the 50th to 61st embodiments, the data item is a number.

[0096] According to a 63rd embodiment, in the 62nd embodiment, the data item is an integer, a long integer, or a double long integer.

[0097] According to a 64th embodiment, in any one of the 62nd or 63rd embodiments, the data item is a 64-bit integer.

[0098] According to a 65th embodiment, in any one of the 62nd to 64th embodiments, the components of the data item are digits.

[0099] According to a 66th embodiment, in the 65th embodiment, the digits have a predefined base, preferably 64.

[0100] According to a 67th embodiment, in any one of the 50th to 66th embodiments, the data item is a character string.

[0101] According to a 68th embodiment, in the 67th embodiment, the component of the data item is a single character.

[0102] According to a 69th embodiment, in any one of the 50th to 68th embodiments, the data item is a byte array.

[0103] According to a 70th embodiment, in any one of the 50th to 69th embodiments, the trie is a trie according to any one of the 1st to 49th embodiments.

[0104] According to the 71st embodiment, in the 70th embodiment, when subordinate to the 34th embodiment, the data item corresponds to the key part or the content information included by the key part.

[0105] According to the 72nd embodiment, in any one of the 33rd to 71st embodiments, a node, preferably at least each parent node having more than one child node, includes a bitmap and multiple pointers, wherein each pointer is associated with a bit set in the bitmap and points to a child node of the node.

[0106] General trie features

[0107] Bitmap and memory details

[0108] According to a 73rd embodiment, in any one of the 1st to 32nd, or 49th or 72nd embodiments, the bitmap is stored in a memory as an integer of a predefined size.

[0109] According to the 74th embodiment, in any one of the 1st to 32nd, or 49th or 72nd or 73rd embodiments, the size of the bitmap is 32, 64, 128 or 256 bits.

[0110] According to the 75th embodiment, in any one of the 1st to 32nd, or the 49th or the 72nd to 74th embodiments, the trie is suitable for storage and processing on a target computer system, and the size of the bitmap is equal to the bit width of a register, a system bus, a data bus and / or an address bus of a CPU of the target computer system.

[0111] According to the 76th embodiment, in any one of the 1st to 32nd, or 49th or 72nd to 75th embodiments, the bitmap and / or pointers and / or nodes of the trie are stored in an array, preferably in a long integer array or a byte array, in a list or in consecutive physical or virtual memory locations.

[0112] According to the 77th embodiment, in any one of the 1st to 16th, or 26th to 27th or 76th embodiments, the memory is or includes a physical memory or a virtual memory, preferably a continuous memory.

[0113] pointer

[0114] According to the 78th embodiment, in any one of the 1st to 32nd, or 49th or 72nd to 77th embodiments, the number of pointers included by a parent node, preferably at least each parent node having more than one child node, is equal to the number of bits set in the bitmap included by the parent node.

[0115] According to the 79th embodiment, in any one of the 1st to 32nd, or the 49th or the 72nd to 78th embodiments, the rank of the pointer among all the pointers of the parent node corresponds to the rank of the pointer's associated set bit among all the set bits in the bitmap of the parent node.

[0116] According to an 80th embodiment, in any one of the 1st to 32nd, or 49th, or 72nd to 79th embodiments, the pointers are stored in the same or opposite order as the bits set in the bitmap.

[0117] According to the 81st embodiment, in any one of the 1st to 33rd, or 49th, or 72nd to 80th embodiments, the pointer included by the parent node points to the bitmap included by the child node.

[0118] According to an 82nd embodiment, in any one of the 1st to 33rd, or 49th, or 72nd to 81st embodiments, the number of pointers included by the leaf node, preferably each leaf node of the trie, is zero.

[0119] Key part

[0120] According to the 83rd embodiment, in any one of the 3rd or 33rd to 82nd embodiments, the value of the key portion of a child node, preferably the value of the key portion of at least each child node whose parent node has more than one child node, is determined by the value of a (set) bit in a bitmap included in the parent node, depending on which bit the child node is associated with.

[0121] According to the 84th embodiment, in any one of the 4th to 18th embodiments or the 83rd embodiment, the maximum number of different values ​​that can be used for the key portion is defined by the size of the bitmap.

[0122] According to an 85th embodiment, in any one of the 4th to 18th, or 83rd or 84th embodiments, the size of the bitmap defines the possible alphabets for the key portion.

[0123] According to the 86th embodiment, in any one of the 3rd or 32nd to 85th embodiments, each key part in the trie is capable of storing values ​​of the same predefined size.

[0124] According to the 87th embodiment, in the 86th embodiment, the predefined size corresponds to a 5-bit, 6-bit, 7-bit or 8-bit value.

[0125] Key encodings for valid range queries

[0126] According to the 88th embodiment, in any one of the aforementioned embodiments, the encoding of the value of the data item, preferably the encoding of the value of all data items, is obtained by converting the data type of the data item into an offset binary representation containing an unsigned integer.

[0127] According to a 89th embodiment, in the 88th embodiment, the integer is a long integer.

[0128] According to a 90th embodiment, in any one of the 88th or 89th embodiments, if the data type of the data item is a floating point number, the encoding is obtained by converting the data type of the data item into an offset binary representation.

[0129] According to a 91st embodiment, in any one of the 88th to 90th embodiments, if the data type of the data item is a two's complement signed integer, the encoding is obtained by converting the data type of the data item into an offset binary representation.

[0130] other

[0131] According to the 92nd embodiment, in any one of the preceding embodiments, the trie stores a dynamic set or an associative array.

[0132] Boolean operations on trie

[0133] The 93rd embodiment of the present invention is a method for retrieving data from an electronic database or information retrieval system, comprising the following steps: obtaining two or more input tries, each input trie storing a key set stored in the electronic database or information retrieval system or a result key set of the electronic database or information retrieval system; combining the input tries using logical operations to obtain key sets associated with nodes of the result trie; and providing key sets and / or other data items (e.g., document identifiers) associated with the nodes of the result trie, or a subset of keys and / or data items associated with the nodes of the result trie, in particular keys and / or other data items associated with leaf nodes of the result trie, or key sets or value sets derived from keys associated with nodes of the result trie as output; wherein,

[0134] - a trie comprises one or more nodes, each child node being associated with a key portion, and a path from a root node in the trie to another node defines a key associated with the node, the key being a concatenation of the key portions associated with the nodes on the path;

[0135] - if the logical operation is different, the parent node of the result trie is the parent node of the first input trie, and the leaf nodes of the parent node of the result trie are the combination of the set of child nodes of the corresponding parent node in the first input trie using the logical operation and the set of child nodes of any corresponding parent node in the other input trie, and

[0136] - if the logical operation does not differ, the set of child nodes of each node in the result trie is a combination of the set of child nodes of the corresponding node in the input trie using the logical operation; and

[0137] - Two or more nodes of different tries correspond to each other if the keys associated with the nodes of different tries are the same.

[0138] According to a 94th embodiment, in the 93rd embodiment, the key set provided as output is provided in a trie.

[0139] According to the 95th embodiment, in the 93rd embodiment, the key set provided as output is provided by a cursor or an iterator.

[0140] Merge Steps

[0141] According to a 96th embodiment, in any one of the 93rd to 95th embodiments, the step of combining the input trie includes: performing a combination function on the root node of the result trie; wherein performing the combination function on the input node of the result trie includes:

[0142] - determining a set of child nodes of an input node of the result trie by combining the sets of child nodes of the nodes of the input trie corresponding to the input nodes of the result trie using the logical operation; and

[0143] - performing the combining function on each of the child nodes determined for the input node of the result trie.

[0144] According to a 97th embodiment, in any one of the 93rd to 96th embodiments, the step of combining the input trie is performed using depth-first traversal, breadth-first traversal, or a combination thereof.

[0145] According to the 98th embodiment, in the 97th embodiment, the step of performing the combination of the input trie in depth-first traversal includes: executing the combination function on one of the child nodes of the input node, and traversing the sub-trie formed by the child node before executing the combination function on the next sibling node of the child node.

[0146] According to the 99th embodiment, in any one of the 97th or 98th embodiments, the step of performing a combination of the input trie in a breadth-first traversal includes: executing the combination function on each of the child nodes determined for the input node of the result trie, and determining the child node set of each of the child nodes determined for the input node of the result trie before executing the combination function on any grandchild node of the input node of the result trie.

[0147] Bitmap

[0148] According to a 100th embodiment, in any one of the 93rd to 99th embodiments, the nodes in the input trie, preferably at least all parent nodes in the input trie, include a bitmap.

[0149] According to the 101st embodiment, in the 100th embodiment, the value of the key portion of a child node in the trie is determined by the value of a (set) bit in a bitmap included by the parent node of the child node, depending on which bit the child node is associated with.

[0150] According to a 102nd embodiment, in any one of the 100th or 101st embodiments, the combining of the child nodes of the input trie using the logical operation includes combining the bitmap of each of the child nodes of the input trie using the logical operation.

[0151] According to a 103rd embodiment, in the 102nd embodiment, combining the bitmaps includes obtaining a combined bitmap, and performing a step of determining a result of the combination based on the combined bitmap.

[0152] Logical Operations

[0153] According to a 104th embodiment, in any one of the 93rd to 103rd embodiments, the logical operation is intersection, union, difference, or XOR.

[0154] According to a 105th embodiment, in the 104th embodiment, using the logical operation includes combining using an AND Boolean operator, an OR Boolean operator, or an XOR Boolean operator.

[0155] According to the 106th embodiment, in any one of the 100th to 103rd embodiments and the 105th embodiment, using the logical operation includes using a bitwise AND Boolean operator, a bitwise OR Boolean operator, a bitwise AND NOT Boolean operator, or a bitwise XOR Boolean operator to combine the bitmaps of the nodes.

[0156] Combination of Boolean trie operations

[0157] According to a 107th embodiment, in any one of the 93rd to 106th embodiments, one or more of the input tries are outputs of a method for performing a database query as described herein using the same or different logical operations.

[0158] Virtual trie

[0159] According to a 108th embodiment, in any one of the 93rd to 106th embodiments, one or more input tries are virtual tries that are dynamically generated during an operation of combining the input tries.

[0160] According to a 109th embodiment, in the 108th embodiment, at least, and preferably at most, those parts of the virtual trie are dynamically generated which are necessary to combine the input tries using the logical operation.

[0161] Range Query

[0162] The 110th embodiment of the present invention is a method for retrieving data from an electronic database or information retrieval system by performing a range query on a key set stored in the electronic database or information retrieval system or a result key set of an electronic database or information system query, the method comprising the following steps: obtaining the definition of one or more ranges; and executing the method of the electronic database or information retrieval system described in any one of the 93rd to 109th embodiments, wherein one input trie is an input set trie, which stores the key set or result key set to be searched for the one or more ranges; the other input trie is a range trie, which stores all values ​​included in the one or more ranges for which the definition has been obtained; and the logical operation is an intersection.

[0163] According to the 111th embodiment, in the 110th embodiment, a range is a set of discrete ordered values, including all values ​​between a first value and a second value of a data type.

[0164] According to a 112th embodiment, in the 111th embodiment, the range includes the first value and / or the second value.

[0165] According to a 113th embodiment, in any one of the 110th to 112th embodiments, the range trie is a virtual trie as defined in any one of the 108th or 109th embodiments.

[0166] Single-input set trie

[0167] According to a 114th embodiment, in any one of the 110th to 112th embodiments, a key associated with a leaf node of the input set trie encodes a data item of a specific data type.

[0168] According to the 115th embodiment, in the 114th embodiment, the definition of the one or more ranges includes the definition of one or more ranges for the one data item.

[0169] Multiple Input Set Trie

[0170] According to a 116th embodiment, in any one of embodiments 110 to 113, a key associated with a leaf node of the input set trie encodes two or more data items of a specific data type.

[0171] According to the 117th embodiment, in the 116th embodiment, the definition of the one or more ranges includes the definition of one or more ranges for one or more of the data items.

[0172] Get multi-item range trie from single-item range trie

[0173] According to the 118th embodiment, in the 116th or 117th embodiment, the range trie is a multi-item range trie, which is obtained by combining a single-item range trie for each data item in the data items encoded by a key associated with a leaf node of the input set trie, wherein the single-item range trie for a data item stores all values ​​included in one or more ranges of the data item.

[0174] According to a 119th embodiment, in the 118th embodiment, the combining of the single-item range trie is performed within a function that implements combining of the input set trie with the multi-item range trie.

[0175] According to the 120th embodiment, in the 118th embodiment, the combination of the single-item range trie is performed by a function that provides the multi-item range trie as an input to a function that implements the combination of the input set trie and the multi-item range trie.

[0176] According to a 121st embodiment, in any one of the 118th to 120th embodiments, the single-entry range trie is a virtual range trie as defined in any one of the 108th to 109th embodiments.

[0177] According to the 122nd embodiment, in any one of the 118th to 121st embodiments, the single-item range trie for each data item that does not obtain a range definition stores the entire range of possible values ​​of the data item.

[0178] According to a 123rd embodiment, in any one of the 118th to 122nd embodiments, the multi-item range trie stores all combinations of values ​​of the data items stored in the single-item range trie.

[0179] Structure of a range trie

[0180] According to the 124th embodiment, in any one of the 109th to 123rd embodiments, the range trie has the same structure or format as the input set trie.

[0181] According to the 125th embodiment, in the 124th embodiment, the keys associated with the leaf nodes of the range trie encode data items of the same data type as the keys associated with the leaf nodes of the input set trie.

[0182] According to the 126th embodiment, in any one of the 124th or 125th embodiments, in the range trie, a data item of a certain data type or a component of such a data item is encoded in a node at the same level as the corresponding data item or the component of the data item in the input set trie.

[0183] Output of range query

[0184] According to a 127th embodiment, in any one of the 109th to 126th embodiments, the method provides as output a set of keys and / or other data items associated with a leaf node of the input set trie.

[0185] According to a 128th embodiment, in any one of the 116th to 126th embodiments, the method provides as output a reduced item key set that encodes a subset of the data items encoded by the keys associated with the leaf nodes of the input set trie.

[0186] According to the 129th embodiment, in the 128th embodiment, before providing the output, the simplified item key sets obtained from different branches of the input set trie related to the data items not encoded in the simplified item keys as a result of combining the input set trie with the range trie are merged.

[0187] According to the 130th embodiment, in any one of the 128th or 129th embodiments, before providing the output, the reduced item key set obtained as a result of the operation of combining the input set trie with the range trie is written to a newly created trie, thereby eliminating duplicate keys.

[0188] Fuzzy Search

[0189] The 131st embodiment of the present invention is a method for retrieving data from an electronic database or information retrieval system by performing approximate string matching, the method comprising the following steps: obtaining a search string; constructing a matching trie that stores a set of approximate strings, the set of approximate strings including the search string and / or variations of the search string; using an intersection operation to combine the matching trie with a storage trie to obtain a result trie, the storage trie storing a set of strings stored in the electronic database or information retrieval system; providing strings and / or other data items associated with a result set of nodes of the result trie as output; wherein the trie comprises one or more nodes, each child node is associated with a key portion, and a path from a root node in the trie to another node defines a key associated with the node, the key being a cascade of key portions associated with the nodes on the path.

[0190] According to the 132nd embodiment, in the 131st embodiment, one or more child nodes in the matching trie have more than one parent node.

[0191] According to a 133rd embodiment, in any one of the 131st or 132nd embodiments, one or more child nodes in the matching trie have more than one parent node.

[0192] According to the 134th embodiment, in any one of the 131st to 133rd embodiments, the child node set of each node in the result trie is the intersection of the child node sets of corresponding nodes in the matching trie and in the storage trie, wherein if the same key is associated with nodes of different tries, the nodes of the different tries correspond to each other.

[0193] According to a 135th embodiment, in any one of the 131st to 134th embodiments, the matching trie is a virtual trie that is dynamically generated during the intersection of the matching trie and the storage trie.

[0194] According to the 136th embodiment, in the aforementioned embodiment, at least and preferably at most those parts of the virtual trie necessary for the intersection of the matching trie and the storage trie are dynamically generated.

[0195] According to the 137th embodiment, in any one of the 131st to 136th embodiments, the data item provided in the output represents a data unit, which contains a string associated with a node of the result set of nodes of the result trie, preferably a document identifier.

[0196] According to the 138th embodiment, in any one of the 131st to 137th embodiments, the storage trie is an index trie or a physical index trie, and the strings included in the documents and the corresponding document identifiers are preferably stored as, for example, two key parts (string, long).

[0197] According to the 139th embodiment, in any one of the 131st to 138th embodiments, the matching trie includes a set of matching nodes, each matching node is associated with one or more keys corresponding to one of the strings from the approximate string set, and the result set of nodes is a set of nodes of a result trie corresponding to the set of matching nodes in the matching trie, wherein if the key associated with the node of the result trie is the same as the key associated with the node of the matching trie, then the node of the result trie corresponds to the node of the matching trie.

[0198] According to the 140th embodiment, in any one of the 131st to 139th embodiments, the method further includes the step of obtaining a number N, wherein the variants of the search string include a set of strings that can be obtained by inserting, deleting and / or replacing at most N single characters of the search string.

[0199] According to the 141st embodiment, in any one of the 131st to 140th embodiments, the step of establishing the matching trie includes: establishing a finite automaton representing the set of approximate strings; and deriving the matching trie from the finite automaton.

[0200] According to the 142nd embodiment, in the aforementioned embodiment, the transition between two states of the finite automaton, preferably each transition, is associated with a specific character, preferably a character included by the search string, or a wildcard or an empty string.

[0201] According to the 143rd embodiment, in any one of the 141st or 142nd embodiments, the step of establishing the finite automaton includes: establishing a non-deterministic finite automaton representing the set of approximate strings; and deriving a deterministic finite automaton from the non-deterministic finite automaton; and wherein the matching trie is derived from the deterministic finite automaton.

[0202] According to the 144th embodiment, in the aforementioned embodiment, a transition between two states of the deterministic finite automaton, preferably each transition, is associated with a specific character, preferably a character included by the search string or a wildcard.

[0203] According to the 145th embodiment, in any one of the 131st to 144th embodiments, the nodes in the matching trie and the storage trie, preferably at least all parent nodes, include a bitmap, and the value of the key part of the child node in the trie is determined by the value of the (set) bit in the bitmap included by the parent node of the child node, depending on which bit the child node is associated with.

[0204] According to the 146th embodiment, the aforementioned embodiment, the nodes in the matching trie and the storage trie, preferably at least all parent nodes include a bitmap, and the value of the key part of the child node in the trie is determined by the value of the bit (set) in the bitmap included in the parent node of the child node, and the child node is associated with the bit.

[0205] According to the 147th embodiment, in any one of the 145th or 146th embodiments, the step of deriving the matching trie from the finite automaton includes: obtaining an enhanced finite automaton by associating transitions between two states of the finite automaton, preferably each transition via an encoding of a specific character or wildcard associated with the transition, wherein the encoding is composed of or represented by one or more bitmaps whose length and / or format is equal to the bitmap included by the parent node of the matching trie, and wherein the matching trie is derived from the enhanced finite automaton.

[0206] According to the 148th embodiment, in the aforementioned embodiment, for the encoding of a specific character, exactly one bit is set in each of the bitmaps included or represented by the encoding.

[0207] According to the 149th embodiment, in any of the 147th or 148th embodiments, for the encoding of the wildcard, the bits of all valid character encodings are set in the bitmap included or represented by the encoding, or the bits of all valid character encodings except the encoding of the specific character associated with the state left by the transition.

[0208] According to the 150th embodiment, in any one of the 145th to 149th embodiments, the characters stored in the matching trie, the storage trie or the result trie are encoded by the key parts of the corresponding trie with a number M>1, preferably 5>M.

[0209] According to the 151st embodiment, in the aforementioned embodiment, the step of deriving the matching trie from the finite automaton includes: replacing the transition between two states of the finite automaton, preferably each transition, by using one or more sequences of M-1 levels of intermediate states and M transitions linking the two states via M-1 intermediate states, or by associating the transition between two states of the finite automaton, preferably each transition, with one or more sequences of M-1 levels of intermediate states and M transitions linking the two states via M-1 intermediate states to obtain a complete finite automaton representing the set of approximate strings, wherein each of the M transitions in the sequence is associated with an intermediate code, the intermediate code being composed of or represented by a bitmap whose length and / or format is equal to the bitmap included by the parent node of the matching trie, and wherein the matching trie is derived from a complete finite automaton.

[0210] According to the 152nd embodiment, in the 151st embodiment, if the transition between two states of the finite automaton is associated with a specific character, then the cascade of bitmaps included or represented by the intermediate codes associated with the M transitions of the sequence is the encoding of the specific character, and exactly one bit is set in each of the bitmaps.

[0211] According to the 153rd embodiment, in any one of the 151st or 152nd embodiments, if the transition between two states of the finite automaton is associated with a wildcard, the cascade of the bitmaps included or represented by the intermediate codes associated with the M transitions of the sequence includes: the following codes, in which the bits of all valid character codes are set in the bitmap included or represented by the codes, or the bits of all valid character codes except the code of a specific character associated with the state left by the transition, and / or one or more encodings, including one or more parts of the code of a specific character and one or more parts of the following codes, in which the bits of all valid character codes are set in the bitmap included or represented by the codes, or the bits of all valid character codes except the code of a specific character associated with the state left by the transition.

[0212] According to the 154th embodiment, in any one of the embodiments 147 to 149, or in any one of the embodiments 151 to 153, the enhanced finite automaton or the complete finite automaton is represented by or stored in a data structure comprising a plurality of rows, each row representing a state of the enhanced finite automaton or the complete finite automaton, and comprising a tuple for each of the transitions leaving the state, each tuple comprising a code associated with the transition and a reference to the state at which the transition ends.

[0213] According to the 155th embodiment, in the aforementioned embodiment, for each state where the conversion ends, the data structure includes information about whether the state is a matching state, preferably encoded as a bit in each reference to the state.

[0214] According to the 156th embodiment, in any one of the 154th or 155th embodiments, the data structure includes a row for each of the states of the augmented finite automaton or the complete finite automaton from which the transition leaves.

[0215] Data Structure

[0216] According to a 157th embodiment, in any one of the 93rd to 130th embodiments, the trie is a trie according to any one of the 1st to 92nd embodiments.

[0217] Different categories of inventions

[0218] The 158th embodiment of the present invention is a computer-implemented method of using a trie as described in any one of the 1st to 92nd embodiments in an electronic database application or information retrieval system, particularly for storing keys or keys and values, for storing result keys or query keys and values, or for storing input keys or query keys and values.

[0219] The 159th embodiment of the present invention is a computer-implemented method for generating a trie of any one of the 1st to 92nd embodiments.

[0220] The 160th embodiment of the present invention is a non-transitory computer-readable medium on which the trie of any one of the 1st to 92nd embodiments is stored.

[0221] The 161st embodiment of the present invention is an electronic data stream that represents a trie of any one of the 1st to 92nd embodiments.

[0222] The 162nd embodiment of the present invention is an electronic database or information retrieval system, which stores keys or keys and values, result keys or query keys and values, or input keys or query keys and values ​​by means of a trie of any one of the 1st to 92nd embodiments.

[0223] The 163rd embodiment of the present invention is a computer program, in particular a database application, an information retrieval system program, comprising instructions for executing the method of any one of the 93rd to 162nd embodiments.

[0224] The 164th embodiment of the present invention is a data processing device or system, including one or more processors and a memory, and the data processing device or system is configured to execute the method of any one of the 93rd to 163rd embodiments.

[0225] The 165th embodiment of the present invention is a preferably non-transitory computer-readable medium on which the computer program of the 164th embodiment is stored. BRIEF DESCRIPTION OF THE DRAWINGS

[0226] Hereinafter, the present invention will be described in more detail in combination with preferred embodiments and with reference to the accompanying drawings, in which

[0227] Figure 1 An example of a trie data structure used in a prior art database is shown;

[0228] Figure 2 Another example of a trie data structure used in the prior art is shown;

[0229] Figure 3 Shows Figure 2 Prior art implementations of a trie data structure;

[0230] Figure 4 Shows Figure 2 Another prior art implementation of a trie data structure;

[0231] Figure 5 Shows Figure 2 Another prior art implementation of a trie data structure;

[0232] Figure 6 It shows how to determine the child pointer of a node in a prior art trie;

[0233] 7A to 7C shows how leaf nodes are stored in a map and the "last" bitmap is stored in a set in a trie according to the present invention;

[0234] Figure 8 An example of a trie is provided in which the first space optimization according to the present invention is effective;

[0235] Fig. 9 A first spatial optimization according to the present invention is shown;

[0236] Fig.10 An example of a trie is provided in which the second space optimization according to the present invention is effective;

[0237] Fig.11 A general storage configuration according to a second space optimization of the present invention is shown;

[0238] Fig.12 A second spatial optimization according to the present invention is shown;

[0239] Fig.13It shows how to access the nodes of a trie which is space-optimized according to the present invention in a unified manner;

[0240] FIG. 14A to FIG. 14C Insertion of a key into a trie optimized for space according to the present invention is shown;

[0241] Fig.15 shows the results of an experiment conducted to measure the efficiency of a first spatial optimization and a second spatial optimization according to the present invention;

[0242] Fig.16 A third spatial optimization according to the present invention is shown;

[0243] Fig.17 shows the results of an experiment conducted to measure the efficiency of the third space optimization according to the present invention;

[0244] Fig.18 shows a first way of arranging control and content information in keys to be stored in a trie according to the present invention;

[0245] Fig.19 shows a second way of arranging control and content information in keys to be stored in a trie according to the present invention;

[0246] Fig. 20 An example of key encoding according to the present invention is shown;

[0247] Fig.21 shows a trie storing keys encoded according to the present invention;

[0248] Fig. 22 An example of a two-dimensional key with values ​​(X=12, Y=45) is shown;

[0249] Fig.23 It is given how to convert Fig.21 An example of keys being stored in a trie is shown in;

[0250] Fig.24 The stages of database query processing in the prior art are shown;

[0251] Fig.25 An exemplary query execution plan used in a prior art database is shown;

[0252] Fig.26 Operator control and data flow according to a query execution model in a prior art database are shown;

[0253] Fig. 27 shows tuple-at-a-time processing of a query execution model for a database according to the prior art;

[0254] Fig.28 An operator-at-a-time process of a query execution model according to a prior art database is shown;

[0255] Fig.29 The trie control and data flow of the query execution model according to the present invention are shown;

[0256] Fig.30 An example of applying an intersection operator on two tries according to the present invention is shown;

[0257] Fig.31 Two example tries are shown on which the intersection operation according to the present invention will be performed;

[0258] Fig.32 The results of the Fig.31 The bitwise AND operation is performed on the bitmaps of the two example tries;

[0259] Fig.33 Shown in Fig.31 Branch skipping during the intersection operation of two tries;

[0260] Fig.34 Shown in Fig.31 The result trie of the intersection operation on the two tries;

[0261] Fig.35 An example of applying a union operator on two tries according to the present invention is shown;

[0262] Fig.36 Shows Fig.35 The result trie of the union operation on the two tries;

[0263] Fig.37 An example of applying a difference operator to two tries according to the present invention is shown;

[0264] Fig.38 The interaction of the intersection operator, input set trie and range trie in range query according to the present invention is shown;

[0265] Fig.39 An example of a method for performing a range query according to the present invention is shown;

[0266] Fig.40 An example of a method for performing a two-dimensional range query according to the present invention is shown;

[0267] Fig.41 shows how to combine in an interleaved manner Fig.40 One-dimensional range trie of;

[0268] Fig.42 It shows that due to Fig.41 The obtained interleaved range trie;

[0269] Fig.43 shows how to combine in a non-interleaved manner Fig.40 One-dimensional range trie of;

[0270] Fig.44 It shows that due to Fig.43 The obtained non-interleaved range trie;

[0271] Fig.45 shows that if the input set trie is stored in a non-interleaved manner, then during a range query Fig.40 Which nodes of the input set trie?

[0272] Fig.46 shows that if the input set trie is stored in an interleaved manner, then during a range query Fig.40 Which nodes of the input set trie?

[0273] Fig.47 A two-dimensional range query with a one-dimensional output according to the present invention is shown;

[0274] Fig.48 shows that the set of x-value keys obtained by combining the input set trie with the two-dimensional range trie through an intersection operation is written to a newly created one-dimensional trie whose nodes are associated with keys having only x-values;

[0275] Fig.48A A non-deterministic finite automaton is shown to match the search string "abc" with a maximum edit distance of 2;

[0276] Fig.48B shows a deterministic finite automaton for matching "abc" when the edit distance is 1;

[0277] Fig.48C Shows Fig.48B Enhancement of the automaton conversion, which uses the reference Fig.21 Describes the encoding scheme for Unicode characters and Unicode strings;

[0278] Fig.48D The resulting top of the matching trie is shown, where each 10-bit Unicode character is represented by two key parts;

[0279] Fig.48E shows a data structure as an array of arrays, which can be used to represent the state of a complete finite automaton, from which one can derive Fig.48D The matching trie of

[0280] Fig.49 shows the specification of an experimental geographic data search query for all locations within a small rectangle in the Munich area;

[0281] Fig.50 The remaining records loaded into the database to perform a first series of experimental geographic data search queries are shown;

[0282] Fig.51 The remaining records loaded into the database to perform a second series of experimental geographic data search queries are shown;

[0283] Fig.52 A provisional result set and a final result set determined by an experimental geographic data search query are shown;

[0284] Fig.53 Performance measurements of prior art methods are shown;

[0285] Fig.54 shows an abstract view of a non-interleaved two-dimensional index trie used in a standard indexing method according to the present invention;

[0286] Fig.55 shows the use of multiple OR operators in the standard indexing method according to the present invention;

[0287] Fig.56 An overview of the components used in the standard indexing method according to the present invention is provided;

[0288] Fig.57 shows the performance measurement results of the standard indexing method according to the present invention;

[0289] Fig.58 An example of a first level index for a variable precision indexing method according to the present invention is shown;

[0290] Fig.59 An example of a second level index for a variable precision indexing method according to the present invention is shown;

[0291] Fig.60 shows the performance measurement results of the variable precision index according to the present invention;

[0292] Fig.61 shows how portions of a binomial key stored in an interleaved manner according to the present invention can be combined with each other or with portions of a range trie in a two-dimensional indexing method;

[0293] Fig.62 The performance measurement results of the two-dimensional indexing method according to the present invention are shown;

[0294] Fig.63 The structure of the index storing three item keys according to the indexing method for single indexing of the present invention is shown;

[0295] Fig.64 An overview of components used in a single-index indexing method according to the present invention is provided;

[0296] Fig.65 The performance measurement results of the indexing method of a single index according to the present invention are shown;

[0297] Fig.66 shows experimental results in which query performance was measured with increasing result size;

[0298] Fig.67 In the figure with logarithmic x-axis, Fig.66 Result;

[0299] Fig.68 shows experimental results in which indexing performance was measured at increasing index sizes;

[0300] Fig.69 The space requirements for different indexing methods are shown;

[0301] Figures 70A-70F The indexing performance, index size and query performance of a database using a prior art index are compared with a database using an index according to the present invention in an information retrieval application. DETAILED DESCRIPTION

[0302] Detailed description of the preferred embodiment of the present invention

[0303] Figure 1 An example of a trie data structure used in a database according to the prior art is shown. It shows a trie data structure 101 in which each child node (i.e., all nodes except the root node) is associated with a key portion, the value of which is indicated by a pointer from a parent node and selected from the alphabet {0...9}, i.e., nodes at each level except the root node are associated with a decimal digit. The path from the root node to another node in the trie defines the key associated with the node, which is a concatenation of the key portions associated with the nodes on the path. The trie 101 "stores" keys with values ​​"007" and "042" because the leaf node 107 of the trie 101 is associated with a key with value "007", and the leaf node 108 of the trie 101 is associated with a key with value "042".

[0304] The root node 102 located on the first level 110 has one child node 104 associated with a key portion of value "0". Therefore, there is a pointer 103 from the root node 102 to the child node 104 located on the second level 111 of the trie 101, which indicates a value of "0". From the child node 104 on the second level, two different pointers point to nodes 105, 106 located on the third level 112, and from each of these nodes 105, 106, one further pointer points to a leaf node 107, 108, respectively. Therefore, the concatenation of the key portions of the nodes on the path from the root node to the leaf nodes results in keys of values ​​"007" and "042".

[0305] Figure 2 Another example of a trie data structure used in the prior art is shown. The trie data structure of this example is similar to Figure 1 The trie data structure is similar, but has a larger alphabet of possible values ​​for the key parts associated with the nodes. In particular, Figure 2 A 256-ary trie data structure is shown, where the representation of the key portion value has a size of 8 bits (or 1 byte).

[0306] Figure 2 The trie data structure stores two different keys (having two different keys associated with its leaf nodes) "0000FD" and "002A02", and has four levels 210 to 214. The root node 202 located on the first level 210 has a pointer to a child node 204 associated with the key part value "00". The child node 204 includes two pointers to child nodes 205, 206, which are associated with the key part values ​​"00" and "2A", respectively. Each of the child nodes 205, 206 located in the third level 212 includes a pointer to a leaf node 207, 208, respectively. The leaf nodes 207, 208 are located in the fourth level 213. The leaf node 207 is associated with the key part value "FD", and the leaf node 208 is associated with the key part value "02".

[0307] Figure 3 Shows Figure 2 Prior art implementation of a trie data structure. Nodes with associated pointers are completely allocated in memory. Therefore, in this case, even a null (nil) pointer will take up memory space. For example, the root node 302 has 256 pointers allocated in its array 306, of which only one pointer 303 is not null, which is associated with the key part value "00" and points to a child node 304. The child nodes are implemented in the same way.

[0308] Figure 4 Depicted Figure 2An exemplary embodiment of a trie data structure of the invention provides a known solution for using memory space more efficiently and avoiding storing null pointers. The solution includes storing only a list of non-null pointers and their corresponding key part values, rather than an array containing all possible pointers. For example, a root node 402 having a child node associated with a key part value "00" includes a list with one entry. The list entry includes a key part value 403 and an associated pointer 404 pointing to a child node 405. Other child nodes are implemented accordingly.

[0309] Figure 5 Shows Figure 2 Another exemplary embodiment of a trie data structure of the invention provides a known solution to the allocation problem based on a bitmap for marking all non-null pointers of a parent node. In other words, a set bit in the bitmap marks a valid (non-null) branch. Each parent node also includes one or more pointers, each of which is associated with a set bit in the bitmap and points to a child node of the parent node.

[0310] In order to determine the pointer of a child node, the number of previous child pointers must be counted. Figure 6 As shown in , the offset used to find the pointer is the number of least significant bits set in the bitmap before the target location. This compact trie node structure eliminates the need to store nil pointers and allows very fast access at the same time.

[0311] Figure 5 The alphabet base of the trie data structure of the example is 256, which results in a bitmap size of 256 bits. In other words, each bitmap can identify 256 pointers for 256 different key part values ​​(or child nodes). With 256 different values, 8 bits (2 8 ) or 1 byte.

[0312] Root node 502 has one bit set in its bitmap, indicating the key portion value "00". Therefore, root node 502 only includes one pointer 503 pointing to child node 504, which is associated with the key portion with value "00". Child node 504 has two bits 505, 507 set in its bitmap, namely the bits indicating the key portion values ​​"2A" and "00". Therefore, child node 504 includes two pointers 507 and 508, which point to corresponding child nodes 509, 510.

[0313] The pointer 506 associated with the bit with a value of "2A" in the bitmap is addressed by counting how many least significant bits are set starting from bit 505 representing the key portion value "2A". In this case, there is only one least significant bit set, namely bit 506, so it can be determined that there is an offset of one pointer, and the pointer we are looking for is the second pointer included by child node 504.

[0314] General features of preferred embodiments of a trie according to the invention

[0315] Similar to all tries, a trie or trie data structure according to the present invention comprises one or more nodes. Figures 1 to 6 In the prior art trie described, preferably each child node of the trie of the preferred embodiment is associated with a key portion, wherein the path from the root node in the trie to another node, particularly to a leaf node, defines a key, which is a cascade of the key portions associated with the nodes in the path. The root node is not associated with a key portion, and it will be understood that the trie may include additional nodes that are not associated with a key portion, for example, because they are used for other purposes. For example, the number of entries in a subtree may be stored in such a node to avoid or speed up a counting operation, which would normally require traversing the entire tree.

[0316] In a preferred embodiment of a trie according to the invention, a node, preferably at least each parent node having more than one child node, comprises a bitmap and a plurality of pointers. Each pointer is associated with a bit set in the bitmap and points to a child node of the node. Typically, a bit is "set" in the bitmap if the value of the bit is "1". However, in a particular embodiment, a bit may be considered "set" if the value of the bit is "0". A bit in the bitmap is considered "set" here if the value of the bit corresponds to a value associated with the concept that the bit in the bitmap marks a valid branch, as described above with reference to Figure 5 As explained in the prior art trie shown in FIG.

[0317] Preferably, the bitmap is stored in the memory as an integer of a predefined size. In addition, the size of the bitmap is preferably 32, 64, 128 or 256 bits. The performance of the target computer system's operation of storing and processing the trie can be improved by selecting the size of the bitmap so that it is equal to the bit width of the CPU's register, system bus, data bus and / or address bus of the target computer system.

[0318] For example, as mentioned above, the memory address of a pointer associated with a bit set in a bitmap can be calculated based on the number of least significant bits set in the bitmap. This determination can be made very efficiently using simple bit manipulation and a CTPOP (count-to-fill) operation that determines the number of set bits. Many modern CPUs even provide CTPOP as an internal instruction. However, since long integers are 64 bits wide in modern CPUs, CTPOP only works on 64 bits. This means that for a prior art trie using a 256-bit bitmap, this operation is performed at most four times (4 x 64 = 256). Alternatively, the prior art trie combines the total bit count of the previous bitmap with the previous three bits. Figure 1 The number of least significant bits can then be calculated as the CTPOP of the last bit group + the bit count of the previous bit group.

[0319] Since the system bit width is 64 bits in most computer systems today, a bitmap size of 64 bits is currently the most preferred size and is used by the inventor for example embodiments of his invention. This results in a 64-ary trie, which means that each node can store a symbol of an alphabet of 64 symbols, that is, it can encode 6 bits (2 6 =64). As will be explained below, a trie according to an embodiment of the present invention can use several nodes and their associated key parts to store information included by primitive data types. For example, to store a key represented by a 64-bit long integer, a 64-ary trie with 11 levels is required (11*6 bits>=64).

[0320] The bitmap and / or pointer can be stored in, for example, an array, in a list, or in a continuous physical or virtual memory location. Note that whenever the term "memory" is used in this article, it can refer to physical or virtual memory, preferably continuous memory. In a preferred embodiment, a long integer (64 bits) is used to represent the bitmap, and is also used to represent each of the child pointers. Instead of allocating nodes separately in memory, the nodes are stored in an array of long integers, and instead of having a memory pointer for the node, the current node is assigned to the array by an index. The child pointer can be an index of a node position in an array. When traversing the trie, the offset for finding the index of the child node based on the current node index is the number of least significant bits set in the bitmap before the target position for the bitmap plus 1.

[0321] The preferred embodiment applies to several such arrays. One part of the pointer, e.g. the lower part, is an index into the array, while another part of the pointer, e.g. the upper part, is a reference to the array. This is done for memory management reasons, since it is not always possible to allocate an array of arbitrarily large size. For example, in Java, the size of an array is limited to a 32-bit integer, and this results in an array size of 2. 31 (positive values ​​only) = 2,147,483,648. However, many real applications need to contain arrays of 16MB or more, which corresponds to 2 million entries for an array of 64-bit long integers.

[0322] Similar to Figure 5 and Figure 6 In a prior art trie of , a parent node, preferably at least each parent node having more than one child node, typically includes a number of pointers equal to the number of bits set in the bitmap included by the parent node. For example, Figure 5The node 504 in has a bitmap with two bits 505, 506 set, and includes two pointers 507, 508. The rank of a pointer among all pointers of the parent node preferably corresponds to the rank of the associated set bit of the pointer among all set bits in the bitmap of the parent node. Figure 5 In the parent node 504 of , the first pointer 507 corresponds to the first set bit 505 of the bitmap, and the second pointer 508 corresponds to the second set bit 506. The pointers are typically stored in the same or opposite order as the bits set in the bitmap. Each of them preferably points to (the address of) the bitmap included by the child node, as shown in the following example: Fig. 9 and Fig.12 As shown in, for example, the starting address of this bitmap.

[0323] Similar to Figure 5 or Figure 6 In a prior art trie of the preferred embodiment, the value of the key part of a child node of the trie of the preferred embodiment, preferably the value of the key part of at least each child node whose parent node has more than one child node, is determined by the value of a (set) bit in a bitmap comprised by the parent node, depending on which bit the child node is associated with. Thus, the maximum number of different values ​​that can be used for the key part is typically defined by the size of the bitmap, and / or the size of the bitmap defines the possible alphabets for the key part.

[0324] In a preferred embodiment of the present invention, each key portion in the trie is capable of storing values ​​of the same predefined size, such as 5-bit values ​​(if the size of the bitmap is 32 bits), 6-bit values ​​(if the size of the bitmap is 64 bits), 7-bit values ​​(if the size of the bitmap is 128 bits), or 8-bit values ​​(if the size of the bitmap is 256 bits). The alphabet of characters represented by a node or key portion is the set of all possible bit groups of that size. For example, where the key portion is capable of storing 6-bit values, the alphabet is the set of all bit groups that include 6 bits.

[0325] The trie data structure according to the present invention can be used to implement: key-value mappings (also known as "associative arrays"), where values ​​are stored in leaf nodes; and key sets (also known as "dynamic sets"), where no data is stored in leaf nodes. In the case where there is only one value per key, mappings are used to find the value of a given key, while sets are used to determine whether a given set contains a given key. For both cases, set operations on keys (such as union, intersection, or difference) are also frequently required operations.

[0326] 7A to 7C It is shown how to store leaf nodes in a map and the "last" bitmap in a set in a compact way and so that all values ​​can be accessed in constant time. Fig. 7A1 shows how to store leaf nodes for key-value mappings with large and / or variable-sized value data types (such as long strings or text). Fig. 7A As shown in , the value is stored separately. If the size of the value is large compared to the size of the pointer, the space required for the additional pointer idx pointing to the value can be ignored.

[0327] In cases where the value data type is of fixed size (such as a date or integer), it is more efficient to store the value "inline", e.g. Figure 7B , for example, directly after the bitmap of its parent node. For example, according to a preferred embodiment of the present invention with inlining, a long to long mapping, i.e., a mapping in which the key is a long integer type and the value is also a long integer type, can be efficiently implemented by a trie data structure. Inlining only works for data types with fixed-size values, because in this case, the position can be calculated, for example, as CTPOP(bitmap & (bitpos-1))*size. In contrast, for data types with variable-size values, the position must be determined through all value entries.

[0328] Figure 7C shows how the inline storing the "last" bitmap can be used for collections. Since there is no value, the last bitmap itself is inlined without the need for a pointer. Note that in the terminology used herein, these "last" bitmaps on the physical level are part of the parent node of the leaf node, but the bits set in these bitmaps indicate the value of the key portion of the leaf node on the logical level.

[0329] The trie data structure stores the keys in an ordered manner and thus allows for in-order traversal of the keys. For example, a 64-bit long integer key can be stored starting from the most significant 6 bits (or 4 bits, since 64=4+10*6) to the least significant 6 bits. In this way, the integers will be treated as unsigned long integers. For signed integers, which are typically encoded using two's complement, to have the correct order, they must be converted to an offset binary representation, for example by adding 2 to the 64-bit long integer. 64-1 Floating point numbers are handled in a similar manner. Thus, encoding the value of a data item for a key (such as a floating point number or a two's complement signed integer) may include converting the data type of the data item to an offset binary representation containing an unsigned integer (e.g., an unsigned long integer).

[0330] Space-efficient trie data structure

[0331] In many application scenarios, memory space is used inefficiently. This is especially true when the trie is sparsely populated and / or degenerates into a chain of nodes, where each node has only a single child pointer.

[0332] Chain node optimization

[0333] The inventors found in empirical studies that for any key, many trie nodes in typical application scenarios have only a single child node. This is because many keys share a common prefix, infix or suffix. In this case, the trie of the prior art degenerates into a node chain with a single child pointer, and the space efficiency of the trie data structure of the prior art is low.

[0334] The first space optimization of the present invention eliminates child pointers when a node has only a single child, ie, only a single bit is set in the bitmap included by the parent node. This approach is referred to herein as "chained node optimization." Figure 8 An example of a trie with efficient chain node optimization is shown in FIG. Leaf nodes 841, 842, 843 on level 4 of the trie share a common prefix, which includes: root node 800 on level 0; node 810 on level 1, which is the only child node of root node 800; node 820 on level 2, which is the only child node of node 810; and node 830 on level 3, which is the only child node of node 280.

[0335] The first space optimization of the present invention is applied to a trie comprising one or more nodes, wherein a parent node comprised by the trie, preferably each parent node having more than one child node, comprises a bitmap and one or more pointers, wherein each pointer is associated with a bit set in the bitmap and points to the child nodes of the parent node. The optimization is achieved by the fact that a parent node comprised by the trie, preferably each parent node having only one child node, does not include a pointer to the child node, and / or stores the child node in a predefined position in memory relative to the parent node. Preferably, the child nodes of a parent node having only one child node are stored in a position in memory directly behind the parent node.

[0336] exist Fig. 9 , which shows a portion of trie 910 before the chain node optimization, and a portion of trie 920 corresponding to trie 910 after the chain node optimization is applied. In the preferred embodiment as described above, the nodes in trie 910, trie 920 are stored in a long integer array, which is indicated by the expression "long[]" on the left side of the illustration of the portion of trie 910, trie 920.

[0337] The trie 910 includes a first node 911 that has only a single child node, as indicated by the (64-bit wide) bitmap of node 911, in which only one bit is set (1), and all other bits are not set (0). Similar to in the prior art trie, node 911 thus includes a single pointer 914, which is a long integer, pointing to the child node of node 911 (node ​​912). Node 912 has two children nodes, Fig. 9 1, as indicated by the two bits set in the (64-bit wide) bitmap of node 912 and the two pointers 915, 916 included by node 912. As indicated by the three dots ("...") between node 911 and node 912, node 912 will typically not be stored in a memory location directly following node 911, but may be stored anywhere in the long integer array.

[0338] Trie 920 also includes a first node 921 having only a single child node, as indicated by the (64-bit wide) bitmap of node 921, in which only one bit is set (1) and all other bits are not set (0). However, in contrast to node 911 in trie 910, node 921 in trie 920 does not include a pointer to a child node (node ​​922) of node 921. Instead, node 922 is stored in a memory location directly following node 921, as is preferably the case, but alternatively, may be stored at any location in the long integer array as long as the location in memory relative to parent node 921 is predefined. For example, child node 922 may be stored directly in front of parent node 921, or there may be another data object of a fixed length between parent node 921 and child node 922. Similar to node 912 of trie 910, node 912 of trie 920 has two child nodes, one at the Fig. 9 Not shown in the figure, its location in the memory (in the long integer array) is indicated by two pointers 925 and 926 included in the node 922.

[0339] exist Fig. 9 In the example embodiment, each of the bitmaps and pointers included in the node is represented by a long integer, that is, by a data type of the same data type or the same length. The chain node optimization according to the present invention reduces the memory space required to store a node and a single child node by 50%.

[0340] Terminal Optimization

[0341] A second space optimization of the present invention provides a more compact representation of a trie in memory, where the "end" of the trie comprises a chain or string of a single node, ie, many keys having no common suffix. Fig.10An example of a second space-efficient trie is shown in FIG. Fig.10 Each of the leaf nodes 1041, 1042, 1043, 1044, 1045 of the trie in is part of an independent (non-public) suffix. Each suffix includes one node 1021, 1022, 1023, 1024, 1025 on level 3 of the trie, one node 1031, 1032, 1033, 1034, 1035 on level 4 of the trie, and one leaf node on level 5. Each of the nodes 1021, 1022, 1023, 1024, 1025 on level 2 and the nodes 1031, 1032, 1033, 1034, 1035 on level 4 has only a single child node.

[0342] According to the second space optimization, the node at the beginning of the string of single nodes is marked as a "terminal branch node". Fig.10 In the example, the terminal branch nodes are nodes 1021, 1022, 1023, 1024, 1025 on level 3 of the trie. The values ​​of the key parts of the remaining nodes in the string are stored continuously only in their "local" or literal encoding, rather than being determined by the value of the bit (set) in the bitmap included by their parent node. This method is referred to as "terminal optimization" in this article.

[0343] Therefore, the second space optimization of the present invention is applicable to a trie comprising one or more nodes, wherein a parent node comprised by the trie, preferably at least each parent node having more than one child node, comprises a bitmap; a node, preferably each child node, is associated with a key part; and the value of the key part of a child node (preferably at least each child node whose parent node has more than one child node) is determined by the value of a bit (set) in the bitmap comprised by the parent node, depending on which bit the child node is associated with.

[0344] In Dr. Bagwell's "Fast And Space Efficient Trie Searches", Technical Report, EPFL, Switzerland (2000), where nodes are allocated independently in memory, a method called "tail-of-the-tree compression" uses pointers to string nodes for reference, or stores the numeric value of the terminal string directly in the terminal branch node. However, this method does not save space because the offset and node type (node ​​with bitmap or node with character / pointer list) must be stored in the node.

[0345] The terminal optimization according to the present invention overcomes this problem by marking nodes with a bitmap with no bits set, preferably each node in the trie that has only one child node and all its descendant nodes have at most one child node as a terminal branch node. The present invention uses the special quality of the bitmaps included by the standard nodes of the preferred embodiment, namely that they always have at least one bit set. This is because a node with an all-zero bitmap will be a node with no children, but nodes with no children do not need to be represented in memory. Therefore, special meaning can be attributed to the bitmap with no bits set, and the length or format of the bitmap of the terminal branch node can be the same as the length or format of the bitmap included by the parent node with more than one child node.

[0346] The value of the key portion associated with the descendant node (preferably each descendant node) of the terminal branch node (preferably each terminal branch node) is not determined by the value of the bit in the bitmap (set) included by the parent node of the descendant node. On the contrary, the value of the key portion is encoded so that it represents that less memory space is required than the bitmap included by the parent node with more than one child node. Typically, the value of the key portion will be encoded as a binary number (digit), such as an integer value. For example, in the case where the bitmap included by the standard node has 32 bits, 64 bits, 128 bits or 256 bits respectively, the key portion associated with the descendant node of the terminal branch node is encoded by 5 bits, 6 bits, 7 bits or 8 bits respectively.

[0347] Fig.11 A general storage configuration for terminal optimization according to a preferred embodiment of the present invention is shown in FIG. A 64-bit wide bitmap in which no bits are set is followed by multiple (usually at least two) 6-bit key parts encoded as binary numbers. However, in a preferred embodiment, each 6-bit key part is stored in an 8-bit block (one byte). Since only 6 of the available 8 bits are used, this wastes some space, but converting from 6 of 8 bits to 8 of 8 bits encoding and back increases the complexity of the implementation and reduces performance. Measurements made by the inventors show that wasting space is acceptable, and improving space by storing 8 of 8 bits is very limited.

[0348] The terminal branch node and / or its descendant nodes need not include a pointer to one of its child nodes (if any), since the child nodes can be stored in memory at a predefined location relative to the parent node, preferably directly after the parent node, such as Fig.12 In addition, the values ​​of the key parts associated with the descendant nodes (preferably all descendant nodes) of the terminal branch node (preferably each terminal branch node) are stored consecutively after the terminal branch node. Finally, as can be seen in Fig.12As observed in , in a string of individual nodes, only for terminal branch nodes it must have a bitmap in order to mark that node as a terminal branch node, while the descendant nodes without a terminal branch node need to include a bitmap, specifically a bitmap in which the set bits determine the value of the key portion associated with its child nodes.

[0349] As from Fig. 14C As will become apparent from the examples shown in and discussed below, terminal optimization according to the most preferred embodiment is more space efficient than chain node optimization only in the case where the terminal branch node has more than one descendant node. Furthermore, the greatest space savings can be achieved if the first node in a chain of single nodes has been marked as a terminal branch node, such that the parent node of the terminal branch node has more than one child node.

[0350] exist Fig.12 , which shows a portion of trie 1210 before terminal optimization and a portion of trie 1220 corresponding to trie 1210 after applying terminal optimization. The nodes of trie 1210, 1220 are again stored in a long integer array.

[0351] Trie 1210 includes a first node 1211, which has only a single child node, as indicated by the bitmap of node 1111, in which only one bit is set (1) and all other bits are not set (0). The value of the one bit that is set is "60", as can be seen from the fact that it is the fourth bit from the left in the 64-bit wide bitmap, in which the rightmost bit has a value of "0" and the leftmost bit has a value of "63". Node 1211 includes a single pointer 1213, which is a long integer, pointing to the child node of node 1211 (node ​​1212). As indicated by the three dots ("...") between node 1211 and node 1212, node 1112 will typically not be stored in a memory location directly after node 1111, but can be stored anywhere in the long integer array. Node 1212 also has one child node, as indicated by the second bit from the right set in the 64-bit wide bitmap of node 1212, which has a value of "01". However, since the child nodes of node 1212 are leaf nodes, node 1212 does not include a pointer to its child nodes, but rather a pointer to leaf node portion 1214, which may be a pointer or a value of a mapping (see Fig. 7A and Figure 7B ), or an empty collection (see Figure 7C ). Leaf nodes are not represented in memory. Note that no specific "leaf node indicator" is needed because in the preferred embodiment, the depth of the trie or the length of the keys stored in the trie is known.

[0352] As can be observed, node 1211 is a terminal branch node since it has only one child node 1212 and all of its descendant nodes (1212 and 1212's children) have at most one child node (node ​​1212 has one child node and 1212's children have zero children nodes). As a result of the application of terminal optimization, trie 1220 is obtained from trie 1210. Node 1221 of trie 1220 corresponding to node 1211 of trie 1210 has been marked as a terminal branch node by providing it with a 64-bit wide bitmap with no set bits. The value of the key portion associated with its child node 1222 (corresponding to child node 1212 of trie 1211) is not determined by the value of the (set) bit in the bitmap of node 1221. The value of the key portion is encoded as a binary number, such as an integer, comprised by node 1221. Fig.12 The number "60" in the key portion indicates that such a representation of the value of the key portion requires only 6 bits (64 = 2 6 ), and therefore takes up much less memory space than a 64-bit wide bitmap included in a parent node with more than one child node. For example, the value 60 can be encoded as the binary number "111100".

[0353] Terminal branch node 1221 does not include a pointer to its child node 1222. Instead, child node 1222 is stored in a predefined location in memory relative to its parent node 1221, i.e., directly after the parent node. Node 1222, which is a descendant node of terminal branch node 1221, does not include a bitmap, nor a pointer to its child nodes, but only includes a binary number encoding the value of the key portion associated with the child node of node 1222, as shown in Fig.12 1. For example, the value 01 can be encoded as the binary number "000001". The representation of node 1222 is followed by a leaf node portion 1224 in memory. Similarly, leaf node portion 1224 can be a pointer or value of a mapping (see Fig. 7A and Figure 7B ), or an empty collection (see Figure 7C ).

[0354] exist Fig.12 In an example embodiment of , in which each of the bitmaps and pointers included in the nodes are represented by a long integer, the terminal optimized trie 1220 requires 64+6+6=76 bits for storing nodes 1221 and 1222. In contrast, the unoptimized trie 1210 requires 64+64+64=192 bits to store the same information (nodes 1211 and 1212, not counting the leaf node portion 1214 present in both trie 1210 and trie 1220).

[0355] Similar to the preferred embodiment, where a long integer array is used to store a trie, the terminal optimization according to the present invention suffers from alignment loss. In the worst case, a 6-bit key portion is stored in a 64-bit long integer. However, experiments show that, on average, 50% of the space used to store the descendant nodes of the terminal branch node is occupied. In addition, terminal optimization still requires less space than using pointers or using chain node optimization to store several single child nodes.

[0356] Now refer to Fig.13 Overview Methods for accessing standard nodes, nodes optimized by chain node optimization, and nodes optimized by terminal optimization in a unified manner. The main methods of node access used in the query execution model in the example implementation are: getBitSet(), which returns a bitmap with bits set for all non-null child pointers of a trie node; and getChildNode(bitNum), which returns the child nodes of a given node branch specified by the number of bits. Both methods are provided by the interface CDBINode, where CDBI stands for "Confluent Database Index". Another interface, CDBINodeMem, provides object-oriented access to the data model through the CDBINode interface.

[0357] The difficulty that must be overcome is how to handle these three cases in a unified central location, rather than having to handle them separately in many places in the code. According to the solution discovered by the inventors, and as Fig.13 As shown in , nodes are referenced not only via node pointers (indexes), but also via base node indexes ("nodeRef") and indexes within nodes ("idxInNode"), chains without pointers and terminals are considered as one node, whose base node index points to the terminal node or the beginning of the chain. In this way, memory space optimization does not add significant complexity to the "get" operation and therefore does not degrade performance.

[0358] Since nodeRef always points to the first bitmap, it is used to detect three cases in the implementation of getBitSet() and getChildNode(bitNum):

[0359] - If the bitmap has more than one bit set, it belongs to a regular node. getBitSet() returns the bitmap; getChildNode(bitNum) determines idx (a pointer to the child node) and returns a new CDBINodeMem with nodeRef set to it (and idxInNode set to 0).

[0360] - If the bitmap is 0 (no bit set), it belongs to a terminal branch node. getBitSet() converts the 6-bit value literally stored at the position of idxInNode to a bitmap and returns it; getChildNode(bitNum) returns a new CDBINodeMem with the same nodeRef and idxInNode+1.

[0361] - If the bitmap has one bit set, it belongs to a chained node. getBitSet() returns the bitmap at position idxInNode; getChildNode(bitNum) again returns a new CDBINodeMem with the same nodeRef and idxInNode+1. CDBINodeMem can also be used in lightweight mode by not creating a new, time-consuming child node, but just updating nodeRef and idxInNode (gotoChildNode method), i.e. by modifying an existing object that acts as a proxy.

[0362] FIG. 14A to FIG. 14C The trie growth is shown for inserting two keys into an empty trie, the first key having a key part value of [00, 02, 02] and the second key having a key part value of [00, 03, 00, 01]. Fig.14A An empty trie is shown, represented by a root index pointer having a value of 0. Fig. 14B The trie is shown after adding the first key with the key part value [00, 02, 02]. Since there is no previous entry, the first key is stored using the terminal optimization. Fig. 14C The trie is shown after adding a second key with key part values ​​of [00, 03, 00, 01]. The existing terminal nodes have been split. Since the matching prefix ("00") has only one child, it is stored as a chain node, followed by a regular node with two children ("02" and "03"). The remainder of the first key ("02") is stored as a node with a leaf node part (storing it with terminal optimization would require more space). The remainder of the second key ("00" and "01") is stored again using terminal optimization.

[0363] In order to measure the space requirements of data structures according to various embodiments of the present invention, experiments were performed in which a random set of long integers with the complete long integer value range was stored. Fig.15 The measurement results are shown, where the x-axis indicates the number of entries loaded into the trie index in a logarithmic scale and the y-axis indicates the number of bytes required to store one entry on average.

[0364] It can be observed that the chain node optimization alone reduces the space requirements by about 40%, and the terminal optimization alone reduces it by about 60-75%. The combined chain node and terminal optimization does not provide a visible space improvement compared to the terminal optimization alone (the figure overlaps with the terminal optimization case). However, empirical measurements made by the inventors show that these two optimizations are still worth applying together. When chain node optimization is applied in addition to terminal optimization, performance is improved, and data locality is better, and the memory hierarchy (CPU cache) is respected, because fewer pointers must be followed.

[0365] Bitmap compression

[0366] The third space optimization of the present invention provides a more compact representation of a trie in the memory of a sparsely populated trie. By grouping and efficiently storing regions of the same value (e.g., regions of value 0 in the case of sparsely populated nodes or regions of value 1 in the case of densely populated nodes), the memory space of a bitmap (e.g., a bitmap indicating the key portion values ​​of child nodes) can be reduced. This third space optimization is referred to herein as "bitmap compression."

[0367] The third spatial optimization of the present invention is applied to a trie comprising one or more nodes, wherein the node, preferably at least each parent node having more than one child node, comprises a bitmap in the form of a logical bitmap and a plurality of pointers, wherein each pointer is associated with a bit set in the logical bitmap and points to the child nodes of the node. As mentioned with respect to other aspects of the present invention, the logical bitmap may correspond to a bitmap comprising key portion values. The optimization is achieved by the fact that the logical bitmap is divided into a plurality of sections and encoded by a header bitmap and a plurality of content bitmaps, wherein each section is associated with a bit in the header bitmap, and wherein for each section of the logical bitmap, wherein one or more bits are set, a bit associated with the section in the header bitmap is set, and the section is stored as a content bitmap.

[0368] Using a header bitmap and multiple content bitmaps to store the logical bitmap can significantly reduce the required storage space by omitting the content bitmap for sections of the logical bitmap that have no set bits. In other words, only content bitmaps that have at least one set bit (i.e., sections of the logical bitmap) are stored in memory. In the worst case, where each section of the logical bitmap has at least one set bit, memory usage is slightly increased due to the need to store an additional header bitmap. However, nodes are typically sparsely populated, and therefore less memory is typically required when bitmap compression is used.

[0369] exist Fig.16, which shows in the upper part a section of a trie 1601, whose parent node comprises a logical bitmap 1602 without bitmap compression. In its lower part, a section of a trie 1611 is shown, whose parent node is obtained after bitmap compression has been applied to the parent node of the trie 1601. The parent node of the trie 1611 comprises a header bitmap 1612 and two content bitmaps 1613, 1614 resulting from the bitmap compression.

[0370] The parent nodes in trie 1601, 1611 also include pointers 1603 to 1605. In trie 1601, each pointer is associated with bits 1606 to 1608 set in logic bitmap 1602. In trie 1611, pointers 1603 to 1605 are associated with bits 1616 to 1618 set in content bitmap.

[0371] The logical bitmap in trie 1601 is converted into a header bitmap 1612 and content bitmaps 1613, 1614 in the lower portion 1611 by dividing the logical bitmap 1602 into sections 1621 (e.g., 8 bits) and storing sections 1622, 1623 with at least one bit set as content bitmaps 1613, 1614. Sections without set bits are not stored as content bitmaps. Each bit in the header bitmap 1612 represents a different section of the logical bitmap. The content bitmaps 1613, 1614 are referenced by corresponding bits 1619, 1620 set in the header bitmap 1612. The content bitmaps 1613, 1614 can be stored in the same order (not shown) or in reverse order, where the set bits 1619, 1620 associated with their sections are arranged in the header bitmap 1612. In other words, the level of the content bitmap in all content bitmaps of the logical bitmap can correspond to the level of the set bit associated with the section of the content bitmap among all the set bits in the header bitmap. In this way, the content bitmap can be easily addressed when processing the trie. Likewise, the sections of the logical bitmap are preferably all coherent in memory. Therefore, the entire logical bitmap can be represented coherently in memory by the header bitmap followed by multiple content bitmaps.

[0372] In a preferred embodiment, all sections have the same size. Sections of the same size allow efficient processing of the logical bitmap for compression and decompression, since no further information about the structure of the section is required. Likewise, the size of the header bitmap may be the same as the size of the section.

[0373] Different structures for storing header bitmaps and content bitmaps can be used. The header bitmap and content bitmap of a logical bitmap can be stored in an array, a list, or in consecutive physical or virtual memory locations. When the size of the header bitmap and content bitmap is one byte, such as Fig.16 As shown in , the bitmap can be stored in a byte array rather than in an array of long integers, such as in trie 1601 or Fig. 9 and Figures 12 to 14C This reduces alignment loss. The content bitmap is preferably stored in a predefined location in memory relative to the header bitmap. Storing the content bitmap and the header bitmap close to each other can improve processing efficiency. Fig.16 In , the content bitmap is stored directly after the header bitmap in memory.

[0374] The bitmap compression described above can also be applied to pointers, such as pointers used to reference child nodes, and can also be applied to inline leaf node bitmaps. This will typically further improve space efficiency, but will hurt performance because variable-size encoding makes it necessary to traverse the pointers when calculating the offset of a particular pointer.

[0375] Bitmap compression can be combined with other aspects of the invention. For example, combined with pointer reduction, terminal branch nodes according to the invention marked by a (logical) bitmap without setting a set bit can be encoded as a header bitmap only without any content bitmap.

[0376] Fig.17 The above reference Fig.15 However, in addition to the chain node and terminal optimizations, bitmap compression was also applied. Fig.15 It can be observed from the comparison that the space saving achieved by bitmap compression is about 40% when neither chain node nor terminal optimization is applied, about 50-70% when only chain node optimization is applied, and about 30-60% when only terminal optimization or both chain node and terminal optimization are applied.

[0377] Key Encoding

[0378] The present invention provides a way to store different primitive data types for keys with fixed or variable size keys (e.g., strings), as well as composite keys comprising two or more items of primitive data types in a trie.

[0379] Keys containing control information

[0380] In a preferred embodiment of the invention, keys may be encoded in a flexible manner so that iteration may be performed, for example via a cursor, even without prior knowledge of the number, data type or length of components stored in the key.

[0381] These embodiments apply to a trie used in a database application or an information retrieval system, for example a trie or a trie data structure according to one of the embodiments of the trie and trie data structure as described above. A trie comprises one or more nodes, wherein a node, preferably each child node, is associated with a key part, and a path from a root node in the trie to another node, in particular to a leaf node, defines a key associated with the node, wherein the key is a concatenation of the key parts associated with the nodes on the path. The flexibility mentioned above is achieved by the fact that, in addition to content information, the key also includes control information.

[0382] The key will typically include one or more key parts, each of which includes content information that is a portion of the total content information included by the key. For each of the key parts, the control information preferably includes a data type information element that specifies the data type of the content information included by the key part.

[0383] In principle, there are two ways to arrange the control information and content information associated with the key part. The first way is to Fig.18 , wherein the key portion or preferably each key portion 10, 20, 30 comprises a data type information element ( Fig.18 The data type information element specifies the data type of the content information element. This means that the control information and the content information are distributed across different key parts 10, 20, 30. In this case, the data type information element of the key or each data type information element is typically positioned by a content information element associated with the data type information element in the key, preferably (directly) preceding the data type information element. The data type information element is therefore similar to a prefix or header element of a key part 10, 20, 30.

[0384] Fig.19 A second way of arranging the control information and content information associated with a key portion is shown in FIG. Fig.19 The control information such as the data type information element is preferably located before the content information in the key as a prefix or header element of the key. Studies conducted by the inventors have shown that the second method of storing data type information elements is desirable because keys with the same data type have the same prefix (starting node in the trie) and thus reduce the number of nodes required in the trie, resulting in space savings.

[0385] The data type of the content information associated with a key part may be of fixed size, such as in the case of an integer, long integer, or double precision floating point or time / date primitives, or it may be of variable size, such as in the case of a string, e.g. a Unicode string or a variable precision integer. In some embodiments of the invention, a key comprises two or more key parts, which comprise content information of different (primitive) data types.

[0386] As will be referenced below Fig. 20 and Fig.21 As explained, the control information may include information identifying the last key (e.g., by the state of a high bit of a data type information element). Alternatively, key counts may be stored separately. Furthermore, the control information may include information about whether the trie is used to store a dynamic set or an associative array.

[0387] The content information of a key portion may be contained by a single key part, but typically it is contained by two or more key parts. For a fixed-size key portion, the number of key parts required to contain the content information included by the key portion is typically known. In the case where the data type of the content information included by the key portion is a variable-size data type, the end of the content information element may be marked by a specific symbol, such as a null-terminated string, the last character of the string being a null character ('\0', called NUL in ASCII). Alternatively and preferably, it may be marked by a specific bit in a specific one of the key parts that contain the key portion, as will be described below with reference to Fig.21 Unicode strings are interpreted as such.

[0388] Although as mentioned above, the content information of key portion will be comprised by two or more key portions usually, the key portion preferably does not comprise the content information of two or more key portions.In other words, the content information of key portion is aligned with the boundary of key portion.Similarly, the key portion preferably does not comprise the information of two or more control information elements, such as data type information element, key portion count or whether trie is used to store dynamic set or associative array.This method makes implementation easier and more effective, and there is no significant alignment loss usually.In addition, as will be explained below, it allows to store the content information of different key portions in an interlaced manner.

[0389] exist Fig. 20An example of key encoding according to the present invention is shown in . The key to be stored in the trie includes control information 2010 and content information 2020. The key includes several key parts containing content information, and for each of the key parts, the control information 2010 includes data type information elements 2012, 2013 that specify the data type of the content information included by the key part. In addition, the control information 2010 includes information 2011 about whether the trie is used to store dynamic sets or associative arrays. If a trie is used to store an associative array, the leaf node of the trie associated with the key will typically include a leaf node value 2030 or a pointer to the leaf node value.

[0390] As mentioned above, in a preferred embodiment of the present invention, each parent node in the trie includes a 64-bit wide bitmap, and therefore each key portion in the trie is capable of storing a 6-bit value. Information 2011 about whether the trie is used to store a dynamic set or an associative array is stored by the first key portion, and therefore 6 bits are used for this information. In practice, 1 bit is sufficient for this yes / no information, but for the alignment reasons mentioned above, the entire key portion capable of storing a 6-bit value is used. This information is encoded in node 2041, including a 64-bit wide bitmap (where the corresponding bits are set) and a pointer (idx) to the corresponding child node of node 2041.

[0391] Each of the data type information elements 2012, 2013 is also stored by a key part, whose value is encoded in the bitmap of the node 2042, 2043. 5 bits are used for the data type information, which allows 32 different type identifiers. The sixth bit (e.g., the high bit of the key part) that can be stored by the corresponding key part is used to indicate whether the key part associated with the data type information element is the last key part in the key. Fig. 20 In the example of , the high bit of the data type information element 2013 is set to indicate that the key part associated with the data type information element 2013 is the last key part in the key.

[0392] The content information included in each of the key parts is also decomposed into a 6-bit value 2021, 2022, and each of the values ​​is stored in a key part. Fig. 20 Nodes whose bitmaps are used to encode (6-bit) values ​​2021, 2022 are shown. For example, where the key portion comprises a 32-bit integer value, this 32-bit value is stored by six key parts, the first key part storing a 2-bit value, and the last five key parts each storing a 6-bit value (32=2+6+6+6+6+6).

[0393] Fig.21A trie storing keys encoded according to the present invention is shown. Each parent node of the trie includes a 64-bit wide bitmap. The key includes a first key portion and a second key portion, the first key portion including a 32-bit integer with a value of "100", and the second key portion including a string with a value of "ab". The control information of the key includes (1) a dynamic set identifier, (2) an integer identifier, and (3) a string type identifier with a tag of the last type. The content information of the key includes (1) a 32-bit integer value "100" and (2) a string value "ab" encoded in Unicode.

[0394] The dynamic set identifier is a 6-digit number with a value of 0 (0x00). Fig.21 The bitmap of the root node 2100 of the trie has a bit with a value of "0" set, and the second-level node associated with the bit is associated with a key portion with a value of "0". The integer identifier is a 6-bit number with a value of 5 (0x05). Therefore, the bitmap of the second-level node has a bit with a value of "5" set, and the third-level node associated with the bit is associated with a key portion with a value of "5". The string type identifier with a mark for the last key portion is a 6-bit number with a value of 39 (0x27). Therefore, the bitmap of the third level has a bit with a value of "39" set, and the fourth-level node associated with the bit is associated with a key portion with a value of "39".

[0395] The integer value "100" is encoded in 32-bit binary as "00 000000 000000 000000 000001100100". Therefore, the key portions associated with the nodes at levels 5 through 10 for storing the integer value "100" are associated with the values ​​0 (0x00), 0 (0x00), 0 (0x00), 0 (0x00), 1 (0x01), and 36 (0x24), respectively.

[0396] The string value "ab" is encoded as the Unicode value of the character "a", followed by the Unicode value of the character "b". Each Unicode character is stored using 2-4 key parts, depending on the Unicode value, which may require 10, 15 or 21 bits. The encoding scheme for Unicode characters used in the preferred embodiment of the present invention is as follows:

[0397] 10-bit Unicode character: 00xxxx xxxxxx

[0398] 15-bit Unicode characters: 010xxx xxxxxx xxxxxx

[0399] 21-bit Unicode characters: 011xxx xxxxxx xxxxxx xxxxxx

[0400] The last character in a string is marked by setting the high bit, which results in the following encoding scheme for the last character:

[0401] 10-bit Unicode character: 10xxxx xxxxxx

[0402] 15-bit Unicode characters: 110xxx xxxxxx xxxxxx

[0403] 21-bit Unicode characters: 111xxx xxxxxx xxxxxx xxxxxx

[0404] The value of the Unicode character "a" is 97 (0x61) and is encoded in 10-bit Unicode as "0001100001". According to the encoding scheme used in the preferred embodiment, the Unicode character "a" is encoded as "000001100001". The value of the Unicode character "b" is 98 (0x62) and is encoded in 10-bit Unicode as "0001100010". According to the encoding scheme used in the preferred embodiment, the Unicode character "b" is encoded as "100001100010", which sets the high bit because "b" is the last character in the string with a value of "ab". Therefore, the key portions associated with the nodes on levels 11 to 14 for storing the string value "ab" are associated with the values ​​1 (0x01), 33 (0x21), 33 (0x21), and 34 (0x22), respectively.

[0405] Interleaved multi-key

[0406] Embodiments of the present invention provide a way to store data in a trie so that queries involving more than one data item can be performed in a more efficient manner. The method of the present invention is particularly useful for storing keys or keys and values ​​in a database or information retrieval system so that they can be queried more efficiently, storing the result keys or keys and values ​​of a database or information retrieval system query, or storing input keys or keys and values ​​for a database query so that the query can be performed more efficiently.

[0407] The method of storing data of the present invention uses a trie, such as a trie having the data structure described above, the trie comprising nodes, wherein the node, preferably each child node is associated with a key portion, and wherein a path from a root node in the trie to another node defines a key associated with the node, wherein the key is a cascade of key portions associated with the nodes on the path. In order to achieve performance improvements in queries involving multiple data items, two or more data items are encoded in a key, and at least one or two, preferably each of the data items consists of two or more components. The key contains two or more consecutive sections, and at least one or two, preferably each of the sections includes two or more components of the data item encoded in the key. An "item" is sometimes referred to as a "dimension" in this article, and it may correspond to the so-called "key portion" or "content information of the key portion" above.

[0408] Fig. 22 An example of a two-dimensional key with a value of (X=12, Y=45) is shown, i.e. a key that encodes two data items X and Y. Both data items consist of two components, namely "1" and "2" in the case of item X, and "4" and "5" in the case of item Y. The key comprises two consecutive sectors S1 and S2. Both sectors include one component for each of the data items x and y encoded in the key: sector S1 includes the first component "1" of data item X and the first component "4" of data item y; sector S2 includes the second component "2" of data item X and the second component "5" of data item Y. It can be said that in a preferred embodiment, the key encodes multiple data items in an interleaved manner, such as X1Y1X2Y2.

[0409] According to a preferred embodiment, the key is encoded such that each of the regions, preferably the regions, of the key contains at least and / or at most one component from each of the data items encoded in the key. Fig. 22 The sections S1 and S2 of the key shown in each contain exactly one component of each of the data items X=12 and Y=45 encoded in the key.

[0410] Furthermore, for two or more sections, preferably all sections, of a key, components belonging to different data items are sorted in the same order within the section. Fig. 22 In the two sections of the key shown, the components are arranged in such a sequence that the component of data item X comes first and the component of data item Y comes second.

[0411] Furthermore, the order of the sections comprising the components of the data item preferably corresponds to the order of the components within the data item. Fig. 22In the key shown in , section S1 precedes section S2, which corresponds to the order of the components they include, in their respective items: S1 includes component "1" of item X, which precedes component "2" included by section S2 in item X. S1 also includes component "4" of item Y, which precedes component "5" included by section S2 in item Y.

[0412] Two or more data items, preferably all data items, of a key have the same number of components. Fig. 22 The items X and Y encoded in the key shown in each have two components. However, the data items of the key may also have a different number of components. For example, it may be the case that one of the items is a 64-bit integer and the other is a 32-bit integer. In the case where the key encodes the data items in a strictly regular interleaved manner, such as X1Y1X2Y2, data items with a smaller number of components may be padded, for example resulting in X1Y1X2Y2X3*X4*. Alternatively, the interleaving method may have to be modified, for example resulting in X1Y1X2Y2X3X4.

[0413] Fig.23 It shows how to Fig. 22 An example of keys being stored in a trie is shown in FIG. In a preferred embodiment, a key portion associated with a child node, preferably each of the child nodes, corresponds to a component of a data item. In other words, a component of a data item, preferably each data item, preferably each component corresponds to a key portion associated with a child node of the trie. Fig.23 In the example of , second level node 2302 is associated with key portion 1 corresponding to the first component of term X, third level node 2303 is associated with key portion 4 corresponding to the first component of term Y, fourth level node 2304 is associated with key portion 2 corresponding to the second component of term X, and fifth level node 2305 is associated with key portion 5 corresponding to the second component of term Y. Although this is not preferred, the key portions associated with the child nodes may also correspond to only a portion of a component of a data item, or to more than one component of a data item.

[0414] exist Fig. 22 and 23 In the example of , data items X and Y are 2-digit decimal numbers, and the components are decimal digits. Other examples of data items encoded in the key stored by the trie according to the present invention are geographic location data, such as longitude or latitude, indices, any kind of number or data type, such as an integer, a long integer or a double long integer, a 32-bit integer or a 64-bit integer, a string, a byte array, or a combination of two or more of these.

[0415] In the case where the data item is a number, the components of the data item may be digits (similar to Fig. 22 and Fig.23 In the example of ). In the case where the data item is a string, a component of the data item can be a single character. In the case where the data item is a byte array, a component of the data item can be a single byte.

[0416] However, in a preferred embodiment, the components of a data item are binary-encoded groups of bits of the data item, which preferably include 6 bits. This is because, as explained above, in a preferred embodiment, the value of the key portion of a child node is determined by the value of a bit in a bitmap (set) included in the parent node, depending on which bit the child node is associated with. Therefore, the size of the bitmap defines the possible alphabets for the key portion. For example, in the case where the size of each bitmap is 64 bits, the number of different values ​​that can be used for the key portion of a node is 2 6 This means that a binary-coded bit group comprising a 6-bit data item can be represented by the key portion associated with the node. In the case of a 32-bit bitmap, a group comprising 5 bits can be represented, and so on.

[0417] For example, in the case where the data item is a 64-bit long integer and each component is a 6-bit group of the binary encoding of the integer, the data item has 64 / 6=11 components. In the case where the data item is a character encoded in Unicode, it may have 2 to 4 6-bit components, as explained above. In the case where the data item is a string consisting of several characters, the components in the preferred embodiment are still 6-bit groups, that is, similar to any other data item, the string has the same type of components (6-bit groups). The digital components of the string correspond to the number of components of a single character multiplied by the number of characters in the string.

[0418] Instead of considering the components of the preferred embodiment as groups of bits, such as 6-bit groups, they may also be considered as digits having a predefined base or radix, such as 64.

[0419] As referenced below Fig.45 and Fig.46 as well as Figure 61 to Figure 65 It will become apparent from the description of range queries that an interleaved manner of storing keys with multiple data items can greatly improve the performance of range queries involving multiple data items. In addition, the skilled person will understand that interleaved storage can improve the performance of bidirectional searches and searches involving a "NOT" operator that involve multiple data items.

[0420] Set Operations

[0421] Embodiments of the present invention provide a time-saving method for performing queries in a database or information retrieval system, including operations such as intersection (Boolean AND), union (Boolean OR), difference (Boolean AND NOT), and exclusive OR (Boolean XOR) performed on two or more sets of keys stored in the database or information retrieval system, or the result key set of the database or information retrieval system query. These operations are referred to herein as "set operations" or "logical operations".

[0422] Still most databases use the Volcano processing model, which means "one tuple at a time". However, this is not efficient for modern CPU architectures that take into account multi-level caches and memory databases. Since all operators in the physical execution plan are tightly interleaved, the combined instruction footprint of the operators may be too large to fit into the instruction cache, and the combined state of the operators may be too large to fit into the data cache. Therefore, some databases apply an operator-at-a-time model or a combination of the two, a vectorized execution model. The index data structure and unified level-by-level processing model according to the present invention result in a very compact instruction footprint for accessing the index trie and operator implementation.

[0423] Fig.24 An illustrative flow chart of various stages of database query processing according to the prior art is shown. The query is parsed 2401, rewritten 2402 and optimized 2403, and the query execution plan QEP is prepared and refined 2404 so that the query execution engine (QEE 2405) can execute the QEP generated by the previous steps on the database 2406.

[0424] Fig.25 An exemplary QEP used in a prior art database is shown. The QEP is represented by a tree, where parent nodes 2501, 2502 are operators and leaf nodes 2503, 2504 are data sources. In a first operation, the results from a table scan 2504 are sorted by a sort operator 2502. In a second operation, the sorted results are merge-joined with the results of an index scan 2503.

[0425] Fig.26 Operator control and data flow in an iterator-based execution model of a prior art database are shown, where operators implement the following methods: Open (prepare the operator to produce data), Next (produce new data units according to the needs of the operator's consumers), and Close (complete execution and release resources). Each call to the Next method produces a new tuple.

[0426] The iterator-based execution model provides a unified model for operators that is independent of the data model of the data source (database table or database index) and unifies the temporary results of operator nodes. However, each operator call delivers only one unit of data, such as a record. This approach is not efficient for operators that combine large sub-result sets, which themselves return smaller result sets.

[0427] Tuples can be passed to other operators, such as Fig. 27 , which shows a tuple processing according to the query execution model of the prior art database. Starting from the root operator 2701, the call to next() will propagate to its operator child nodes 2702, 2703, and so on until the data source (and the leaf node of the tree representation) is reached. In this way, in the query execution plan operator tree, control flows downward from consumers to producers, and data flows upward from producers to consumers.

[0428] The tuple-at-a-time processing model has small intermediate results and therefore low memory requirements. The operators in the execution plan are tightly interleaved and can be very complex. However, the large number of function calls and the combined state of all operators results in a large amount of function call overhead and instruction and data cache misses, because their footprint is usually too large to fit into the CPU cache.

[0429] Both the iterator-based execution model and the tuple-at-a-time processing model require complex query optimizers to be efficient.

[0430] Fig.28 An operator-once processing of a query execution model according to a prior art database is shown, which immediately returns all tuples as the result of the operator in a suitable data structure (such as a list). The operator-once approach is cache efficient and has tight loops and low function call overhead, but each operator produces large intermediate results that may not fit into the data cache, or even into main memory, which may render this approach useless.

[0431] The present invention solves the problems of the prior art through a novel execution model where all data sources are tries. Two or more input tries are combined according to corresponding logical operations (set operations) to obtain key sets associated with nodes of corresponding result tries.

[0432] The database query then provides as output a set of keys associated with the nodes of the result trie, or a subset of keys associated with the nodes of the result trie, in particular keys associated with the leaf nodes of the result trie, or a set of keys or value sets derived from keys associated with the nodes of the result trie. Alternatively, it may provide other data items associated with the nodes of the result trie, such as document identifiers. The set of keys provided as output may be provided in the trie. It should be noted that the concept of "result trie" is used herein to define the set of keys that need to be obtained when combining the input tries using logical operations. However, during the combination of the input tries, the result trie does not necessarily have to be formed in a physical trie data structure, and the output set of keys may also be provided, for example, by a cursor or iterator.

[0433] If the logical operation is a difference (AND NOT), then the parent node in the result trie is the parent node in the first input trie, and the leaf nodes of the parent node in the result trie are the AND NOT combination of the set of child nodes of the corresponding parent node in the first input trie and the set of child nodes of the corresponding parent node in the other input trie, if any. If the logical operation is not a difference, for example, if the logical operation is an intersection (AND), union (OR), or exclusive OR (XOR), then the set of child nodes of each node in the result trie is a combination of the logical operation (e.g., AND, OR, or XOR) using the set of child nodes of the corresponding node in the input trie. In this case, since each child node is associated with a key portion, and the path from the root node in the trie to another node defines the key associated with the node, which is the concatenation of the key portions associated with the nodes on the path, two or more nodes of different tries "correspond" to each other if the keys associated with the nodes of different tries are the same.

[0434] In a preferred embodiment, each operator itself appears again as a trie to its consumers, up to the root operator node in the query execution plan tree, for example by implementing a corresponding trie (node) interface. Thus, instead of using an iterator interface, a node interface can be used. This allows functional composition and a simpler and more concise software architecture, and it further improves the performance of the database engine, because lower implementation complexity directly results in less function call overhead and fewer data and instruction cache misses.

[0435] Preferably, the data structure for implementing the trie is as described above. In particular, it is advantageous if the nodes in the input trie, preferably at least all parent nodes in the input trie, comprise a bitmap, and the value of the key part of the child node in the trie is determined by the value of the bit (set) in the bitmap comprised by the parent node (depending on which bit the child node is associated with). In such an embodiment, the combination of the child nodes of the input trie can be easily performed by combining the bitmap of each of the child nodes of the input trie using a logical operation (such as bitwise AND, bitwise OR, bitwise ANDNOT or bitwise XOR). The combined bitmap is obtained, and the result of the combination is performed on the basis of the combined bitmap.

[0436] Therefore, the physical algebra in the implementation of trie directly corresponds to the logical algebra of set operations. While in the prior art, bitmaps are only used in trie to reduce the memory space required for pointers, the present invention utilizes bitmaps to perform set operations on trie.

[0437] As mentioned above, an exemplary implementation of a trie node interface named "CDBINode" has the following main methods: getBitSet() - returns a bitmap with bits set for all non-null child pointers of the trie node; and getChildNode(bitNum) - returns the child nodes of a given node branch specified by the number of bits.

[0438] Fig.29The trie control and data flow of the query execution model according to the present invention are shown. Operator 2903 performs set operations on two sets of input elementary data 2901, 2902, such as intersection, union, difference or XOR. Each of the two sets of elementary data is provided in the input trie, and the two input tries are combined by operator 2901 according to the corresponding set operations. By implementing the same trie (node) interface as the input trie, operator 2903 itself appears as a trie to its user. Executor 2904 calls the above-mentioned trie node methods getBitSet and getChildNode to traverse the results provided by operator 2903, as indicated by the dotted arrows between the executor and the operator. When performing set operations, operator 2903 calls the same methods getBitSet and getChildNode to traverse the input tries 2901, 2902, as indicated by the dotted arrows between the operator and the input trie. In the data flow direction indicated by the solid arrows, the bitmaps and sub-trie nodes are passed from the input tries 2901, 2902 to the operators 2903, and from the operators 2903 to the executors 2904. As will be appreciated, one or more of the input tries for a set operation may be the output of another set operation on the trie using the same or different logical operators.

[0439] Fig.30 An example of applying an intersection (Boolean AND) operator 3003 on two input tries 3001, 3002 is shown. For readability, the input trie is octal, but in a preferred embodiment, a trie data structure as described above is used. Input trie 3001 includes three leaf nodes associated with keys "13", "14", and "55". Input trie 3002 also includes three leaf nodes associated with keys "13", "15", and "64". Trie 3005 is a representation of the resulting trie obtained by the AND combination of input tries 3001, 3002.

[0440] As can be observed, the child node set of each node in the result trie is the AND combination of the child node set of the corresponding node in the input trie. For example, the root node of the result trie 3005 has a child node associated with the key "1". This one child node is obtained when the intersection of the child node set ("1", "5") of the root node of the input trie 3001 and the child node set ("1", "6") of the root node of the input trie 3002 is formed. In addition, the node associated with the key "1" also has a child node associated with the key "13". In fact, when the intersection of the child node set ("13", "14") of the node "1" of the input trie 3001 and the child node set ("13", "15") of the corresponding node "1" of the input trie 3002 is formed, the node "13" is obtained.

[0441] Therefore, the result trie of the intersection operation (here, the result trie 3005) includes all nodes and only includes the nodes included by each of the input tries (here, the input tries 3001, 3002). In particular, the leaf node set of the result trie (here, the nodes associated with the key "13") includes all leaf nodes and only includes the leaf nodes included by each input trie and all input tries.

[0442] The algorithm performed by the preferred embodiment of the intersection operator 3003 can be described in pseudo code as follows:

[0443]

[0444] In the preferred embodiment, all trie nodes include a bitmap as described above. In addition, the trie is formed by nodes implementing an interface including the getBitSet and getChildNode methods as described above. A bitwise AND operation is performed between the bitmaps of the corresponding nodes of the two input tries to determine the set of child nodes common to the two corresponding nodes.

[0445] As the following reference Figure 31 to Figure 34 As will be shown, the solution of the present invention utilizes a hierarchical trie structure. Since the trie is processed level by level, it allows lazy evaluation. Therefore, the performance of set operations can be significantly improved.

[0446] Fig.31Two example input tries 3110, 3120 are shown on which intersection operations will be performed. Similar to all tries, input tries 3110 and 3120 have one (root) node on level 1. Input trie 3110 has two nodes on level 2, as indicated by the fact that the fourth and seventh bits are set in the bitmap 3111 included by the root node of input trie 3110. Input trie 3120 has one node on level 2, as indicated by the seventh bit set in the bitmap 3121 included by the root node of input trie 3120. Both input tries have further subtries at level 3 or deeper, as indicated by the triangles depending on the bits set in the corresponding bitmaps of the nodes at level 2.

[0447] Fig.32 The bitwise AND operation performed on the bitmaps of corresponding nodes of the input trie 3110 and 3120 at level 1 and level 2 is shown. The root nodes on level 1 of the input trie always correspond to each other, and therefore their bitmaps are combined with the first bitwise AND operation. Since the fourth and seventh bits are set in the bitmap 3111 of the root node of the input node 3110, and the seventh bit is set (only) in the bitmap 3121 of the root node of the input node 3120, the seventh bit is set (only) in the combined bitmap 3201. At level 2, the node depending on the seventh bit of the bitmap 3111 of the root node of the input trie 3110 corresponds to the node depending on the seventh bit of the bitmap 3121 of the root node of the input trie 3120, while the node depending on the second bit of the bitmap 3111 of the root node of the input trie 3110 has no corresponding node in the input trie 3120. Therefore, bitmaps 3113 and 3122 are combined using a bitwise AND operation at level 2 (only), and the third and sixth bits are set in the combined bitmap 3202.

[0448] Fig.33 31 shows branch skipping during the intersection operation of input tries 3110 and 3120. Since the bitwise AND operation of the bitmaps 3111 and 3121 of the root nodes of the two input tries produces a combined bitmap 3201 in which only the seventh bit is set, the intersection operation does not need to traverse the branches of the input trie 3110, depending on the fourth bit of the bitmap 3111 of the root node of the input trie 3110. This is Fig.333111 and the dashed line used to draw the skipped branch. Similarly, at level 2, the seventh bit is set only in the bitmap 3113 of the node in the input trie 3110, and not in the bitmap 3122 of the corresponding node in the input trie 3120. Therefore, depending on the seventh bit of the bitmap 3113, the intersection operation does not need to traverse the branch.

[0449] at last, Fig.34 The result trie of the intersection operation on tries 3110 and 3120 is shown. The bitmaps 3201 and 3202 associated with the nodes of the result trie on level 1 and level 2 correspond to the bitmaps 3201 and 3202 respectively generated by Fig.32 The bitmap of the combinations calculated by the bitwise AND operation is shown in FIG.

[0450] Figure 31 to Figure 34 The example of shows that, roughly speaking, in the process of combining the set operations of the input trie, some branches of the input trie do not need to be traversed, which can significantly improve performance. The combined bitmap can be used to determine which branches need to be traversed further and which branches can be skipped. This approach can be called "result prediction" or "tree pruning".

[0451] Fig.35 Shows the Fig.30 3001, 3002. The resulting trie 3605 obtained by the OR combination of the input tries 3001, 3002 is represented in Fig.36 Shown in.

[0452] As can be observed, the child node set of each node in the result trie is the OR combination of the child node set of the corresponding node in the input trie. For example, the root node of the result trie 3605 has three child nodes, which are associated with keys "1", "5" and "6". When the union of the child node set ("1", "5") of the root node of the input trie 3001 and the child node set ("1", "6") of the root node of the input trie 3002 is formed, these three child nodes are obtained. The node associated with key "1" also has three child nodes, which are associated with keys "13", "14" and "15". In fact, these nodes are obtained when the union of the child node set ("13", "14") of the node "1" of the input trie 3001 and the child node set ("13", "15") of the corresponding node "1" of the input trie 3002 is formed. Finally, the nodes in the result trie associated with keys "5" and "6", respectively, each have a child node associated with keys "55" and "64", respectively, which are children of the corresponding nodes of the input tries 3001 and 3002, respectively.

[0453] Therefore, the result trie of the union operation (here, result trie 3605) includes all nodes included by any of the input tries, here, input tries 3001, 3002. In particular, the set of leaf nodes of the result trie (here, the nodes associated with "13", "14", "15", "55", and "64") includes all leaf nodes included by any of the input tries.

[0454] The algorithm performed by the preferred embodiment of the union operator 3503 can be described in pseudo code as follows:

[0455]

[0456]

[0457] Likewise, all trie nodes include a bitmap as described above, and a trie is formed of nodes that implement an interface including the getBitSet and getChildNode methods as described above. A bitwise OR operation is performed between the bitmaps of the corresponding nodes of the two input tries to determine the set of child nodes included by either of the two corresponding nodes. If a bit is set in the bitmap of only one of the two corresponding nodes, the child trie that depends on that one node is added to the result trie, which is indicated in the pseudocode above by "recursive trieA only" / "recursive trieB only".

[0458] Fig.37 Shows the Fig.30 An example of applying a difference (Boolean AND NOT) operator 3703 to two input tries 3001, 3002. Trie 3705 is a representation of the result trie obtained by the AND NOT combination of the input tries 3001, 3002.

[0459] As can be observed, all parent nodes of the result trie 3705 correspond to parent nodes of the first input trie 3001. The leaf nodes that depend on the parent nodes of the result trie 3705 are AND NOT combinations of the child node sets of the corresponding parent nodes in the first input trie 3001 and the child node sets of any corresponding parent nodes in the input trie 3002.

[0460] For example, the root node of result trie 3705 has two child nodes associated with keys "1" and "5", which are themselves parent nodes. These two nodes correspond to the two child nodes of the root node of input trie 3002, which are themselves parent nodes. The node associated with key "1" has a child node, which is a leaf node and is associated with key "14". When forming a difference set of the child node set ("13", "14") of node "1" of the first input trie 3001 and the child node set ("13", "15") of the corresponding node "1" of input trie 3002, the leaf node is obtained. Finally, the node in the result trie associated with key "5" has a child node, which is associated with key "55" and corresponds to the child node of the node with key "5" of the first input trie 3001. This node with key "5" does not have a corresponding node in input trie 3002.

[0461] Thus, the result trie of the difference operation (here result trie 3605) includes all parent nodes included by the first input trie (here input trie 3001). The set of leaf nodes of the result trie (here the nodes associated with keys "14" and "55") includes all leaf nodes of the first input trie (here trie 3001) minus the leaf nodes of the second input trie (here trie 3002).

[0462] The algorithm performed by the preferred embodiment of the difference operator 3703 can be described in pseudo code as follows:

[0463]

[0464]

[0465] Similarly, all trie nodes form and implement the interface as described above. If bits are set in the bitmaps of the corresponding nodes of the input tries 3001 and 3002, there is recursion on both tries. If bits are set only in the bitmap of the node of the first input trie 3001, the sub-trie depending on the node is added to the result trie, which is indicated by "recursive trieA only" in the pseudo code above. The bits set only in the bitmap of the node of trie 3002 are ignored. If the child nodes of the corresponding nodes of the two input tries are leaf nodes, a bitwise AND NOT operation is performed only between the bitmaps of the corresponding nodes of the two input tries.

[0466] Execution of the operator comprises a recursive descent over the trie levels (in a preferred embodiment, each level is a digit of the radix / radix 64). At each level, the bitmap of each node is used as a result prediction, followed by iteration through the prediction bits. Thus, combining the input trie comprises performing a combining function on the root node of the result trie. Performing a combining function for an input node of the result trie comprises: determining a set of child nodes of the input node of the result trie (which may also be empty) by combining the set of child nodes of the nodes of the input trie corresponding to the input node of the result trie; using logical operations; and performing a combining function for each of the determined child nodes of the input node of the result trie. As already mentioned above, the root node and / or the input nodes of the result trie do not have to be physically generated.

[0467] The step of combining the input tries may be performed using a depth-first traversal, a breadth-first traversal, or a combination thereof. Combining the input tries in a depth-first traversal includes: performing a combining function on one of the child nodes of the input node, and traversing a subtrie formed by the child node before performing the combining function on the next sibling node of the child node. Combining the input tries in a breadth-first traversal includes: performing a combining function on each of the child nodes determined for the input node of the result trie; and determining a set of child nodes for each of the child nodes determined for the input node of the result trie before performing the combining function on any grandchild node of the input node of the result trie.

[0468] One or more of the input tries used for the set operation may be a virtual trie, i.e., a trie dynamically generated as needed during the operation of combining the input tries. Typically, only those portions of the virtual trie are dynamically generated that are required to combine the input tries using the logical operation. There are several cases for the application of virtual input tries, one of which is an implementation of database range queries, which will be described below.

[0469] Range Query

[0470] The combination of two or more input tries through an intersection operation (Boolean AND) can be advantageously used to perform range queries in an efficient manner. A "range" can be described as a set of discrete, ordered values ​​that includes all values ​​between a first value and a second value of a certain data type, where the first value and / or the second value may or may not be included in the range. A range query returns the keys in the key set whose values ​​correspond to (match) one or more specified ranges of values.

[0471] The range query according to the present invention is performed by an intersection operation of a trie, which stores a key set to be searched for one or more ranges (hereinafter referred to as the "input set trie"), wherein the trie stores all values ​​included in one or more ranges (hereinafter referred to as the "range trie"). The trie is preferably implemented as described above. The key set to be searched is typically associated with a node of the input set trie, and the value (key) indicating the range of values ​​to be matched is typically associated with a node of the range trie, in particular with a leaf node of the range trie. The key set to be searched is typically a key set stored in a database or a result of a database query or an input key set, or a key set stored in an information retrieval system or a result of an information retrieval system query or a set of input keys.

[0472] The definition of one or more ranges for performing the query is obtained by user input or other means. The definition is used to generate a range trie, wherein the values ​​associated with the nodes (typically leaf nodes) of the range trie correspond to the values ​​included in the one or more ranges. In the next step, the input set trie is combined with the range trie by the intersection operation as described above to obtain the key set associated with the nodes of the result trie. Finally, the key set associated with the nodes of the result trie, or a subset of the keys associated with the nodes of the result trie, in particular the keys associated with the leaf nodes of the result trie, or a key set or value set derived from the keys associated with the nodes of the result trie is obtained as output.

[0473] Fig.38 An input set trie 3801 storing a set of keys to be searched for within one or more ranges, and a range trie 3802 generated to store all values ​​included in the one or more ranges are shown. Both tries 3801 and 3802 are combined by an intersection operator 3803 to obtain a set of keys in the input set trie 3801 whose values ​​are within one or more ranges stored by the range trie 3802. As described above, not only the input set trie and the range trie, but also the intersection operator itself can implement the corresponding trie (node) interface, as shown by Fig.38 In the case where the trie node interface has getBitSet() and getChildNode(bitNum) methods as presented above, the intersection operator 3803 can call these operations to traverse the input set trie 3801 and the range trie 3802, as indicated by Fig.38 In the data flow direction indicated by the solid arrows, the bitmap and sub-trie nodes are passed from the set trie 3801 and the range trie 3802 to the intersection operator 3803.

[0474] Fig.39 An example of a method for performing a range query according to the present invention is shown. The leaf nodes of an input set trie 3901 are associated with three keys having values ​​of "13", "14" and "55". A range trie 3902 is generated to include all leaf nodes associated with keys whose values ​​are in the range or in [14..56]. At each level of the range trie, the nodes at the ends of the range (in the example of range trie 3902 nodes 1 and 5) contribute partially to the result. The nodes between the ends of the range (in the example of range trie 3902 nodes 2, 3 and 4) and the subtries depending on them fully contribute to the result. The AND combination of the input trie 3901 and the range trie 3902 by the intersection operator 3903 obtains a key set associated with the nodes of the result trie 3905. An executor 3904 can output, for example, the values ​​of the keys associated with the leaf nodes of the result trie 3905, i.e., "14" and "55". This output corresponds to the values ​​of all keys associated with the leaf nodes of the input set trie 3901 that are in the range [14..56].

[0475] The algorithm performed by the intersection operator 3903 can be described in pseudo code as follows:

[0476]

[0477]

[0478] Range trie 3902 is an example showing that a range trie can include many nodes. Therefore, materializing range trie 3902 and all of its nodes would be expensive in terms of time and memory space. For this reason, the range trie can be implemented as a virtual trie, i.e., a trie that is dynamically generated as needed during an intersection operation. This is Fig.39 The contents of the triangle in the range trie 3902 are indicated by being drawn using dashed lines.

[0479] During the intersection operation, the operator accesses and the virtual range trie delivers the components needed to traverse the trie "on the fly" through the application programming interface (API). For example, the bitmap of the current node can be accessed through the getBitSet() method, and the child nodes can be accessed through the getChildNode() method introduced above. The API returns the corresponding bitmap on the one hand, and objects (instead of the child nodes of the real trie) on the other hand, which will provide the corresponding bitmap for the next recursion. For the operator, the virtual trie looks like a real, physically implemented trie.

[0480] Typically, only those parts of the virtual range trie are dynamically generated that are necessary to combine the input set trie and the range trie together via the intersection operation. Fig.39 In the example of , due to branch skipping as explained above, the virtual subtries associated with bits 2, 3, 4, and 5 set in the bitmap of the root node of the range trie are not visited during the intersection operation, and therefore, none of their nodes are generated.

[0481] In some embodiments of range queries according to the present invention, similar to Fig.39 In the embodiments shown in , the key associated with the leaf node of the input set trie encodes a data item of a specific data type. These embodiments may also be referred to as "one-dimensional" range queries. In a one-dimensional range query, the definition of one or more ranges includes the definition of one or more ranges of a data item.

[0482] Multidimensional range query processing

[0483] In other embodiments of range queries according to the present invention, the keys associated with the leaf nodes of the input set trie encode two or more data items of a specific data type. In this case, the definition of one or more ranges includes the definition of one or more ranges of one or more data items in the data items. Such embodiments may also be referred to as "multidimensional" range queries. Although in principle a range query can be performed for each dimension and the intersection of the results can be performed, it is not efficient because too many tries and too many operators will be involved.

[0484] Fig.40 An example of efficient multi-term or multi-dimensional range query processing according to the present invention is shown in FIG. Input set trie 4001 is a two-dimensional or two-term trie in which each of its leaf nodes is associated with a key specifying a value pair (x, y). Such a value pair can be used, for example, to specify the longitude and latitude of geographic location data, or a composite key such as (longitude, ID) or (latitude, ID), as will be referenced below. Figure 54 to Figure 57 In this example, each of the dimensions x and y comprises two digits in the octal system to improve readability, but in a preferred embodiment, the trie data structure described above is used. As will become apparent from the following explanation, the x and y dimensions are stored in an interleaved manner in the input set trie 4001 according to the above described interleaved encoding of multiple data items in a key.

[0485] Input set trie 4001 has a root node at level 1. The bitmap associated with the root node indicates the value of the first digit of the x dimension. Bits "1" and "5" are set in the bitmap associated with the root node, indicating that the first digit of the x dimension of the key stored in the input set trie is "1" or "5". The bitmap associated with the node on level 2 indicates the value of the first digit of the y dimension. Bits "3" and "4" are set in the bitmap associated with the node on level 2, which depend on bit "1" of the root node, and bit "6" is set in the bitmap associated with the node on level 2, which depends on bit "5" of the root node. This indicates that the first digit of the y dimension of the key whose x dimension starts with "1" is "3" or "4", and the first digit of the y dimension of the key whose x dimension starts with "5" is "6". The bitmap associated with the node on level 3 indicates the value of the second digit of the x dimension. The bits set in these bitmaps indicate the presence of keys whose y-dimensions begin with "3" and whose x-dimensions are "12" and "16", keys whose y-dimensions begin with "4" and whose x-dimensions are "12" and "15", and keys whose y-dimensions begin with "6" and whose x-dimension is "56". The bitmaps for nodes at level 4 and nodes at level 5 are not in Fig.40 , but only indicated by small triangles depending on the nodes on level 4.

[0486] The range trie for multinomial or multidimensional range queries can be a multinomial range trie obtained by combining a single item or a one-dimensional range trie for each of the data items encoded by the key associated with the leaf nodes of the input set trie, the single item range trie of the data item storing all values ​​included in one or more ranges of the data item. As described above, the single item range trie can be a virtual range trie. This means that only those parts of the virtual single item trie are dynamically generated, which are necessary to combine the single item range trie to obtain the multinomial range trie or to combine the input set trie and the single item trie by an intersection operation.

[0487] exist Fig.40 In the example of , two one-dimensional input ranges are obtained for a two-dimensional range query: a range of [15..55] for the x dimension, and a range of [30, 31] for the y dimension. A (virtual) range trie 4002 is created that stores the range of [15..15] for the x dimension, and a (virtual) range trie 4003 is created that stores the range of [30..31] for the y dimension.

[0488] In some multidimensional range queries, for some data items (dimensions), the range definition is not available. For example, the user can only specify the range [15..55] for the x dimension to query Fig.40The two-dimensional input set trie 4001 performs range query processing, but there is no definition of the range for the y dimension. This means that the user is interested in all keys stored in the input set trie 4001 whose x-dimensional values ​​are between 15 and 55, regardless of their values ​​for the y dimension. Dimensions with unspecified ranges will be skipped or ignored. This can be achieved by creating a (virtual) single-item range trie even for data items that do not obtain a range definition, which stores the entire range of possible values ​​of the data item. Such a trie may also be referred to as a "wildcard trie". For example, in one embodiment, the MatchAll trie is a trie that implements the trie (node) interface ("CDBINode") mentioned above. Calling the getBitSet() method on any of its nodes will always return a bitmap with all bits set.

[0489] A multi-item or multi-dimensional range trie obtained from a combination of a single-item or one-dimensional range trie typically stores all combinations of values ​​for the data items stored in the single-item (one-dimensional) range trie. For example, if the range for the x dimension is [11..13], and the range for the y dimension is [7..8], then the combined two-dimensional range trie will store keys for the (x, y) value pairs (11, 7), (11, 8), (12, 7), (12, 8), (13, 7), and (13, 8).

[0490] Fig.41 Shows how to combine Fig.40 The one-dimensional range trie 4002 and 4003 have different parts to obtain Fig.42 The interleaved two-dimensional range trie shown in Fig.42 It can be observed that the x and y dimensions in the combined two-dimensional range trie are similar to Fig.40 The input set of trie 4001 is stored in the same interleaved manner. In contrast, Fig.43 Shows how to Fig.40 The one-dimensional range trie 4002 and 4003 are combined to obtain Fig.44 The non-interleaved two-dimensional range trie shown in . From an abstract perspective, this will result in a trie consisting of all X-value keys, where each leaf node is the root node of a trie consisting of all Y-value keys.

[0491] In a preferred embodiment of the present invention, and for both one-dimensional and multidimensional range queries, the range trie has the same structure or format as the input set trie. Therefore, in the case where the multidimensional input set trie stores data items in an interleaved manner, the multidimensional range trie preferably uses interleaved storage, and in the case where the input set trie stores data items in a non-interleaved manner, the multidimensional range trie preferably also does not use interleaved storage. In addition, the keys associated with the leaf nodes of the range trie preferably encode data items of the same data type as the keys associated with the leaf nodes of the input set trie. Finally, in the range trie, data items of a certain data type or components of such data items are preferably encoded in nodes of the same level as the corresponding data items or components of data items in the input set trie.

[0492] In some embodiments of multi-term or multi-dimensional range query processing, combining a single-term or one-dimensional range trie to obtain a multi-term or multi-dimensional range is performed by a function that provides the multi-term range trie as input to a function (e.g., an intersection operator) that performs a combination of the input set trie and the multi-term range trie. Fig.64 , where the combination is performed by the interleave operator 6404.

[0493] In other embodiments, the combination of a single-term or one-dimensional range trie is performed in a function or operator that implements the intersection of an input set trie with a range trie to obtain a multi-term or multi-dimensional range trie. In this case, the multi-dimensional range trie will exist only conceptually. In practice, the function or operator that implements the combination of an input set trie with a range trie accesses a (virtual) one-dimensional range trie, such as if they together form a (virtual) multi-dimensional range trie. If there are dimensions for which no ranges are specified, the function or operator that implements the intersection of an input set trie with a range trie will skip or ignore these dimensions, for example by creating a wildcard trie as described above.

[0494] exist Fig.40 In the example of , the combination is performed by a two-dimensional intersection (AND) operator 4004. The algorithm performed by the intersection operator 4004 can be described in pseudo code as follows:

[0495]

[0496]

[0497] Conceptually creates a (virtual) multidimensional range trie where, if one actually combines the one-dimensional range tries to obtain a (virtual) multidimensional range trie, at least if the multidimensional range trie has the same structure or format as the input set trie, then the set of child nodes of each node in the resulting trie will be the result of the AND combination of the set of child nodes of the corresponding node in the input set trie with the multidimensional range trie.

[0498] For example, Fig.40 Result trie 4006 is shown, which stores the x and y dimensions in an interleaved manner similar to input set trie 4001. Result trie 4006 has node 4007, which is associated with a key with a value of (x=1, y=3). This node represents the entire set of child nodes of node 4108, which are associated with a key with a value of x=1. The node of input set trie 4001 corresponding to node 4007 of result trie 4006 is node 4009, which is a node associated with a key with a value of x=1. Fig.41 It is shown that if Fig.40 The one-dimensional range trie 4002 and 4003 of the input set trie 4001 are actually combined, and the multidimensional range trie 4100 obtained has the same structure and format as the input set trie 4001. The node of the multidimensional range trie 4100 corresponding to the node 4007 of the result trie 4006 is the node 4101, which is the node associated with the key with a value of x=1. The AND combination of the child node set (nodes 4010 and 4011) of the node 4009 of the input set trie 4001 and the child node set (node ​​4102) of the node 4101 of the multidimensional range trie 4100 results in the node 4007 of the result trie 4006.

[0499] In many cases, storing the different dimensions or items of a multidimensional or multi-item input set trie in an interleaved manner will result in more efficient range queries, such as those now referenced Fig.45 and Fig.46 Explained.

[0500] Fig.45 Shows the storage and Fig.40Input set trie 4501 is an input set trie 4501 having the same values ​​as input set trie 4001, but in a non-interleaved manner. Like input set trie 4001, input set trie 4501 has a root node at level 1, and the bitmap associated with the root node indicates the value of the first digit of the x dimension. However, the bitmap associated with the nodes on level 2 of input set trie 4501 indicates the value of the second digit of the x dimension, rather than the value of the first digit of the y dimension in the interleaved input set trie 4001. The bitmap associated with the nodes on level 3 indicates the value of the first digit of the y dimension, and the bitmaps of the nodes on level 4 ( Fig.45 ) indicates the value of the second digit of the y-dimension.

[0501] When performing an AND combination of the input set trie 4501 and the corresponding (also non-interleaved) two-dimensional range trie according to the present invention, the nodes for the two-dimensional range query with the range X=[15..55] and Y=[30..31] are traversed. Fig.45 , shown shaded in the figure (nodes on level 5 are not shown). Although only one node in level 4 (x=16, y=3) is a colored node, a total of six nodes need to be traversed (visited) at the three higher levels: the root node x=1, x=5, x=15, x=16, and x=53.

[0502] In contrast, Fig.46 Shows Fig.40 The interleaved input set trie 4001 of FIG. 4001 is shown, where the nodes traversed for the two-dimensional range query with the range X=[15..55] and Y=[30..31] according to the present invention are again colored (nodes on level 5 are not shown). Fig.45 One node in the same level 4 (x=16, y=3) is a shaded node, but at the three higher levels, only four nodes in total need to be traversed: the root node x=1, x=5, and (x=1, y=3).

[0503] The reason for this is that while in the non-interleaved input set trie 4501, all x values ​​falling within the range of [15..55] are determined up to the last (second) digit, in the interleaved input set trie 4001, nodes that are not worth traversing can be eliminated more quickly by looking at the first digit of the y dimension. The chance of eliminating a node by looking at the first digit of another dimension is higher than the chance of eliminating a node by looking at another digit of the same dimension. As will be appreciated, the more digits in different dimensions, the higher the performance benefit of interleaved storage will be.

[0504] As mentioned above, the range query process can provide as output the set of keys associated with the leaf nodes of the input set trie, for example, in the case of a one-dimensional range query, or if the user is interested in all dimensions of a multidimensional key stored in the input set trie. Alternatively, the range query process can provide as output a set of reduced term keys that encode a subset of the data items encoded by the keys associated with the leaf nodes of the input set trie. Fig.47 and Fig.48 An example of this is shown in .

[0505] exist Fig.47 In the case of a two-dimensional or binomial trie input set trie 4701 and Fig.40 4702 is a wildcard trie that stores the entire range of possible values ​​for the x dimension, and the one-dimensional range trie 4703 is a wildcard trie that stores the entire range of possible values ​​for the y dimension.

[0506] Similar to Fig.40 The one-dimensional range tries 4002 and 4003, the one-dimensional range tries 4702 and 4703 are combined, at least conceptually, to obtain a binomial or two-dimensional range trie. Since both one-dimensional range tries are wildcard tries, the two-dimensional range trie contains all possible value pairs (x, y). The two-dimensional range trie is then combined with the two-dimensional input set trie 4701 via a two-dimensional intersection (AND) operator 4704. Similar to Fig.40 The two-dimensional intersection (AND) operator 4004 of the result trie is used to combine the two-dimensional input set trie with the two-dimensional range trie according to the intersection operation to obtain the key set associated with the node of the corresponding result trie. In addition, as explained above, the child node set of each node in the result trie is the AND combination of the child node set of the corresponding node in the two-dimensional input set trie and the child node set of the corresponding node in the two-dimensional range trie. Since the two-dimensional range trie stores all possible value pairs (x, y), the result trie is the same as the input set trie.

[0507] and Fig.40 In contrast, since the user is only interested in the x values ​​stored in the input set trie, Fig.47The intersection operator 4704 does not provide as output the set of keys (x, y) associated with the leaf nodes of the input set trie. Instead, the intersection operator 4704 only provides as output the set of values ​​for the x dimension, in this example, the set of all x values ​​stored in the input set trie.

[0508] In the case where range query processing provides a reduced set of term keys as output, similar to Fig.47 In , the sets of simplified term keys obtained from different branches of the input set trie for data items not encoded in the simplified term keys may contain duplicates. Fig.47 As can be seen, there are at least two leaf nodes in the input set trie 4701 whose x value is 12, namely, at least one leaf node whose first digit of the y value is 3 (12, 3...) and at least one leaf node whose first digit of the y value is 4 (12, 4...). In order to eliminate duplicate keys before providing the output, especially if the output set is used in an upstream operator, the simplified item key sets obtained from different branches of the input set trie related to data items not encoded in the simplified item keys are merged before providing the output. For two dimensions, the merge can be performed for each level of the input set trie in an acceptably efficient manner. However, it will generally be more efficient (for example, where the input set trie has more than two dimensions) to write the simplified item key sets into a newly created trie, thereby automatically eliminating duplications.

[0509] exist Fig.47 In the example of , in order to eliminate duplicate x values ​​in the output set, the x value key set obtained by combining the input set trie4701 with the two-dimensional range trie through an intersection operation is written into a newly created one-dimensional trie, whose nodes are associated with keys with only x values. This newly created one-dimensional trie is as follows Fig.48 The value of the key associated with its leaf node corresponds to the set of all x values ​​stored in the input set trie 4701.

[0510] The algorithm performed by the two-dimensional intersection operator 4004, which outputs only x values, can be described in pseudo code as follows:

[0511]

[0512]

[0513] exist Fig.47, only the values ​​of the x dimension are provided as output. As will be appreciated, the same principles apply when only the values ​​of the y dimension are provided as output. Furthermore, since both the one-dimensional range trie 4702 and 4703 are wildcard tries, all x values ​​stored in the input set trie 4701 are provided as output. As will be appreciated, in the case where the one-dimensional range trie 4702 and / or 4703 only store a subset of all possible x and / or y values, only a subset of all x values ​​stored in the input set trie 4701 may be provided as output. For example, if the one-dimensional range trie 4702 is identical to Fig.40 If, like the range trie 4002 of , only x values ​​are stored in the range [15..55], the output provided by the intersection operator 4004 will not include the value of x=12. As another example, if both one-dimensional range tries 4702 and 4703 are the same as Fig.40 If the corresponding range tries 4002 and 4003 are the same, storing only x values ​​in the range of [15..55], and correspondingly storing only y values ​​in the range of [30..31], then the output provided by the intersection operator 4004 will only include values ​​of x=16.

[0514] Fuzzy Search

[0515] A common requirement for text retrieval applications is to provide approximate string matching - also known as fuzzy search capability. That is, finding strings that closely match a pattern, rather than exactly match it.

[0516] A typical measure of this "fuzziness" (the difference between two character sequences) is the Levenshtein distance. The Levenshtein distance between two strings is the minimum number of single-character edits (character insertions, deletions, or substitutions) required to change one string into the other.

[0517] Similar to the virtual range trie discussed above, one aspect of the present invention is directed to a preferred virtual fuzzy matching trie that uses Boolean AND to intersect with a storage trie such as an index trie to return documents that match a key string or include a matching key string. As described above, the index trie can store each occurrence of a term and a document ID as two key parts (string, long).

[0518] According to this aspect of the invention, data is retrieved from an electronic database or information retrieval system by performing approximate string matching. First, a search string is obtained. Next, a matching trie is established that stores approximate strings including the search string and / or variations of the search string. The matching trie is combined with a storage trie using an intersection operation, the storage trie storing a set of strings stored in an electronic database or information retrieval system or a result string of an electronic database or information retrieval system query. The storage trie can be an index trie, for example, storing a string including a document and a corresponding document identifier as two key parts, such as (string, long).

[0519] Similar to the intersection of tries described above, a result trie is obtained. The set of child nodes of each node in the result trie is the intersection of the set of child nodes of the corresponding node in the matching trie and the storage trie, where if the same key is associated with nodes of different tries, the nodes of different tries will correspond to each other. Typically, the matching trie, the storage trie, and the result trie have the same structure or format. Unless otherwise specified in this section, all aspects of the intersection operation on tries discussed above also apply to the intersection of tries in the context of fuzzy search.

[0520] As described above, a trie includes one or more nodes, each child node is associated with a key portion, and a path from a root node in the trie to another node defines a key associated with the node, which is a cascade of the key portions associated with the nodes on the path. The trie can be implemented using the trie data structure described above. However, unlike the example described above, a matching trie is typically an undirected loop. This means that a child node in a matching trie may have more than one parent node. FIG. 48B to FIG. 48E An example of an undirected cycle is provided in , which is described in more detail below. In contrast, each child node in the storage trie and the result trie typically has only one parent node.

[0521] Fuzzy search according to the present invention is particularly efficient, and the matching trie is a virtual trie that is dynamically generated during the intersection of the matching trie and the storage trie. Only those parts of the virtual trie are (dynamically) generated that are necessary for the intersection of the matching trie and the storage trie, which is sometimes also referred to as "lazy evaluation". Unless otherwise specified in this section, all aspects of the virtual trie discussed above also apply to the use of the virtual matching trie in the case of fuzzy search.

[0522] As output of the fuzzy search, strings and / or other data items are provided, such as document identifiers associated with the result set of nodes of the result trie. Typically, a matching trie comprises a set of matching nodes, each of which is associated with one or more keys corresponding to one of the strings from the set of approximate strings. In this case, the result set of nodes may be the set of nodes of the result trie corresponding to the set of matching nodes in the matching trie (if the keys associated with the nodes of the result trie and the keys associated with the nodes of the matching trie are the same, then the nodes of the result trie correspond to the nodes of the matching trie). This means that only those string data items, such as document identifiers, are provided as output that are associated with the nodes of the result trie corresponding to the matching nodes of the matching trie.

[0523] Reference FIG. 48A to FIG. 48E , it will now be described how a (virtual) matching trie can be generated that stores a set of approximate strings including a search string and / or variations of the search string. The matching trie is derived from a finite automaton that represents a set of approximate strings. First, a non-deterministic finite automaton that represents a set of approximate strings is established. In the non-deterministic automaton, each transition between two states is typically associated with a specific character, a wildcard, or an empty string included by the search string. From the non-deterministic finite automaton, a deterministic finite automaton that also represents a set of approximate strings can be derived, wherein the transition between two states of the deterministic finite automaton is typically associated with a specific character or a wildcard included by the search string. The matching trie is then derived from the deterministic finite automaton.

[0524] Fig.48A A non-deterministic finite automaton (NFA) is shown to match the search string "abc" with a maximum edit distance of 2, also known as a Levenshtein automaton. As known to the skilled person, a finite automaton consists of states and transitions between states. The state marked with reference numeral 0001 is the start state, state 0006 is the end state matching 0 edits, state 0007 is the state for 1 edit, and state 0008 is the state for 2 edits. For larger edit distances, be sure to add an additional row of states at the top. Larger strings will result in additional states on the right.

[0525] State 0002 is the state transition that matches the first character ("a"). For "abc" as input, the final state 0006 is reached. State 0003 is the state transition that inserts characters at the beginning, for example, if "xabc" is provided to the automaton. State transition 0004 reflects character replacement, for example, if "ybc" is provided to the automaton. Finally, transition 0005 reflects character deletion, for example, if "bc" is provided to the automaton.

[0526] It can be seen that Fig.48A The automaton is nondeterministic. For example, providing "a" as the first input character will result in states 01, 11, 10, 12, 21, 22, and 32. This set of states contains the matching state (32, reference numeral 0008) because "abc" requires the deletion of two characters to obtain "a".

[0527] An NFA can be converted to a deterministic finite automaton (DFA) using, for example, the so-called Powerset construction method.Other methods for efficiently creating Levenshtein automata DFAs include those proposed by Klaus Schulz and Stoyan Mihov. Fig.48B Such a DFA is shown for matching "abc" with an edit distance of 1 to reduce the number of states for the example. The state marked by reference numeral 1001 is the start state. Reference numeral 1002 refers to the transition of a specific character ("b"). Reference numeral 1003 refers to the transition of any other character (wildcard). The gray states such as marked 1005 are matching states.

[0528] In a preferred embodiment, the parent nodes in the matching trie and the storage trie include a bitmap, and the value of the key portion of a child node in the trie is determined by the value of a bit in the bitmap included by the parent node of the child node, depending on which bit the child node is associated with. Such trie data structures have been described in the examples above. They allow particularly efficient intersection operations because the intersection of the child nodes of the matching trie with the child nodes of the storage trie can be achieved by combining the bitmap of each of the child nodes using an intersection operation.

[0529] A matching trie with such a data structure can be derived from a (deterministic) finite automaton by associating the transitions between the states of the finite automaton by the encoding of the specific character or wildcard associated with the transition to obtain an enhanced finite automaton, whose encoding consists of or is represented by one or more bitmaps, the length and / or format of which is equal to the bitmap included by the parent node of the matching trie. For the encoding of the specific character, exactly one bit is set in each of the bitmaps included or represented by the encoding. For the encoding of the wildcard, the bits of all valid character encodings are set in the bitmap included or represented by the encoding, thereby "masking" all valid character encodings (or the bits of all valid character encodings, except the encoding of the specific character associated with the state left by the transition). In other words, the encoding of the wildcard is an OR combination of the bitmaps of all valid character encodings (or the OR combination of the bitmaps of all valid character encodings, except the encoding of the specific character associated with the state left by the transition).

[0530] Fig.48C Shows Fig.48B This enhancement of the DFA transformation, which uses the above reference Fig.21 The encoding scheme for Unicode characters and Unicode strings described in . To improve readability, only 10-bit Unicode character encodings are used. These encodings use two bitmaps of 64 bits each. As described above, since exactly one bit is set in each of these bitmaps, they are each capable of encoding 6 bits (2 6 =64).

[0531] The encoding 2001 represents "a" encoded as two 6-bit values ​​1 ("000001") and 33 ("10001"), with each bit position encoded as

[0532] 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0010

[0533] and

[0534] 0000 0000 0000 0000 0000 0000 0000 0010 0000 0000 0000 0000 0000 0000 0000 0000 0000

[0535] Expressed in hexadecimal, where 0000=0, 0001=1, 0010=2, 0011=3, ..., 1111=F, this corresponds to 0x000000000000002 and 0x0000000200000000.

[0536] The encoding 2003 represents "b" encoded as two 6-bit values ​​1 ("000001") and 34 ("10010"), with each bit position encoded as

[0537] 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0010

[0538] and

[0539] 0000 0000 0000 0000 0000 0000 0000 0100 0000 0000 0000 0000 0000 0000 0000 0000 0000

[0540] In hexadecimal, this corresponds to 0x0000000000000002 and 0x0000000400000000.

[0541] In the case of a wildcard, the bits for the encoding of all allowed characters (in this case, the full Unicode alphabet) are set. For example, the bits for encoding 2002 are set to represent all 10-bit encoded Unicode characters, i.e., the 6-bit values ​​"000000" ... "001111" and "000000" ... "111111", with each bit position encoded as

[0542] 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 1111 1111 1111 1111

[0543] and

[0544] 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111

[0545] In hexadecimal, this corresponds to 0x000000000000FFFF and 0xFFFFFFFFFFFFFFFFFFFF.

[0546] Codes 2004 and 2005 represent the same character "b", one is a non-final case and one is a matching state, i.e., "b" is the last letter in the input string. Codes 2006 and 2007 show the simulation of wildcards. Codes 2008 and 2009 show the case of the final matching state of the character "c" and the wildcard.

[0547] All Unicode characters that cause an unmatched state (see above Fig.21 The complete wildcard mask for the interpreted 10-bit, 15-bit, and 21-bit encodings is:

[0548]

[0549] The full wildcard mask for all Unicode characters that result in a match status is:

[0550]

[0551] Fig.48D The resulting top of the matching trie is shown, with each 10-bit Unicode character represented by two key parts. Since the Boolean AND operator on the trie requires a bitmap first, and then descending into the matching child nodes, the specific characters are encoded as a single bit, and the wildcards are encoded as a bitmap with bits set for all valid character encodings.

[0552] Such a matching trie can be derived directly from any of the finite automata described above, in particular the augmented finite automata. However, in the case where the characters stored in the matching trie, storage trie or result trie are encoded by multiple M>1 key parts of the corresponding trie, i.e. by nodes of more than one level, the matching trie is preferably derived from a complete finite automaton representing a set of approximate strings. Preferably, M is between 2 and 4.

[0553] A complete finite automaton from a preferably deterministic finite automaton as described above, more preferably from an augmented finite automaton, by replacing a transition, preferably each transition, between two states of the finite automaton with one or more sequences of M-1 levels of intermediate states and M transitions linking the two states via M-1 intermediate states, or by associating a transition, preferably each transition, between two states of the finite automaton with one or more sequences of M-1 levels of intermediate states and M transitions linking the two states via M-1 intermediate states. Thus, states not relevant to the complete string are added to the finite automaton.

[0554] For example, in Fig.48B and Fig.48C In a finite automaton, there is a transition from state 0 to state 1. In a complete finite automaton, there is a transition from state 0 to state 1. Fig.48D It may become apparent that the transition is replaced by the intermediate state 110, and the transition sequence includes a transition between state 1 and state 110 and another transition between state 110 and state 1. As another example, in Fig.48B and Fig.48C In the finite automaton of , there is a transition that leaves state 0 and ends in state 10. In the complete finite automaton, this transition is replaced by the intermediate state 110, and the transition sequence includes a transition between state 1 and state 110 and another transition between state 110 and state 10. As a third example, in Fig.48B and Fig.48C In the finite automaton in, there is a transition that leaves state 0 and ends in state 14. In the complete finite automaton, this transition is replaced by intermediate states 110 and 111 and two transition sequences. The first transition sequence includes a transition between state 1 and state 110 and another transition between state 110 and state 14. The second transition sequence includes a transition between state 1 and state 111 and another transition between state 111 and state 14.

[0555] Each of the M transitions in the sequence is associated with an intermediate encoding consisting of or represented by a bitmap whose length and / or format is equal to the bitmap included by the parent node of the matching trie, and wherein the matching trie is derived from a complete finite automaton. This encoding is referred to here as "intermediate" because it represents only a portion of the encoding of the entire character, from which, in the example of a complete finite automaton, Fig.48D The matching trie is half of the encoding of the entire character.

[0556] For example, in can be derived from Fig.48D In the complete finite automaton matching the trie of , the transitions between state 0 and state 110 are associated with an encoding consisting of or represented by the following bitmap:

[0557] 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0010

[0558] In hexadecimal, this corresponds to 0x0000000000000002. The association of this code with the transition between states 0 and 110 is indicated by the upper dashed arrow between the codes 2001 of the transition. The "1" pointed to by the arrow represents the transition between Fig.48D The parent node 0 of the matching trie includes bit number 1 (the second bit) in the bitmap.

[0559] As another example, in the case where it can be derived Fig.48D In the complete finite automaton matching the trie of , the transitions between state 0 and state 111 are associated with an encoding consisting of or represented by the following bitmap:

[0560] 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 1111 1111 1111 1111

[0561] In hexadecimal notation, this corresponds to 0x000000000000FFFF. The association of this code with the transition between states 0 and 111 is indicated by the upper dashed arrow between the transition codes 2002. The "0, 2 ... 63" to which the arrow points represents the transition between states 0 and 111. Fig.48D The parent node 0 of the matching trie includes bit numbers 0, 2, ... 63 (first, third, ... 64th bits) in the bitmap.

[0562] In the case where a transition between two states of a finite automaton is associated with a specific character, the concatenation of the bitmaps comprised or represented by the intermediate encodings associated with the sequence of M transitions is the encoding of the specific character, with exactly one bit being set in each of the bitmaps.

[0563] exist Fig.48B and Fig.48C In the example of a finite automaton of , the transitions between states 0 and 1 are associated with the character "a". Therefore, in Fig.48D In the complete finite automaton of the matching trie, the concatenation of bitmaps represented by the intermediate encoding associated with the two transitions between states 0 and 1 (via state 110) is the encoding of the character "a" where exactly one bit is set in each of the bitmaps. This encoding is as follows:

[0564] 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0010

[0565] and

[0566] 0000 0000 0000 0000 0000 0000 0000 0010 0000 0000 0000 0000 0000 0000 0000 0000 0000

[0567] In hexadecimal representation, this corresponds to 0x0000000000000002 and 0x0000000200000000.

[0568] If a transition between two states of a finite automaton is associated with a wildcard character, then the concatenation of the bitmaps comprised or represented by the intermediate encodings associated with the M transitions of the sequence comprises an encoding in which the bits of all valid character encodings are set in the bitmap comprised or represented by the encoding, or in which the bits of all valid character encodings are set except the encoding of a specific character associated with the state left by the transition.

[0569] exist Fig.48B and Fig.48C In the example of a finite automaton of , the transition between states 0 and 14 is associated with a wildcard. Therefore, in the Fig.48D In the complete finite automaton of the matching trie, the concatenation of the bitmaps represented by one of the sequences of intermediate codes associated with the two transitions between states 0 and 14 (via state 111) is the encoding of the wildcard. This encoding is as follows:

[0570] 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 1111 1111 1111 1111

[0571] and

[0572] 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111

[0573] In hexadecimal representation, this corresponds to 0x000000000000FFFF and 0xFFFFFFFFFFFFFFFFFFFF.

[0574] Furthermore, in the case where a transition between two states of a finite automaton is associated with a wildcard character, the concatenation of bitmaps comprised or represented by the intermediate encodings associated with the M transitions of the sequence will typically include one or more encodings comprising one or more portions of an encoding for a particular character and one or more portions of an encoding in which the bits of all valid character encodings are set in the bitmap comprised or represented by the encoding, or the bits of all valid character encodings except the encoding for the particular character associated with the state left by the transition.

[0575] For example, in the Fig.48D In the complete finite automaton of the matching trie, the concatenation of the bitmaps included or represented by one of the sequences of intermediate codes associated with the two transitions between states 0 and 14 (via state 110) is an encoding that includes the first part of the encoding of the character "a" (which is also the first part of the encoding of the character "b") and the second part of the encoding of the wildcard. The encoding is as follows:

[0576] 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0010

[0577] and

[0578] 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111

[0579] In hexadecimal representation, this corresponds to 0x0000000000000002 and 0xFFFFFFFFFFFFFFFFFF.

[0580] An enhanced finite automaton or a complete finite automaton can be represented by or stored in a data structure comprising a plurality of rows, each row representing a state of the enhanced finite automaton or the complete finite automaton, and comprising a tuple for each of the transitions leaving the state, each tuple comprising an encoding associated with the transition and a reference to the end state of the transition. Fig.48E shows such a data structure as an array of arrays, which can be used to represent the state of a complete finite automaton, from which states can be derived in a particularly efficient way Fig.48D Such a data structure may include, for each state that a transition ends in, information about whether the state is a matching state, preferably encoded as a bit in each reference to the state. The data structure typically includes a row for each of the states of the respective augmenting finite automaton or complete finite automaton from which the transition leaves.

[0581] The benefit of this (virtual) matching trie approach is good performance due to the simplicity of implementation which leads to efficient execution, since no complex state machines etc. need to be used, and also due to the way the AND operator works on the bitmap in the preferred embodiment.

[0582] Indexing methods and performance measurements

[0583] In order to measure the performance of range queries according to various embodiments of the present invention, experiments were conducted, the results of which will be referred to below. Figures 53 to 70F A geolocation application with spatial queries is used as an example. The sample data is derived from OpenStreetMap data for the European region, which can be obtained from http: / / download.geofabrik.de / europe.html. Each entry in the sample database contains a 10-digit ID, a value for each latitude and longitude with seven places after the decimal point, and a string representing the street name and house number.

[0584]

[0585] The first experiment was conducted to see how the index size (number of indexed records) affects query processing performance for constant result size. The database was queried to return the IDs of all locations within a small rectangle in the Munich area (longitude 11.581981+ / -0.01 and latitude 48.135125+ / -0.01, as Fig.49The database contained approximately 28.5 million records in total, and 3,143 of them matched.

[0586] For the first series of measurements, matching records are loaded first, and then approximately 28.5 million additional records are added to the database. These additional records are in Fig.50 This is shown as the shaded area in . For every 100,000 records added, a query was run and its execution time was measured. Clearly, each query returned 3,143 matches.

[0587] For the second series of measurements, matching records within the rectangle were also loaded first, but the remaining records were loaded in the absence of records within the "band" of matching longitude or latitude. Fig.51 The remaining records loaded in the second series of measurements are shown in .

[0588] The first experiment was conducted on five different methods of indexing and querying geolocation.

[0589] In the prior art approach, the SpatialPrefixTree of the Apache Lucene 6.0.1 database engine, called "Prior Art Index", is used here, which supports spatial indexes combining longitude and latitude (https: / / lucene.apache.org, package org.apache.lucene.spatial.prefix.tree). SpatialPrefixTree is not a trie, but is used to create an inverted index optimized for spatial queries. Therefore, it provides a good baseline for the approach taken here.

[0590] To query all locations within a specified rectangle, range queries are performed in both dimensions. Each query returns a collection of IDs representing records located in the specified longitude or latitude band, which are collected by cursor-based iterators to create temporary result sets. The temporary result sets are intersected to obtain the final result set. Fig.52 , where the shaded area marks the specified longitude and latitude bands (temporary result set) and the black area marks the specified rectangle (final result set). SpatialPrefixTree is not a trie, but is used to create an inverted index optimized for spatial queries. By creating several indexes for several resolution levels, query performance can be enhanced, similar to the variable precision index of trie, which will be referenced below. Figures 58 to 60 Explain it.

[0591] Fig.53The measurement results of the prior art method are shown. The x-axis indicates the number of records loaded into the database and the y-axis indicates the number of queries executed per second in a logarithmic scale. It can be observed that the query performance decreases as the number of records in the database increases, both with and without matching bands loaded into the database. This performance behavior is typical for prior art databases, where the access time depends on the fill level of the index.

[0592] A first method of indexing and querying geographic locations using the preferred embodiment of the trie described above is made, which is referred to herein as a "standard index." A latitude index is created by means of the first two-dimensional trie of the preferred embodiment, and another longitude index is created by means of the second two-dimensional trie of the preferred embodiment. In other words, each of the two-dimensional index tries stores two items, namely (latitude, ID) or (longitude, ID). The two-dimensional index trie is stored in a non-interleaved manner, as shown above. Fig.44 The trie is shown in FIG. 1 , where the latitude / longitude forms the first key and the ID forms the second key. From an abstract point of view, this results in a trie containing all latitude / longitudes, where each leaf node is the root node of the trie containing the IDs of all locations with the corresponding latitude / longitude, such as Fig.54 As shown in .

[0593] A range query on the first key (latitude / longitude) returns the trie root node with the ID of the location that matches the latitude / longitude. To deliver these results using the trie interface, the list of trie root nodes is combined using the multiple OR operator provided by the trie interface, such as Fig.55 Therefore, Fig.56 As shown in FIG. 1 , a standard index according to the present invention uses two index tries 5601, 5603, each of which has two keys: (latitude, ID) or (longitude, ID). For the first key of the trie, a range query is performed using a virtual latitude / longitude trie 5602, 5604. The results of each of the range queries are combined using multiple OR operators 5605, 5606. The results of the two multiple OR operators are combined using an AND operator 5607, which delivers the final result.

[0594] Fig.57 The measurement results for the standard index are shown. It can be observed that the query processing time is constant in the case where no matching records are loaded into the database, due to the fact that the trie has a constant access time, i.e., independent of its filling level. The query processing time is also about 10 times shorter than that using the state-of-the-art approach, which is quite significant, given that the SpatialPrefixTree of the Lucene database engine is optimized for spatial queries.

[0595] As matching records are loaded into the database, query performance of the standard index degrades because more and more independent latitude and longitude query results must be combined. The performance of the standard index with matching records is not very good because of the long list of nodes (IDs). To improve performance, the number of nodes that must be combined by OR operations needs to be reduced.

[0596] In an approach referred to herein as "variable precision indexing", the number of nodes that need to be ORed can be significantly reduced by maintaining multiple indexes with variable precision, creating a hierarchy. This is comparable to the concept of creating several indexes for several resolution levels in the prior art database engines mentioned above. For example, using ranges in a trie storing 2-digit decimal numbers, the index at each level can be made to represent a prefix:

[0597] -0, 1, 2, ... 9

[0598] -00, 01, 02, ..., 09, 10, ... 99

[0599] By example, Fig.58 shows the first level index (first key part) of the X value, and Fig.59 The second level index of the X values ​​is shown in , where the second key part (Y term) can be the ID. Fig.58 The entries in the first-level index shown in (the leaf nodes or X items in the first key section) contain all the IDs of the X values ​​in the corresponding prefix range (the trie in the second key section). A query for X ranging from 10 to 53 will combine Fig.58 The query results for the range 1..4 on the index of Fig.59 The query results for the range 50..53 on the index of (one hit, marked by the dashed rectangle). This results in only three nodes having to be combined in the subsequent multiple OR operation, instead of using only Fig.59 The index of the trie is five nodes.

[0600] Actual experiments conducted by the inventors used 6 bits for each precision step. The precision length is stored in the first byte of the key. The trie has 11 levels, and a node in the trie has at most 16 child nodes at the root node level and at most 64 child nodes at the subsequent 10 levels (including leaf nodes). This means that for the left and right parts of the trie that must be ORed, there are at most 16-2 nodes at the root node level and 2*(64-1) nodes at the next level. This results in an upper limit of 16-2+2*(64-1)*10=1274 tries that must be ORed. Each key value that is subject to range queries is stored at 11 precision levels. As described above, range queries based on virtual range tries are used to perform queries. A list of all keys required to select the desired node is created.

[0601] Fig.60 Measurement results for a variable precision index are shown. When no matching segments are loaded, the query executes very quickly (about 10 times faster than when using a standard index) and in constant time. Even when matching records are loaded into the database, the query performance is almost constant. However, as will be shown below, variable precision indexes are expensive in terms of memory requirements and index performance.

[0602] Another approach to indexing and querying geographic locations (referred to in this article as "two-dimensional indexing") shows that there is a faster solution than standard indexing, but without the disadvantages of variable precision indexing. In this approach, Fig.61 As shown in , the longitude / latitude and ID of the database entry are stored in an interleaved trie, which has the structure discussed above, for example, with reference to Fig.32 and Fig.46 . Just like standard indexing, latitude and longitude are indexed separately in two different tries, namely trie 6110 (longitude, ID) and trie 6120 (latitude, ID).

[0603] To query for rectangles, a virtual range trie 6130 specifying a longitude range and a virtual range trie 6140 specifying a latitude range are created. When the longitude index is intersected with the longitude range trie, and the latitude index is intersected with the latitude range trie, the intermediate results of the intersection are combined, as will be explained below.

[0604] In the first step, a bitwise AND operation is performed between the root node 6111 of the longitude index trie 6110 and the bitmap of the root node of the longitude range trie 6130, as shown by Fig.61Similarly, a bitwise AND operation is performed between the root node 6121 of the latitude index trie 6120 and the bitmap of the root node of the latitude range trie 6130, as indicated by Fig.61 Indicated by arrow 6152 in .

[0605] Fig.61 Nodes 6112 and 6122 in represent nodes on level 2 of index tries 6110 and 6120. Each of these nodes on level 2 is a root node of an ID key portion in the index. Thus, a bitwise AND operation between the root node 6111 of the longitude index trie 6110 and the bitmap of the root node of the longitude range trie 6130 produces a first key portion of an ID belonging to a location having a specified longitude range, and a bitwise AND operation between the root node 6121 of the latitude index trie 6120 and the bitmap of the root node of the latitude range trie 6140 will produce a first key portion of an ID belonging to a location having a specified latitude range.

[0606] In the second step, the keys in the index trie that do not belong to locations falling within the specified longitude and latitude range are filtered as follows: the bitmaps of the nodes of the longitude / latitude index trie 6110 / 6120 produced by the first step are combined by a bitwise OR operation, and a bitwise AND operation is performed between the results of the bitwise OR operation, as determined by Fig.61 Indicated by arrow 6153 in .

[0607] Fig.61 Nodes 6113 and 6123 in the index trie 6110 and 6120 represent nodes at level 3 of the index trie 6110 and 6120. Each of these nodes at level 3 stores the second key portion of the longitude / latitude key portion stored in the index trie. The operation in the third step continues, and the nodes at level 3 belong to the keys that have not been filtered out in the second step. As shown by Fig.61 As indicated by arrows 6154, 6155 in , a bitwise AND operation is performed between these nodes and the bitmaps of the corresponding nodes (on level 2) of the corresponding range tries 6130, 6140.

[0608] Fig.61Nodes 6114 and 6124 in the index trie 6110 and 6120 represent nodes on level 4 of the index trie 6110 and 6120. Each of these nodes on level 4 stores the second key portion of the ID key portion stored in the index trie. The operation in the fourth step continues, and the nodes on level 4 are generated as a result of the bitwise AND operation in the third step. Similar to the second step, the bitmaps of the nodes of the longitude / latitude index trie 6110 / 6120 having the same parent node generated by the first step are combined by a bitwise OR operation, and a bitwise AND operation is performed between the corresponding results of the bitwise OR operation, as shown by Fig.61 Indicated by arrow 6156 in .

[0609] The operation continues in the same way until a leaf node of the index trie is reached. In summary, two indexes are combined using a matcher, which returns a "view" with alternating indices of the first dimension (x) only. The second dimension is suppressed in the output of the matcher.

[0610] Fig.62 The measurement results for the two-dimensional index are shown. Again, when no matching segments are loaded into the database, the query time is constant. In the case where matching segments are loaded into the database, the query performance is significantly improved compared to the standard index.

[0611] The strategy of matching and suppressing dimensions can in principle be applied to more than two dimensions. However, this results in very large node chains: each node in the x dimension may have 64 child nodes in the y dimension, which in turn may have 64 child nodes, for a total of 4096 child nodes.

[0612] In the last approach to indexing and querying geographic locations (referred to in this article as a "single-dimensional index"), only one multidimensional index is created that stores both longitude and latitude in an interleaved trie, as discussed above, for example, referring to Fig.32 and Fig.46 The schematic diagram of the index trie is in Fig.63 , where the first key X and the second key Y representing the longitude and latitude are stored in an interleaved manner, and the third key representing the ID of the location is stored in a sub-trie, which depends on the leaf node of the X / Ytrie. Each ID stored in the sub-trie belongs to a set of locations with the same longitude and latitude.

[0613] To query the rectangle, as described above, for example, refer to Fig.40 , perform a two-dimensional range query. Fig.64, the range of longitude is specified by a first one-dimensional virtual range trie 6402, and the range of latitude is specified by a second one-dimensional virtual range trie 6403. The two one-dimensional range tries are combined by an interleave operator 6404 to form an interleaved two-dimensional range trie. In order to obtain the set of ID subtries belonging to matching longitudes and latitudes, an AND operator 6405 performs an intersection between the two-dimensional range trie and the X / Y portion of the index trie 6401.

[0614] Fig.65 The measurement results for a single-index index are shown. It can be observed that the single-index index provides perfect scalability and the query performance does not significantly depend on the number of records in the database even when the matching bands are loaded. Note that the peak in performance is caused by the Java virtual machine garbage collection.

[0615] Fig.66 Results of a second experiment are shown, where query performance (queries per second) was measured on increasing result sizes. The latitude and longitude of the query rectangle increased from + / - 0.01 to + / - 0.20 degrees. First, 28.5 million records were loaded into the database. It can be observed that the variable precision index scales best for larger results (note that only a portion of the data can be loaded for the variable precision index due to memory limitations). The single-index index also provides good performance. This is especially true when the IDs are stored in an interleaved manner in addition to the latitude and longitude. It is believed that the performance gain of the triple-interleaved index is caused by the increase in the number of common prefix paths, which is also evidenced by the smaller memory footprint (46.01 vs. 44.76 bytes / point). Performance may be better due to fewer branches in the tree, which may result in fewer recursive steps to traverse the tree.

[0616] The prior art indexing using the Lucene database delivered nearly constant results for all result sizes, but the performance level was lower than the indexing with a single index. For smaller result sizes, the performance of the standard index (the two indexes are not interleaved) and the two-dimensional index (the two indexes are interleaved) was better than the prior art indexing using the Lucene database, but for larger result sizes, the performance was worse. Fig.67 Shown with Fig.66 The same results, but with a logarithmic scale on the x-axis. In this representation, it can be seen that the query performance of the index according to the invention decreases linearly as the result size increases. This means that in particular the two single-index approaches have linear scalability, i.e. doubling the result size doubles the query time.

[0617] In the third experiment, the indexing performance (entries indexed per second) was measured. 28.5 million records were loaded and the time was measured every time 100,000 records were added. It can be observed that the state-of-the-art index and all trie-based approaches provide almost constant performance with respect to index growth. The results are summarized in Fig.68 As mentioned above, variable precision indexing performs poorly because 2 x 11 index entries must be created for each record. The prior art index (Lucene) whose approach is similar to variable precision indexing performs even worse. Both the standard trie-based index and the two-dimensional index create 2 index entries per record and therefore have similar indexing performance. The trie-based index creates only one index entry per record and performs best. Note that in the trie-based approach, the black columns represent the results of the uncompressed trie and the light columns represent the results of the trie using bitmap compression.

[0618] Fig.69 The memory space required for different indexes per index position is compared. The state-of-the-art Lucene index uses more space than a standard trie-based index and a two-dimensional index with bitmap compression (light columns) and a single index even without bitmap compression. The trie-based variable precision index requires more space than any other approach.

[0619] It can be concluded that for attributes with low or medium cardinality, standard indexes work well enough. For example, product prices typically do not have a continuous value space, but rather discrete values ​​like 3.99, 4.49, 4.89, etc. Instead of storing something like an order date as a timestamp with millisecond precision, it can be stored with day or hour precision to meet the requirement of making the value space "more" discrete. To index columns with a continuous value space, variable precision indexes offer better performance, especially if used in multidimensional queries. However, due to the slow indexing speed and high memory requirements, variable precision indexes can only be recommended for static applications and when sufficient memory is available. For tightly coupled dimensions, a single index is the best solution for medium expected result sizes.

[0620] Even though multidimensional indexes have been proposed here in the context of spatial queries, trie-based range queries can be applied to many other situations, such as for graph databases. Property graph databases are based on nodes connected by edges, and both nodes and edges have properties. If nodes and edges are each represented by a unique ID, node-edge-node triples can be represented and queried using these three IDs as dimensions. Note that the same applies to the context of Resource Description Framework (RDF) and its subject-predicate-object expressions, called triples in RDF terminology.

[0621] As mentioned above, by storing each occurrence of a term and a document ID as two key parts (string, long), the present invention can also be easily used in full-text search applications. Since the present invention is based on a prefix tree, it inherits the string search functionality of the prefix tree. For example, it can be used to effectively implement fuzzy (similar) searches.

[0622] Indeed, measurements performed by the inventors show competitive performance in information retrieval applications.In experiments performed shortly before the priority date of the present application, 500,000 English Wikipedia articles were indexed. Fig.70A The average indexing performance of an embodiment of the present invention in characters per second compared to the Lucene information retrieval software library is shown. It can be seen that when using arrays of long integers (black columns), the system of the present invention delivers only slightly lower indexing performance. As expected, when using bitmap compression with byte arrays (light columns), the indexing performance is slightly reduced.

[0623] Fig.70B Index sizes are compared (index size / text size in %). Surprisingly, even the memory model based on long integer arrays (black columns) is comparable to Lucene - despite the alignment loss. The memory model based on bitmap compression and with byte arrays (light columns) requires less space than Lucene.

[0624] Fig.70C Query performance (queries / second) is shown. The term query in this experiment searches for all documents containing the words "which" or "his" combined with "from" to provide a certain complexity and quantity. Using multiple concurrent threads, the performance of the system of the present invention is up to seven times higher than that of Lucene.

[0625] The fuzzy query in this experiment searches for documents containing words similar to "chica". Similarity is defined by an edit distance (Levenshtein distance) of 1, i.e., at most one character is deleted, inserted, and replaced. In this discipline, the invented system was shown to be four to six times faster than Lucene. It is noteworthy that both Lucene and the invented system delivered exactly the same number of result documents: 319,809 for the term query and 30,994 for the fuzzy query.

[0626] Shortly before the filing date of the present application, i.e., about one year later, the experiment described above was repeated. The results of the repeated experiment can be found in FIG. 70D to FIG. 70F middle.

[0627] from Fig.70DAs can be seen in the results, the indexing performance is now lower than in the previous experiments. In the system of the present invention, it is lower because memory management is now fully implemented, at the expense of some performance. In the Lucene system, it is lower because the Lucene index is only run on one thread / CPU core. This is done to get better comparability, since the system of the present invention was also implemented with only one thread / CPU core. Note that the indexing of the system of the present invention can also be parallelized, but the inventors have not yet implemented it.

[0628] Fig.70E It is shown that the index size remains virtually unchanged compared to earlier experiments.

[0629] Fig.70F It is shown that the query performance of the system of the present invention is improved compared with the earlier experiments, especially in fuzzy search. In the earlier experiments, only the pre-generated Fig.48C A DFA is shown that includes only the nodes corresponding to the states associated with the full string. Fig.48D The intermediate states (states of the finite automaton not associated with a complete string) shown in exist due to the fact that character encodings require two or more key parts, which are determined dynamically on the fly during the intersection operation. In contrast, in the following experiments, the finite automaton with the complete set of states and transitions is pre-generated and stored as an array of arrays (matrices), as shown in Fig.48E This approach improves query performance by about a factor of two. The Lucene system has similar improvements compared to earlier experiments, which is due to certain optimizations made to the Lucene system between the priority date and the filing date of this application.

Claims

1. A method for retrieving data from an electronic database or information retrieval system, comprising the following steps: Get the definition of one or more ranges; Obtaining two or more input tries, each input trie storing a key set stored in the electronic database or information retrieval system or a result key set of an electronic database or information retrieval system query; combining the input tries using logical operations to obtain sets of keys associated with nodes of a result trie; and providing as output a set of keys or other data items associated with nodes of the result trie, or a subset of keys or other data items associated with nodes of the result trie, or a set of keys or a set of values ​​derived from keys associated with nodes of the result trie; in, A trie includes one or more nodes, each child node is associated with a key portion, and a path from a root node in the trie to another node defines a key associated with the node, the key being a concatenation of the key portions associated with the nodes on the path; The subnode set of each node in the result trie is a combination of the subnode sets of the corresponding nodes in the input trie using the logical operation; and Two or more nodes of different tries correspond to each other if the keys associated with the nodes of different tries are the same; One of the input tries is an input set trie that stores a set of keys to be searched for the one or more ranges or a set of result keys; another input trie is a range trie that stores all values ​​included in the one or more ranges for which the definition has been obtained; and the logical operation is an intersection; The range trie is a virtual trie that is dynamically generated during an operation to combine the input tries, the portion of the virtual trie being dynamically generated that is necessary to combine the input tries using the logical operation.

2. The method according to claim 1, wherein: The set of keys provided as output is provided in a trie.

3. The method according to claim 1, wherein: The keyset provided as output is provided by a cursor or iterator.

4. The method according to any one of claims 1 to 3, wherein: The steps of combining the input trie include: Executing a combining function on the root node of the result trie; Wherein, executing the combination function on the input node of the result trie includes: determining a set of child nodes of an input node of the result trie by combining sets of child nodes of a node of the input trie corresponding to an input node of the result trie using the logical operation; and The combining function is performed on each of the child nodes determined for the input node of the result trie.

5. The method according to any one of claims 1 to 3, wherein: The step of combining the input tries is performed using a depth-first traversal, a breadth-first traversal, or a combination thereof.

6. The method according to claim 5, wherein: The step of combining the input trie in a depth-first traversal includes executing a combining function on one of the child nodes of the input node and traversing a subtrie formed by the child node before executing the combining function on a next sibling node of the child node.

7. The method according to claim 5, wherein: The step of combining the input trie in a breadth-first traversal includes: executing a combining function on each of the child nodes determined for the input nodes of the result trie, and determining a child node set for each of the child nodes determined for the input nodes of the result trie before executing the combining function on any grandchild nodes of the input nodes of the result trie.

8. The method according to any one of claims 1 to 3, wherein: The nodes in the input trie consist of bitmaps.

9. The method according to claim 8, wherein: The value of the key portion of a child node in a trie is determined by the value of the bit set in the bitmap included by the child node's parent node, depending on which bit the child node is associated with.

10. The method according to claim 8, wherein: The combining of the child nodes of the input trie using the logical operation includes combining the bitmap of each of the child nodes of the input trie using the logical operation.

11. The method according to any one of claims 1 to 3, wherein: The logical operation is intersection, union, difference or XOR.

12. The method according to claim 11, wherein: Using the logical operation includes combining using an AND Boolean operator, an OR Boolean operator, or an XOR Boolean operator.

13. The method according to claim 8, wherein: Using the logical operation includes combining the bitmaps of the nodes using a bitwise AND Boolean operator, a bitwise OR Boolean operator, a bitwise AND NOT Boolean operator, or a bitwise XOR Boolean operator.

14. A computer program product comprising instructions which, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 13.

15. A data processing apparatus or system comprising one or more processors and a memory, the data processing apparatus or system being configured to perform the method of any one of claims 1 to 13.