An attribute handle execution method, system, device and storage medium
By converting attribute values in the graph database into attribute handles of uniform width and performing vectorized operations, the problem caused by heterogeneous attribute types in weak mode is solved, processing efficiency is improved, memory bandwidth waste is reduced, and flexibility is maintained.
Patent Information
- Application Number
- CN202611403526.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-10
- Publication Date
- 2026-11-27
AI Technical Summary
In a weakly patterned design, graph databases suffer from several problems: heterogeneous attribute types lead to the failure of columnar batch processing; data bloat and high serialization overhead in intermediate representations between operators; and full loading of attribute values results in wasted memory bandwidth and cache pollution.
The heterogeneous attribute values of vertices to be processed in the weak pattern graph database are converted into attribute handles of uniform width. The attribute handles are used as intermediate representations between operators to generate type-specialized execution code, parse attribute values as needed, and perform vectorized operations using attribute handles.
It solves the problems of columnar batch processing failure caused by heterogeneous attribute types and intermediate representation data bloat between operators, avoids memory bandwidth waste and cache pollution caused by full loading of attribute values, and maintains the flexibility of weak mode.
Smart Images

Figure CN123178692A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of graph databases, specifically to an attribute handle-based execution method, system, device, and storage medium. Background Technology
[0002] Graph databases, with their inherent ability to express relationships, are widely used in scenarios such as social network analysis, financial risk control, and knowledge graphs. Unlike relational databases, graph databases generally employ a weak-mode design, meaning that different vertices under the same label can have different numbers and types of attributes, and the attribute types are determined when data is written, rather than being fixed at schema definition time. This flexibility is the core advantage of graph databases, but it also brings structural difficulties to the performance optimization of the execution engine. Specifically, existing technologies have the following problems: I. Heterogeneous Attribute Types Cause Columnar Batch Processing to Fail. Modern high-performance execution engines widely employ columnar processing and vectorized execution techniques. Their core premise is that data within the same column has the same type and fixed width, enabling parallel operations on batch data using Single Instruction Multiple Data (SIMD) instructions and fully utilizing CPU cache prefetching and data locality. However, in weak mode, the same attribute name for different vertices with the same label may correspond to different types. When processing a batch of vertices, the execution engine cannot guarantee type isomorphism and can only degenerate into row-by-row type checking and branch processing. SIMD acceleration completely fails, CPU branch prediction fails extensively, and performance degrades drastically.
[0003] Second, the data bloat and high serialization overhead of intermediate representations between operators. In the volcano model or batch processing model of graph databases, intermediate results need to be passed between operators. When the intermediate results contain complete heterogeneous attribute values, each transmission involves copying variable-length data, memory allocation, and carrying type information. In distributed graph traversal scenarios, operators may span multiple physical nodes, further amplifying the network serialization and deserialization overhead of heterogeneous attribute values. Even if the attribute is not actually used in subsequent processing, it still needs to be packaged with type tags, length prefixes, and the actual data.
[0004] Third, loading all attribute values leads to wasted memory bandwidth and cache pollution. During query execution, the vertices read by the scanning operator may undergo multiple layers of filtering, joining, and aggregation before entering the final result set. If all attribute values are loaded during the scanning phase, a large amount of data that will be filtered out later will occupy memory bandwidth and CPU cache space. This waste is even more severe when the attribute values contain variable-length data such as long text or large binary objects. Summary of the Invention
[0005] To address the problems arising from the weak-mode design of graph databases, such as attribute type heterogeneity leading to columnar batch processing failure, data bloat and high serialization overhead in intermediate representations between operators, and memory bandwidth waste and cache pollution caused by full attribute value loading, this invention proposes an attribute handle-based execution method for weak-mode graph databases, including: S1, convert the heterogeneous attribute values of the vertices to be processed in the weak pattern graph database into attribute handles of uniform width. The attribute handles are used to identify the attribute values and the data structure type information of the attribute values. S2, using the attribute handle as an intermediate representation between operators, the operators perform vectorized operations on batch attribute handles in the intermediate representation layer; S3, Generate type-specific execution code for the current processing batch based on the original data type in the attribute handle; Specifically, when the operator needs to use actual attribute values or needs to output query results, i.e. in the middle or at the end of the step, the attribute values corresponding to the attribute handle are parsed as needed, and the parsed attribute values are discarded after the corresponding operation is completed.
[0006] Furthermore, the data structure type information of the attribute value includes: A type marker field is used to encode the original data type of the attribute value and the storage mode of the attribute handle; A size hint field, which provides a size level hint for the attribute value; The payload field is used to carry the attribute value or its storage location information.
[0007] Furthermore, in step S2, the vectorization operation includes at least one of the following operations: The filtering operation uses the size hint field to filter the batch attribute handles, determines the attribute handles that do not meet the filtering conditions, and then groups the attribute handles that pass the filtering according to the type tag field, and performs SIMD batch comparison on each group. The sorting operation involves grouping the batch attribute handles according to the type tag field, sorting them within the same type group according to the storage location information of the payload field, and using a SIMD sorting network to compare and exchange multiple attribute handles in parallel within a register. The hash operation uses the attribute handle as the hash table key and employs SIMD instructions to calculate hash values in parallel for a batch of attribute handles.
[0008] Furthermore, the storage modes include inline mode, local offset mode, and cache key mode; In inline mode, the payload field directly encodes the attribute value; In local offset mode, the load field encodes the offset of the attribute value in the local attribute storage file; In cache key mode, the payload field encodes the index position of the attribute value in the attribute cache pool.
[0009] Furthermore, the on-demand parsing includes: Collect the attribute handles that need to be parsed in the current batch, group them by storage mode, among which, Inline mode, the attribute handle directly extracts the attribute value from the payload field; The local offset mode attribute handles are sorted by offset and then pre-read in batches from the local attribute storage file; In cache key mode, the property handle is located directly in the property cache pool.
[0010] Furthermore, the attribute cache pool stores attributes according to their original data types, including: Attribute values of the same type are stored contiguously in the corresponding attribute cache pool, while variable-length attribute values are managed in memory using the Slab allocator.
[0011] Furthermore, based on the historical access statistics of the query template, the attribute cache pool preloads high-frequency attribute values into the corresponding attribute cache pool before executing the query.
[0012] Furthermore, the attribute cache pool determines whether to retain the cache based on the reuse distance prediction of the attribute value. The reuse distance prediction is an exponentially weighted moving average estimate of the number of intermediate references between two adjacent references in historical queries of the same type.
[0013] Furthermore, step S3 includes: The system detects the primitive data type in the attribute handle of the current batch. When the primitive data types in the batch are completely identical, it triggers JIT compilation to generate specialized operator code for that type, and the type judgment branch is compiled into an unconditional jump. When the primitive data types in the batch are not completely identical, the batch is first divided into several isomorphic sub-batches according to the primitive data types, and then the corresponding specialized code is generated for each isomorphic sub-batch.
[0014] Accordingly, this invention also proposes an attribute handle-based execution system for weakly schemated graph databases, used to execute the above methods, including: The attribute handle conversion module is used to convert the heterogeneous attribute values of the vertices to be processed in the weak pattern graph database into attribute handles of uniform width. The attribute handle is used to identify the attribute value and the data structure type information of the attribute value. The vectorized operation module is used to use the attribute handles as an intermediate representation between operators, so that the operators perform vectorized operations on a batch of attribute handles in the intermediate representation layer. The type-specialized execution code generation module generates type-specialized execution code for the current processing batch based on the original data type in the attribute handle. The attribute value parsing module parses the attribute value corresponding to the attribute handle as needed when the operator needs to use the actual attribute value or needs to output the query result, and discards the parsed attribute value after the corresponding operation is completed.
[0015] The present invention also proposes an electronic device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the method described in any one of the above.
[0016] The present invention also proposes a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any one of the above.
[0017] Compared with the prior art, the advantages of the present invention are as follows: This invention converts heterogeneous attribute values into attribute handles of uniform width and uses these handles as intermediate representations between operators, solving the problems of columnar batch processing failures caused by heterogeneous attribute types and data bloat in intermediate representations between operators. Type-specialized execution code is generated based on the original data type. Attribute values are parsed and discarded as needed when operators require actual attribute values or output query results, avoiding memory bandwidth waste and cache pollution caused by full attribute value loading. Furthermore, it does not restrict types or lose information, maintaining the flexibility of the weak mode. Attached Figure Description
[0018] Figure 1 This is a flowchart illustrating the steps of an attribute handle-based execution method for weakly schema graph databases according to the present invention. Figure 2 This invention presents a composition diagram of an attribute handle-based execution system for weakly schema graph databases. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the various embodiments of this application will be described in detail below with reference to the accompanying drawings. However, those skilled in the art will understand that many technical details have been presented in the various embodiments of this application to enable the reader to better understand this application. However, the technical solutions claimed in this application can be implemented even without these technical details and various changes and modifications based on the following embodiments.
[0020] In the following description, certain specific details are set forth for the purpose of illustrating various disclosed embodiments in order to provide a thorough understanding of the various disclosed embodiments. However, those skilled in the art will recognize that embodiments may be practiced without one or more of these specific details. In other instances, well-known apparatuses, structures, and techniques associated with this application may not have been shown or described in detail to avoid unnecessarily obscuring the description of the embodiments.
[0021] Unless the context requires otherwise, throughout the specification and claims, the word “comprising” and its variations, such as “including” and “having”, shall be understood to have an open, inclusive meaning, that is, to be interpreted as “including, but not limited to”.
[0022] Throughout this specification, references to "an embodiment" or "an embodiment" indicate that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment. Therefore, the appearance of "in an embodiment" or "an embodiment" in various places throughout the specification does not necessarily refer to the same embodiment. Furthermore, a particular feature, structure, or characteristic may be combined in any manner in one or more embodiments.
[0023] A weakly patterned graph database refers to a graph database in which different vertices under the same label can have different numbers and types of attributes. The type of attribute value is determined when the data is written rather than when the pattern is defined. When the execution engine processes a batch of vertices, it cannot guarantee type isomorphism and it is difficult to process batches of data under the same attribute name by column.
[0024] To address the problems arising from the weak-mode design of graph databases, this invention proposes an attribute handle-based execution method for weak-mode graph databases, such as... Figure 1 As shown, it includes: S1, convert the heterogeneous attribute values of the vertices to be processed in the weak pattern graph database into attribute handles of uniform width, wherein the attribute handles are used to identify the attribute values and the data structure type information of the attribute values; S2, using the attribute handle as an intermediate representation between operators, the operators perform vectorized operations on batch attribute handles in the intermediate representation layer; S3, Generate type-specific execution code for the current processing batch based on the original data type in the attribute handle; Specifically, when the operator needs to use actual attribute values or needs to output query results, i.e. in the middle or at the end of the step, the attribute values corresponding to the attribute handle are parsed as needed, and the parsed attribute values are discarded after the corresponding operation is completed.
[0025] This invention converts heterogeneous attribute values into attribute handles of uniform width, which identify the attribute values and their data structure type information. The fixed width of the attribute handle, such as 64 bits or 128 bits, no longer directly stores variable-length attribute values; instead, it carries identification information in a uniform width format.
[0026] The data structure type information identified by the attribute handle includes three fields: type marker field, size hint field, and load field.
[0027] The type marker field occupies several bits and is used to encode the primitive data type of the attribute value and the storage mode of the attribute handle. The primitive data type is the actual type determined when the attribute value is written, such as integer, floating-point number, boolean value, string, byte string, etc.
[0028] The size hint field occupies several bits and is used to provide size level hints for attribute values. That is, it tells you the size range to which the attribute value belongs without loading the actual content of the attribute value, such as micro (0~7 bytes), small (8-63 bytes), medium (64-4095 bytes), large (not less than 4096 bytes), etc.
[0029] The payload field occupies the remaining bits and is used to carry the attribute value itself or the storage location information of the attribute value. Its specific meaning is determined by the storage mode in the type marker field.
[0030] The reason for requiring attribute handles to have a uniform width is that only when the data passed between operators has the same width can the execution engine treat a batch of attribute handles as a continuous array of equal width, and then use vectorized instructions to process the entire batch of data in parallel. If variable-length heterogeneous attribute values are used, the length of each data item will be different, making it impossible to access the next element with a fixed step size, and thus making columnar processing and vectorization acceleration impossible.
[0031] The type tag field enables the execution engine to know the original type of the property at any stage. The flexibility of the weak mode is fully preserved at the handle layer. Different types of the same property name on different vertices are faithfully encoded as different type tags, and there is no information loss or type coercion due to the introduction of property handles.
[0032] Based on this, the storage modes of attribute handles include inline mode, local offset mode, and cache key mode.
[0033] In inline mode, the attribute value itself is small enough, such as an integer, floating-point number, boolean value or a very short string prefix of no more than 6 bytes. The payload field directly encodes the attribute value, and subsequent operations can obtain the attribute value without additional loading, thereby avoiding the extra memory allocation and indirect access overhead of small attribute values.
[0034] In local offset mode, the load field encodes the offset of the attribute value in the local attribute storage file. When the attribute value is needed, it can be obtained through a single local input / output or memory mapping access. This mode is suitable for medium-sized attribute values that cannot be inlined, allowing the attribute handle to maintain a fixed width without giving up the ability to access the attribute value.
[0035] In cache key mode, the payload field directly encodes the index position of the attribute value in the attribute cache pool. During parsing, it can be located directly without calculating a hash, making it suitable for frequently accessed hot attribute values. Through these three storage modes, the attribute handle covers storage needs ranging from extremely small to large values while maintaining a uniform width.
[0036] After the attribute handle is constructed in step S1, the operator execution phase of step S2 begins.
[0037] In an execution engine, operators are the basic units that perform specific data processing functions during query execution, including scan operators, filter operators, projection operators, join operators, aggregation operators, and sorting operators. In traditional execution engines, operators pass complete attribute values, while in this invention, operators pass attribute handles. The attribute handle is the intermediate representation of the operator. All operators operate only on the attribute handles at the intermediate representation layer, not on the attribute values themselves, thus solving the problem of data bloat in the representation.
[0038] Based on the uniform width of the attribute handles, the execution engine performs vectorized operations on batch attribute handles in the intermediate presentation layer. The vectorized operations include at least one of filtering operations, sorting operations, and hash operations.
[0039] Filtering operations are performed by filter operators, whose task is to determine whether each piece of data meets the query conditions and retain only the data that does. The query conditions are the predicates. Filtering utilizes size hint fields. Taking the equality comparison predicate as an example, if the size hint fields of two attribute handles are different, it means that the size levels of the two attribute values are different, and their contents must be unequal, so it can be directly determined that the conditions are not met.
[0040] In one embodiment, the filtering condition is that the age attribute of a vertex is equal to the integer thirty, where the integer thirty corresponds to a micro attribute handle size level. However, the age attribute of a certain vertex is actually a string, and its attribute handle size level is small. Therefore, the size hint fields of the two are different, and the vertex can be immediately determined not to meet the condition. For the attribute handles that pass the filtering, the filtering operator further groups them according to the type tag field, grouping attribute handles with the same original data type into the same group, and performing a single instruction multiple data stream (SIMD) batch comparison on each group.
[0041] Filtering and SIMD batch comparison significantly improve filtering and sorting throughput: Taking 64-bit attribute handles and the AVX-512 instruction set as an example, a single 512-bit SIMD register can hold 8 attribute handles, improving throughput by approximately 8 times compared to line-by-line scalar comparison. The comparator is automatically selected by the type flag field of the attribute handle; SIMD integer comparison instructions are used for integer types, SIMD floating-point comparison instructions are used for floating-point types, and short prefixes of string types inlined in the handle can also participate in SIMD comparisons, maximizing cache locality.
[0042] The sorting operation is performed by a sorting operator. The sorting operator first groups the batch of attribute handles according to the type marker field, and then sorts them within the same type group according to the storage location information of the payload field. Grouping by type is necessary because different types of attribute values have different sorting rules; for example, integers are sorted by numerical value, and strings are sorted by lexicographical order. If they were mixed together, the comparison logic would be inconsistent. After grouping, the attribute handles within the same group have the same type and uniform width. A SIMD sorting network is used to compare and exchange multiple attribute handles in parallel within registers.
[0043] Hash operations are performed by join and aggregation operators. These operators build a hash table to accelerate lookups, using attribute handles as the hash table keys. Since attribute handles are of fixed width, the hash function can directly operate on the fixed-width values of the attribute handles, eliminating the need to handle segmented readings of variable-length keys. For batches of attribute handles, SIMD instructions are used to compute hash values in parallel, improving the throughput of hash table construction and probing.
[0044] Based on this, step S3 generates type-specific execution code for the current processing batch according to the original data type in the attribute handle.
[0045] In weak mode, the type of the attribute value corresponding to the same attribute name is uncertain. Traditional execution engines need to perform type checks and branch jumps for each piece of data at runtime, leading to branch prediction failures and performance degradation. To address this, before the execution engine processes a batch of attribute handles, it first checks the original data type of the attribute handles in that batch.
[0046] When the original data types within a batch are found to be completely identical, Just-In-Time (JIT) compilation is triggered to generate specialized operator code for that type. The type judgment branch in the specialized code is compiled into an unconditional jump, meaning that no type judgment is performed at runtime, and the instruction sequence corresponding to that type is executed directly, completely eliminating runtime type dispatch overhead.
[0047] When it is detected that the original data types within a batch are not completely identical, the batch is first divided into several isomorphic sub-batches according to the original data types, and then corresponding specialized code is generated for each isomorphic sub-batch. Although the division introduces a data rearrangement, each sub-batch executes on the specialized path with zero branches, and the overall performance is still better than the branch-by-branch processing of mixed types.
[0048] The type-specialized code generated by JIT compilation is cached in a code cache, using the type marker and operator type of the primitive data type as keys. When subsequent batches encounter isomorphic batches with the same type marker, the already compiled specialized code is reused directly, avoiding duplicate compilation.
[0049] Because attribute handles are of fixed width, the JIT compiler can safely generate specialized code where a batch of attribute handles is strictly contiguous and equally spaced in memory. A single SIMD load instruction can precisely load a known number of handles at once (e.g., AVX-512 loads 512 bits, which is eight 64-bit handles), without needing to handle boundary alignment issues caused by variable-length data. This allows the JIT compiler to generate vectorized code as efficiently as a statically typed columnar storage engine, all built upon the flexible data model of the weakly schema graph database.
[0050] In the intermediate representation layer where operators only manipulate attribute handles, attribute values are never loaded. Attribute values corresponding to attribute handles are only parsed on demand when the operator needs to use the actual attribute values, such as when executing user-defined functions, performing text searches, regular expression matching, or when query results need to be output. The parsed attribute values are then discarded after the corresponding operation is completed.
[0051] The specific process of on-demand parsing is as follows: collect the attribute handles that need to be parsed in the current batch, group them according to storage mode, and process different storage modes separately: Inline mode, the attribute handle extracts the attribute value directly from the payload field without any input / output operations; In local offset mode, attribute handles are sorted by offset and then pre-read in batches from the local attribute storage file. The purpose of sorting is to convert random reads into sequential reads and improve disk read efficiency. In cache key mode, the property handle is directly located in the property cache pool, and the property value can be obtained without calculating a hash.
[0052] A large amount of data that is filtered out during intermediate processing has its attribute values never loaded into memory, thus protecting memory bandwidth and processor cache space.
[0053] To support the aforementioned cache key mode and on-demand parsing for fast access to attribute values, this invention also maintains attribute cache pools that are categorized and stored according to the original data type of the attribute values, such as integer cache pools, floating-point cache pools, boolean cache pools, string cache pools, byte string cache pools, etc.
[0054] Storing attribute values of the same type contiguously allows multiple values of the same type to be loaded in a single cache line prefetch, fully leveraging the advantages of data locality.
[0055] For variable-length types such as strings and byte strings, the Slab allocator is used to manage memory. The Slab allocator is a memory management mechanism that groups objects by size, allocating values of the same size level in the same memory block, reducing memory fragmentation and improving allocation efficiency.
[0056] Building upon this, the attribute cache pool also features a cache preheating mechanism: based on historical access statistics of query templates, frequently accessed attribute values are preloaded into the corresponding attribute cache pool before the query is executed. A query template is an abstraction of queries with the same structure but different parameters. The system records the set of attributes most frequently accessed by each query template in its historical execution. Before the query begins execution, a background thread preloads the frequently accessed attribute values from the attribute storage file into the cache pool, eliminating cold cache input / output latency during query execution.
[0057] Each attribute cache pool maintains an independent eviction list. Since different types of attributes typically have different access frequencies and patterns (e.g., integer IDs are accessed frequently, while long texts are accessed infrequently), the independent eviction strategy avoids the problem of high-frequency small values being squeezed out of the cache by low-frequency large values.
[0058] In addition, the attribute cache pool also improves cache hit rate through adaptive eviction prediction: it determines whether to retain the cache by predicting the reuse distance based on attribute values. Reuse distance refers to the number of intermediate references between two adjacent references of an attribute in historical queries of the same type. Reuse distance prediction estimates the reuse distance of historical observations using an exponentially weighted moving average, assigning higher weights to newer observations and lower weights to older observations.
[0059] In one embodiment, if an attribute is referenced three times in a single query, with five intermediate references between the first and second references and 20 intermediate references between the second and third references, then the observed reuse distance values for this attribute in this query are 5 and 20. By performing an exponentially weighted moving average of the observed values from multiple historical queries, the predicted reuse distance value for this attribute can be obtained. If the predicted reuse distance is short, it indicates that the attribute will be frequently referenced within the query. Even if its most recent access time was early, it should still be retained in the cache to avoid repeated eviction and reloading within the same query.
[0060] Accordingly, this invention also proposes an attribute handle-based execution system for weakly schemated graph databases to implement the above method, such as... Figure 2 As shown, it includes: The attribute handle conversion module is used to convert the heterogeneous attribute values of the vertices to be processed in the weak pattern graph database into attribute handles of uniform width. The attribute handle is used to identify the attribute value and the data structure type information of the attribute value. The vectorized operation module is used to use the attribute handles as an intermediate representation between operators, so that the operators perform vectorized operations on a batch of attribute handles in the intermediate representation layer. The type-specialized execution code generation module generates type-specialized execution code for the current processing batch based on the original data type in the attribute handle. The attribute value parsing module parses the attribute value corresponding to the attribute handle as needed when the operator needs to use the actual attribute value or needs to output the query result, and discards the parsed attribute value after the corresponding operation is completed.
[0061] The present invention also proposes an electronic device, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the method described in any one of the above.
[0062] The present invention also proposes a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any one of the above.
[0063] The solutions provided by the embodiments of this application have been described in detail above. The various embodiments in the specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section. It should be noted that those skilled in the art can make several improvements and modifications to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of the claims of this application.
[0064] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0065] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
Claims
1. An attribute handle-based execution method, characterized in that, include: S1, convert the heterogeneous attribute values of the vertices to be processed in the weak pattern graph database into attribute handles of uniform width, wherein the attribute handles are used to identify the attribute values and the data structure type information of the attribute values; S2, using the attribute handle as an intermediate representation between operators, the operators perform vectorized operations on batch attribute handles in the intermediate representation layer; S3, Generate type-specific execution code for the current processing batch based on the original data type in the attribute handle; Specifically, when the operator needs to use actual attribute values or needs to output query results, the attribute values corresponding to the attribute handle are parsed as needed, and the parsed attribute values are discarded after the corresponding operation is completed.
2. The attribute handle-based execution method according to claim 1, characterized in that, The data structure type information of the attribute value includes: A type marker field is used to encode the original data type of the attribute value and the storage mode of the attribute handle; A size hint field, which provides a size level hint for the attribute value; The payload field is used to carry the attribute value or its storage location information.
3. The attribute handle-based execution method according to claim 2, characterized in that, In step S2, the vectorization operation includes at least one of the following operations: The filtering operation uses the size hint field to filter the batch attribute handles, determines the attribute handles that do not meet the filtering conditions, and then groups the attribute handles that pass the filtering according to the type tag field, and performs SIMD batch comparison on each group. The sorting operation involves grouping the batch attribute handles according to the type tag field, sorting them within the same type group according to the storage location information of the payload field, and using a SIMD sorting network to compare and exchange multiple attribute handles in parallel within a register. The hash operation uses the attribute handle as the hash table key and employs SIMD instructions to calculate hash values in parallel for a batch of attribute handles.
4. The attribute handle-based execution method according to claim 2, characterized in that, The storage modes include inline mode, local offset mode, and cache key mode; In inline mode, the payload field directly encodes the attribute value; In local offset mode, the load field encodes the offset of the attribute value in the local attribute storage file; In cache key mode, the payload field encodes the index position of the attribute value in the attribute cache pool.
5. The attribute handle-based execution method according to claim 4, characterized in that, The on-demand parsing includes: Collect the attribute handles that need to be parsed in the current batch, group them by storage mode, among which, Inline mode, the attribute handle directly extracts the attribute value from the payload field; The local offset mode attribute handles are sorted by offset and then pre-read in batches from the local attribute storage file; In cache key mode, the property handle is located directly in the property cache pool.
6. The attribute handle-based execution method according to claim 4, characterized in that, The attribute cache pool is classified, stored, and maintained according to the original data type of the attribute values, including: Attribute values of the same type are stored contiguously in the corresponding attribute cache pool, and variable-length attribute values are managed in memory by the Slab allocator. Based on the historical access statistics of the query template, high-frequency attribute values are preloaded into the corresponding attribute cache pool before the query is executed; Whether to retain the cache is determined based on the reuse distance prediction of attribute values. The reuse distance prediction is an exponentially weighted moving average estimate of the number of intermediate references between two adjacent references in historical similar queries.
7. The attribute handle-based execution method according to claim 1, characterized in that, Step S3 includes: The system detects the primitive data type in the attribute handle of the current batch. When the primitive data types in the batch are completely identical, it triggers just-in-time compilation to generate specialized operator code for that type, and the type judgment branch is compiled into an unconditional jump. When the primitive data types in the batch are not completely identical, the batch is first divided into several isomorphic sub-batches according to the primitive data types, and then the corresponding specialized code is generated for each isomorphic sub-batch.
8. An attribute-handled execution system, characterized in that, include: The attribute handle conversion module is used to convert the heterogeneous attribute values of the vertices to be processed in the weak pattern graph database into attribute handles of uniform width. The attribute handle is used to identify the attribute value and the data structure type information of the attribute value. The vectorized operation module is used to use the attribute handles as an intermediate representation between operators, so that the operators perform vectorized operations on a batch of attribute handles in the intermediate representation layer. The type-specialized execution code generation module generates type-specialized execution code for the current processing batch based on the original data type in the attribute handle. The attribute value parsing module parses the attribute value corresponding to the attribute handle as needed when the operator needs to use the actual attribute value or needs to output the query result, and discards the parsed attribute value after the corresponding operation is completed.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the method of any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1-7.
