A hash table-based data processing method, product, medium and device

By storing variable-length strings differentially in a hash table and determining the storage location based on the length, the problems of memory waste and degraded read performance in hash tables are solved, thereby improving storage efficiency and access speed.

CN123157948APending Publication Date: 2026-11-24CETC JINCANG (BEIJING) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611390409.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-08
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

The existing storage method for variable-length strings in hash tables leads to memory waste or degraded read performance, failing to balance storage efficiency and access performance.

Method used

The length of the variable-length string is used to determine whether it is less than a preset threshold. The short string is stored in the hash table data row, while the long string is stored in the external address space of the hash table and a pointer is saved. The hash table data row contains a length field and a preset storage area.

Benefits of technology

This implementation achieves differentiated storage of long and short strings using hash tables, avoiding memory waste and secondary addressing, and improving access performance and storage space utilization efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123157948A_ABST
    Figure CN123157948A_ABST
Patent Text Reader

Abstract

This invention relates to the field of database technology, and in particular to a data processing method, product, medium, and device based on hash tables. The method includes: responding to a variable-length string storage request for a hash table, obtaining the variable-length string to be stored and its length; determining whether the length of the variable-length string to be stored is less than or equal to a preset length threshold; if so, storing the variable-length string to be stored in a data row of the hash table; if not, storing the variable-length string to be stored in an address space outside the hash table, and storing a pointer to the variable-length string to be stored in a data row of the hash table. This invention differentiates the storage of strings of varying lengths through hash tables and external address spaces, avoiding both the secondary addressing and cache misses caused by storing all strings in external storage, and the memory waste caused by storing all strings at their maximum length, thereby improving the overall performance of hash table storage and retrieval of variable-length strings.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of database technology, and in particular to a data processing method, product, medium, and device based on hash tables. Background Technology

[0002] A hash table is a data structure that allows direct access based on key-value pairs. It accesses records by mapping key-value pairs to a location in the table, thus speeding up lookups. Hash tables are frequently used as a basic data structure in database join operations, grouping and aggregation operations, and set operations. Therefore, the storage and lookup efficiency of hash tables has a significant impact on the overall performance of the database. Internally, a hash table consists of multiple rows of data. To ensure efficient memory access, hash table rows typically use a fixed-length design. Storing variable-length strings is a challenge in hash table implementation.

[0003] In existing technologies, variable-length strings are typically stored in hash tables in two ways: the first method is to store the variable-length string in the data row of the hash table according to its maximum length, with the data row storing the length of the variable-length string and the string itself; the second method is to store the length of the variable-length string and a pointer to the string in the data row of the hash table, with the string itself stored in the address space outside the hash table.

[0004] However, the first storage method stores all variable-length strings in their maximum length within the hash table's data rows, resulting in a large amount of free storage space when the actual string length is small, leading to memory waste. The second storage method stores the entire string body in an address space outside the hash table. Subsequent string retrievals require jumping to this external address space using pointers, causing double addressing and cache misses, thus reducing string retrieval performance. Summary of the Invention

[0005] In view of the above problems, a hash table-based data processing method, product, medium and device are proposed to overcome or at least partially solve the above problems.

[0006] One objective of this invention is to provide a data processing method based on hash tables to improve the overall performance of storing and retrieving variable-length strings using hash tables.

[0007] A further objective of this invention is to improve the efficiency of hash table storage space utilization.

[0008] Another further objective of this invention is to optimize the performance of reading variable-length strings based on hash tables.

[0009] Specifically, according to one aspect of the present invention, the present invention provides a data processing method based on a hash table, comprising: In response to a request to store a variable-length string for a hash table, obtain the variable-length string to be stored and its length; Determine whether the length of the variable-length string to be stored is less than or equal to a preset length threshold; If so, the variable-length string to be stored is stored in the data row of the hash table; If not, the variable-length string to be stored is stored in the address space outside the hash table, and a pointer to the variable-length string to be stored is stored in the data row of the hash table.

[0010] Optionally, the hash table includes multiple fixed-length data rows. Each data row includes a fixed-length length field and a preset storage area. The length field stores the length information of a variable-length string, and the preset storage area stores the value of the variable-length string or a pointer to the variable-length string. The preset length threshold is the length value of the preset storage area.

[0011] Optionally, the step of storing the variable-length string to be stored in the data row of the hash table includes: Write the length of the variable-length string to be stored into the length field; Write the value of the variable-length string to be stored into the preset storage area of ​​the hash table.

[0012] Optionally, prior to the step of storing the variable-length string to be stored in the address space outside the hash table, the data processing method further includes: Write the length of the variable-length string to be stored into the length field of the data row.

[0013] Optionally, at least a portion of the pre-defined storage area includes a fixed-length padding field and a pointer field; and the step of storing a pointer to a variable-length string to be stored in a data row of the hash table includes: Write a pointer to the variable-length string to be stored into the pointer field.

[0014] Optionally, after the step of storing the variable-length string to be stored in the data row of the hash table, the data processing method further includes: In response to a variable-length string read request for a hash table, the length of the variable-length string to be read is obtained from the length field; Determine whether the length of the variable-length string to be read is less than or equal to a preset length threshold; If so, the value of the variable-length string to be read is read directly from the data row of the hash table.

[0015] Optionally, after determining whether the length of the variable-length string to be read is less than or equal to a preset length threshold, the data processing method further includes: If the length of the variable-length string to be read is greater than the preset length threshold, obtain a pointer to the variable-length string to be read from the data row of the hash table; Access the address space based on the pointer, and read the value of the variable-length string to be read from the address space.

[0016] According to another aspect of the present invention, a computer-readable storage medium is also provided, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the steps of any of the above-described hash table-based data processing methods.

[0017] According to another aspect of the present invention, a computer program product is also provided, comprising a computer program that, when executed by a processor, implements the steps of any of the above-described hash table-based data processing methods.

[0018] According to another aspect of the present invention, a computer device is also provided, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of any of the above-described hash table-based data processing methods.

[0019] The hash table-based data processing method of this invention obtains the variable-length string to be stored and its length in response to a variable-length string storage request for the hash table. It compares the string length with a preset length threshold, storing the shorter string inside the hash table data row, while storing the longer string itself in the external address space of the hash table, with only a pointer stored in the data row. This achieves differentiated storage of long and short strings. Therefore, by using a hash table and an external address space to differentiate the storage of long and short strings, this method avoids the secondary addressing and cache misses caused by storing all strings in external storage, and also avoids the memory waste caused by storing all strings at their maximum length. This balances the memory overhead and string access performance when processing variable-length strings using the hash table, thereby improving the overall performance of hash table storage and retrieval of variable-length strings.

[0020] Furthermore, the hash table-based data processing method of the present invention, by setting the fixed-length data row of the hash table to include a length field and a preset storage area, and setting the preset length threshold to the length value of the preset storage area, can determine the maximum string length of the embedded storage based on the inherent physical storage space of the data row, without the need for additional configuration of software threshold parameters, and at the same time fully utilizes the existing storage resources of the hash table, thereby improving the storage space utilization efficiency of the hash table.

[0021] Furthermore, the hash table-based data processing method of the present invention, in response to a variable-length string read request for the hash table, obtains the length of the string to be read from the length field, compares the string length with a preset length threshold, reads short strings directly from the data row, and obtains the value of the variable-length string by accessing the external address space through a pointer, thus achieving unified judgment and differentiated execution of the read paths for long and short strings. Therefore, the hash table-based data processing method of the present invention, by performing differentiated reading of long and short strings, ensures that the read path of short strings does not involve any external addressing operations, avoids pointer dereferencing and cache misses for short strings, significantly shortens the read latency of short strings, and ensures that long strings can be correctly obtained, thereby achieving overall optimization of the performance of variable-length string reading from the hash table.

[0022] The above and other objects, advantages and features of the present invention will become more apparent to those skilled in the art from the following detailed description of specific embodiments of the invention in conjunction with the accompanying drawings. Attached Figure Description

[0023] The following sections will describe some specific embodiments of the invention in detail by way of example and not limitation, with reference to the accompanying drawings. The same reference numerals in the drawings denote the same or similar parts or portions. Those skilled in the art should understand that these drawings are not necessarily drawn to scale. In the drawings: Figure 1 This is a flowchart illustrating a data processing method based on a hash table according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the structure of the hash table and external storage space in a data processing method based on a hash table according to an embodiment of the present invention; Figure 3 This is a control flow diagram of the variable-length string storage procedure in a hash table-based data processing method according to an embodiment of the present invention; Figure 4 This is a control flow diagram of the variable-length string reading process in a hash table-based data processing method according to an embodiment of the present invention; Figure 5 This is a schematic diagram of a computer program product according to an embodiment of the present invention; Figure 6 This is a schematic diagram of a computer-readable storage medium according to an embodiment of the present invention; and Figure 7 This is a schematic diagram of a computer device according to an embodiment of the present invention. Detailed Implementation

[0024] Exemplary embodiments of the invention will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.

[0025] To address the aforementioned problems, this invention proposes a data processing method based on hash tables. Figure 1 This is a flowchart illustrating a data processing method based on a hash table according to an embodiment of the present invention. Figure 1 As shown, the data processing method based on hash tables in this embodiment generally includes: Step S102: In response to the variable-length string storage request for the hash table, obtain the variable-length string to be stored and its length. It should be noted that the hash table in this embodiment is a data structure that allows direct access based on a key value, accessing records by mapping the key value to a location in the table. A variable-length string refers to a string type with a variable length; its length is uncertain before storage and needs to be dynamically obtained at runtime. Furthermore, the variable-length string to be stored is the original data to be stored in the hash table, and its length is determined by the number of characters in the string.

[0026] Step S104: Determine whether the length of the variable-length string to be stored is less than or equal to a preset length threshold. If yes, proceed to step S106; otherwise, proceed to step S108. It should be noted that the preset length threshold is a predetermined fixed value used to distinguish between short and long strings. Furthermore, the selection of the preset length threshold matches the fixed structure of the hash table, ensuring that short strings with a length less than or equal to the preset length threshold can be fully accommodated in the data rows of the hash table. Therefore, this step divides the variable-length strings to be stored into short strings with a length less than or equal to the preset length threshold and long strings with a length greater than the preset length threshold.

[0027] Step S106: Store the variable-length string to be stored in the data row of the hash table. That is, this step directly stores short strings with a length less than or equal to a preset length threshold in the hash table, without needing to allocate additional storage space outside the hash table.

[0028] Step S108 involves storing the variable-length string to be stored in the address space outside the hash table, and storing a pointer to the variable-length string in the data row of the hash table. It should be noted that the address space can be a pre-allocated storage area outside the hash table based on the length of the variable-length string, used to store variable-length strings exceeding a preset length threshold. Furthermore, a pointer is a variable that stores a memory address, used to point to the starting position of the variable-length string in the address space outside the hash table. In other words, this step stores long strings exceeding the preset length threshold in the address space outside the hash table, and stores a pointer to the long string in the hash table.

[0029] The data processing method based on hash tables in this invention obtains the variable-length string to be stored and its length in response to a variable-length string storage request for the hash table, compares the string length with a preset length threshold, stores the short string inside the hash table data row, and stores the long string body in the external address space of the hash table and only saves the pointer in the data row, thus realizing differentiated storage of long and short strings.

[0030] Therefore, the data processing method based on hash table in this embodiment of the invention uses hash table and external address space to store long and short strings differently. This avoids the secondary addressing and cache loss caused by storing all strings in external storage, and also avoids the memory waste caused by storing all strings at the maximum length. Thus, it balances the memory overhead and string access performance when the hash table processes variable-length strings, thereby improving the overall performance of the hash table in storing and retrieving variable-length strings.

[0031] Figure 2 This is a schematic diagram illustrating the structure of a hash table and external storage space in a hash table-based data processing method according to an embodiment of the present invention. Figure 2 As shown, the hash table 100 may include multiple fixed-length data rows 110, and each data row 110 may include a fixed-length length field 111 and a preset storage area 112.

[0032] In this embodiment, the length field 111 is used to store the length information of the variable-length string. The preset storage area 112 is used to store the value of the variable-length string or a pointer to the variable-length string. Additionally, the preset length threshold is the length value of the preset storage area 112. Specifically, the preset length threshold can be selected from any value between 4 and 16 bytes. For example, the preset length threshold can be configured to 8 bytes, 12 bytes, or 16 bytes.

[0033] It should be noted that "fixed length" means that each data row 110 is allocated a fixed amount of storage space when the hash table 100 is created, and this amount does not change with changes in the stored content. Furthermore, the length field 111 and the preset storage area 112 are arranged sequentially within the data row 110. The length field 111 is a field in the data row 110 specifically used to record the string length, and the preset storage area 112 is a contiguous space in the data row 110 used to store the value or pointer of a variable-length string, and the length of the length field 111 is less than the length of the preset storage area 112.

[0034] In addition, such as Figure 2 As shown, at least a portion of the preset storage area 112 may include a fixed-length padding field 1121 and a pointer field 1122. Specifically, the pointer field 1122 is specifically used to store pointers to variable-length strings, pointing to the address space 210 in the external storage space 200. Since the length of the pointer is less than the length of the preset storage area 112, a padding field 1121 is set between the length field 111 and the pointer field 1122 to meet alignment requirements. That is, the padding field 1121 is merely a fixed-length space in the preset storage area 112 used for alignment or filling empty spaces; it does not store valid data itself.

[0035] In one specific embodiment, such as Figure 2 As shown, the length of data row 110 in hash table 100 is 16 bytes. The length of the length field 111 can be set to 4 bytes, and correspondingly, the length of the preset storage area 112 can be set to 12 bytes, that is, the preset length threshold can be set to 12 bytes. In addition, the length of the pointer field 1122 can be set to 8 bytes, and correspondingly, the length of the padding field 1121 can be set to 4 bytes. For example, the length field 111 occupies the first 4 bytes of data row 110, the preset storage area 112 occupies the last 12 bytes of data row 110, the padding field 1121 occupies the first 4 bytes of the preset storage area 112, and the pointer field 1122 occupies the last 8 bytes of the preset storage area 112.

[0036] Based on this, when the length of a variable-length string is less than or equal to 12 bytes, the string can be completely written into the preset storage area 112; when the length of a variable-length string is greater than 12 bytes, the preset storage area 112 cannot accommodate the value of the complete variable-length string, and the string needs to be stored in the address space 210 outside the hash table 100.

[0037] Therefore, the data processing method based on hash table 100 in this embodiment of the invention, by setting the fixed-length data row 110 of hash table 100 to include a length field 111 and a preset storage area 112, and setting the preset length threshold to the length value of the preset storage area 112, can determine the maximum string length of the embedded storage based on the inherent physical storage space of the data row 110, without the need for additional configuration of software threshold parameters, and at the same time fully reuses the existing storage resources of hash table 100, thereby improving the storage space utilization efficiency in hash table 100.

[0038] In some embodiments, step S106 may include the following steps: writing the length of the variable-length string to be stored into the length field 111; and writing the value of the variable-length string to be stored into a preset storage area 112 of the hash table 100. Specifically, the length field 111 may be the first 4 bytes of the data row 110 of the hash table 100, used to record the byte length of the string in integer form. The value of the string is the actual content of the variable-length string itself, i.e., a sequence of characters.

[0039] In other words, after determining that the length of the variable-length string to be stored is less than or equal to the preset length threshold, the length of the variable-length string is first converted into a 4-byte integer and written into the first 4 bytes of data line 110, and then the value of the variable-length string is written into the last 12 bytes of data line 110.

[0040] Therefore, the data processing method based on hash table in this embodiment of the invention realizes the complete writing of short strings in the data row 110 of hash table 100 by writing the length of short strings into the length field 111 and writing the value of variable-length strings into the preset storage area 112. This allows all the information of the short string to be contained in the row of hash table 100 without relying on any external storage, thereby avoiding access operations to external storage space 200 when reading the short string later.

[0041] In some embodiments, prior to step S108 above, the hash table-based data processing method of the present invention may further include the following step: writing the length of the variable-length string to be stored into the length field 111 of the data row 110. That is, before allocating external storage space, the string length is first written into the length field 111 of the data row 110.

[0042] Therefore, the data processing method based on hash table in this embodiment of the invention achieves effective storage of the length information of the variable-length string by writing the length of the variable-length string into the length field 111 of the data row 110 before storing the variable-length string to be stored in the address space 210 outside the hash table 100, thereby improving the convenience and accuracy of subsequent reading operations.

[0043] In some embodiments, the step S108 above, which stores the pointer to the variable-length string to be stored in the data row 110 of the hash table, may include the following step: writing the pointer to the variable-length string to be stored into the pointer field 1122. Specifically, when the length of the variable-length string to be stored is greater than a preset length threshold, a storage area with a length equal to the length of the variable-length string to be stored is allocated in the external storage space 200 as an address space 210, the string is written into the address space 210, and the starting address of the address space 210 is obtained. The starting address is then converted into a pointer and written into the pointer field 1122.

[0044] Therefore, the data processing method based on hash table in this embodiment of the invention achieves differentiated reuse of the originally idle fill field 1121 and pointer field 1122 in the data row 110 of hash table 100 by setting a fixed-length fill field 1121 and pointer field 1122 in the preset storage area 112, and writing the pointer into the pointer field 1122 when the length of the variable-length string is greater than the preset length threshold. This allows the relevant information of both short and long strings to be stored in the appropriate location, thereby improving the storage accuracy of hash table 100.

[0045] In some embodiments, after step S108 above, the data processing method based on hash table of the present invention may further include the following steps: in response to a variable-length string reading request for hash table 100, obtaining the length of the variable-length string to be read from the length field 111; determining whether the length of the variable-length string to be read is less than or equal to a preset length threshold; if so, directly reading the value of the variable-length string to be read from the data row 110 of hash table 100.

[0046] Furthermore, after the above step of determining whether the length of the variable-length string to be read is less than or equal to the preset length threshold, the data processing method may also include the following steps: if the length of the variable-length string to be read is greater than the preset length threshold, obtain a pointer to the variable-length string to be read from the data row 110 of the hash table 100; access the address space 210 according to the pointer, and read the value of the variable-length string to be read from the address space 210.

[0047] Taking a preset length threshold of 12 bytes as an example, when reading a string from hash table 100, it first checks whether the length of the string is less than or equal to 12 bytes. If the condition is met, the value of the string is read directly from the following 12 bytes; otherwise, the last 8 bytes store a pointer to the string, and the value of the string is read based on this pointer.

[0048] In other words, the data processing method based on hash table in this embodiment of the invention obtains the length of the string to be read from the length field 111 in response to a variable-length string read request for hash table 100, compares the string length with a preset length threshold, reads short strings directly from data row 110, and obtains the value of variable-length strings by accessing the external address space 210 through a pointer, thereby realizing unified judgment and differentiated execution of long and short string read paths.

[0049] Therefore, the hash table-based data processing method of this invention, by performing differentiated reading of long and short strings, ensures that the reading path of short strings does not involve any external addressing operations, avoids pointer dereferencing and cache loss for short strings, significantly shortens the reading latency of short strings, and at the same time ensures that long strings can be correctly obtained, thereby achieving overall optimization of the reading performance of 100 variable-length strings in the hash table.

[0050] Figure 3 This is a control flow diagram of the variable-length string storage procedure in a hash table-based data processing method according to an embodiment of the present invention. The following is in conjunction with... Figure 3 The process steps of storing variable-length strings based on hash tables in this embodiment will be explained in detail.

[0051] Step S302: In response to a variable-length string storage request for hash table 100, obtain the variable-length string to be stored and its length.

[0052] Step S304: Determine whether the length of the variable-length string to be stored is less than or equal to the preset length threshold. If yes, proceed to step S306; otherwise, proceed to step S310.

[0053] Step S306: Write the length of the variable-length string to be stored into the length field 111.

[0054] Step S308: Write the value of the variable-length string to be stored into the preset storage area 112 of hash table 100. This completes the current process.

[0055] Step S310: Allocate a storage region in the external storage space 200 with a length equal to the length of the variable-length string to be stored as address space 210.

[0056] Step S312: Store the variable-length string to be stored in the address space 210 outside the hash table 100.

[0057] Step S314: Write the length of the variable-length string to be stored into the length field 111 of data row 110.

[0058] Step S316: Write the pointer to the variable-length string to be stored into pointer field 1122. This completes the current process.

[0059] Therefore, the data processing method based on hash table of the present invention stores long and short strings differently through hash table 100 and external address space 210. This avoids the secondary addressing and cache loss caused by storing all strings in external storage, and also avoids the memory waste caused by storing all strings at the maximum length. Thus, it takes into account the memory overhead and string access performance when hash table 100 processes variable-length strings, thereby improving the overall performance of hash table 100 in storing and retrieving variable-length strings.

[0060] Figure 4 This is a control flow diagram of the variable-length string reading process in a hash table-based data processing method according to an embodiment of the present invention. The following is in conjunction with... Figure 4 The process steps for reading variable-length strings based on hash tables in this embodiment will be explained in detail.

[0061] Step S402: In response to a variable-length string read request for hash table 100, the length of the variable-length string to be read is obtained from the length field 111.

[0062] Step S404: Determine whether the length of the variable-length string to be read is less than or equal to the preset length threshold. If yes, proceed to step S406; otherwise, proceed to step S408.

[0063] Step S406: Read the value of the variable-length string to be read directly from data row 110 of hash table 100. This concludes the current process.

[0064] Step S408: Obtain a pointer to the variable-length string to be read from data row 110 of hash table 100.

[0065] In step S410, the address space 210 is accessed according to the pointer, and the value of the variable-length string to be read is read from the address space 210. This concludes the current process.

[0066] Therefore, the hash table-based data processing method of the present invention, by differentially reading long and short strings, ensures that the reading path of short strings does not involve any external addressing operations, avoids pointer dereferencing and cache loss for short strings, significantly shortens the reading latency of short strings, and at the same time ensures that long strings can be correctly obtained, thereby achieving overall optimization of the reading performance of 100 variable-length strings in the hash table.

[0067] This embodiment also provides a computer program product 10, a computer-readable storage medium 20, and a computer device 30. Figure 5This is a schematic diagram of a computer program product 10 according to an embodiment of the present invention. Figure 6 This is a schematic diagram of a computer-readable storage medium 20 according to an embodiment of the present invention. Figure 7 This is a schematic block diagram of a computer device 30 according to an embodiment of the present invention.

[0068] Computer program product 10 includes computer program 11, which, when executed by processor 32, implements the steps of any of the above-described hash table-based data processing methods. Computer-readable storage medium 20 stores the computer program 11 thereon, which, when executed by processor 32, implements the steps of any of the above-described hash table-based data processing methods. Computer device 30 may include memory 31, processor 32, and computer program 11 stored on memory 31 and running on processor 32.

[0069] The computer program 11 used to perform the operations of the present invention may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, status setting data, integrated circuit configuration data, or source code or object code written in any combination of one or more programming languages ​​and procedural programming languages.

[0070] Computer program 11 may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter case, the remote computer may be connected to the user's computer via any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, to perform aspects of the invention, electronic circuits including, for example, programmable logic circuits, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs) may execute computer-readable program instructions to personalize the electronic circuits by utilizing state information of computer-readable program instructions.

[0071] For the purposes of this embodiment, computer program product 10 is a related product that includes computer program 11.

[0072] For the purposes of this embodiment, computer-readable storage medium 20 is a tangible device capable of holding and storing a computer program 11. It can be any device capable of containing, storing, communicating, propagating, or transmitting the program 11 for use by or in conjunction with an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable storage medium 20 include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable optical disc read-only memory (CD-ROM), digital versatile disc (DVD), memory stick, floppy disk, mechanical encoding device, and any suitable combination thereof.

[0073] Therefore, those skilled in the art should recognize that although numerous exemplary embodiments of the present invention have been shown and described in detail herein, many other variations or modifications conforming to the principles of the present invention can be directly determined or derived from the disclosure of the present invention without departing from the spirit and scope of the invention. Thus, the scope of the present invention should be understood and construed as covering all such other variations or modifications.

Claims

1. A data processing method based on a hash table, comprising: In response to a request to store a variable-length string for a hash table, obtain the variable-length string to be stored and its length; Determine whether the length of the variable-length string to be stored is less than or equal to a preset length threshold; If so, the variable-length string to be stored is stored in the data row of the hash table; If not, the variable-length string to be stored is stored in the address space outside the hash table, and a pointer to the variable-length string to be stored is stored in the data row of the hash table.

2. The data processing method based on a hash table according to claim 1, wherein, The hash table includes multiple fixed-length data rows. Each data row includes a fixed-length length field and a preset storage area. The length field stores the length information of a variable-length string, and the preset storage area stores the value of the variable-length string or a pointer to the variable-length string. The preset length threshold is the length value of the preset storage area.

3. The data processing method based on a hash table according to claim 2, wherein, The step of storing the variable-length string to be stored in the data row of the hash table includes: Write the length of the variable-length string to be stored into the length field; Write the value of the variable-length string to be stored into the preset storage area of ​​the hash table.

4. The data processing method based on a hash table according to claim 2, wherein, Prior to the step of storing the variable-length string to be stored in the address space outside the hash table, the data processing method further includes: Write the length of the variable-length string to be stored into the length field of the data row.

5. The data processing method based on a hash table according to claim 4, wherein, At least part of the preset storage area includes a fixed-length padding field and a pointer field; The step of storing a pointer to the variable-length string to be stored in a data row of the hash table includes: Write a pointer to the variable-length string to be stored into the pointer field.

6. The data processing method based on a hash table according to claim 2, wherein, After the step of storing the variable-length string to be stored in the data row of the hash table, the data processing method further includes: In response to a variable-length string read request for a hash table, the length of the variable-length string to be read is obtained from the length field; Determine whether the length of the variable-length string to be read is less than or equal to the preset length threshold; If so, the value of the variable-length string to be read is read directly from the data row of the hash table.

7. The data processing method based on a hash table according to claim 6, wherein, After the step of determining whether the length of the variable-length string to be read is less than or equal to the preset length threshold, the data processing method further includes: If the length of the variable-length string to be read is greater than the preset length threshold, a pointer to the variable-length string to be read is obtained from the data row of the hash table; Access the address space according to the pointer, and read the value of the variable-length string to be read from the address space.

8. A computer program product comprising a computer program, wherein, When executed by a processor, the computer program implements the steps of the data processing method based on a hash table as described in any one of claims 1 to 7.

9. A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the hash table-based data processing method according to any one of claims 1 to 7.

10. A computer device comprising a memory, a processor, and a computer program stored in the memory, wherein, The processor executes the computer program to implement the steps of the data processing method based on a hash table as described in any one of claims 1 to 7.