Index table creation method and device, target record search method and device

By creating sorted tables and hash tables in the data table, the problem of inefficient hash indexes caused by the large number of duplicate key values ​​is solved, and the effect of effectively handling hash conflicts and improving search efficiency is achieved.

CN114490638BActive Publication Date: 2025-03-11SHUMAI ARK (BEIJING) INFORMATION TECHNOLOGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111635731.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-29
Publication Date
2025-03-11
Estimated Expiration
2041-12-29

AI Technical Summary

Technical Problem

In the case where the target field of the data table has a large number of duplicate key values, there is a hash conflict problem, which leads to the inefficiency of the hash index.

Method used

By creating a sorted table and a hash table, each entry in the sorted table includes an entry number, a key value and a record number. The row corresponding to each key value in the hash table includes a first pointer variable and a second pointer variable for storing the entry numbers of the first and last occurrences of the key value in the sorted table.

Benefits of technology

Even if the target field of the data table has a large number of duplicate key values, the hash conflict can be effectively handled by establishing an index table, improving the search efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114490638B_ABST
    Figure CN114490638B_ABST
Patent Text Reader

Abstract

The embodiments of the present disclosure provide an index table creation method and device, and a target record search method and device. The index table creation method includes: creating a sorting table based on the target field of the data table, the sorting table is used to sort the key value of the target field, and the sorting table includes the entry number, the key value and the record number of the key value in the data table; creating a hash table based on the sorting table, and the rows corresponding to each key value in the hash table include a first pointer variable and a second pointer variable, the first pointer variable stores the entry number of the corresponding key value when it first appears in the sorting table, and the second pointer variable stores the entry number of the corresponding key value when it last appears in the sorting table; using the entry number field, the record number field and the hash table in the sorting table to create an index table of the data table. Using the scheme of the embodiments of the present disclosure, even if the target field of the data table has a large number of duplicate key values, the index table established for it can effectively handle hash conflicts after deduplication.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of database technology, and in particular to a method and device for creating an index table, and a method and device for searching a target record. Background Art

[0002] In order to quickly find specific data in a data table, the related art proposes to create a hash index for the data table. However, when the target field of the data table has a large number of repeated key values, the hash index has a hash conflict problem, which makes the hash index very inefficient. Summary of the invention

[0003] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides an index table creation method and device, and a target record search method and device.

[0004] In a first aspect, an embodiment of the present disclosure provides a method for creating an index table, the method comprising:

[0005] Creating a sorting table based on a target field of a data table, wherein the sorting table is used to sort the key value of the target field, and each entry of the sorting table includes an entry number, a key value, and a record number of the key value in the data table;

[0006] Creating a hash table based on the sorted table, wherein each row in the hash table corresponding to each key value includes a first pointer variable and a second pointer variable, wherein the first pointer variable stores an entry number when the corresponding key value first appears in the sorted table, and the second pointer variable stores an entry number when the corresponding key value last appears in the sorted table;

[0007] An index table of the data table is created using the entry number field, the record number field and the hash table in the sorting table.

[0008] Optionally, creating a hash table based on the sorting table includes:

[0009] Step A: storing the key value of the i-th entry in the sorted table into the key value memory, and storing the entry number of the i-th entry in the sorted table into the first number memory and the second number memory, i=0;

[0010] Step B: Determine whether the key value of the i+1th entry in the sorting table is the same as the key value in the key value storage; if so, execute step C; if not, execute step F;

[0011] Step C: storing the entry number of the i+1th entry into the second number storage device, so that i=i+1;

[0012] Step D: Determine whether i is equal to N-1; if so, execute step E; if not, execute step B; wherein N is the number of entries in the sorting table;

[0013] Step E: calculating the corresponding row of the key value in the key value memory in the hash table based on the hash function, storing the entry number in the first number memory in the first pointer variable of the corresponding row, and storing the entry number in the second number memory in the second pointer variable of the corresponding row;

[0014] Step F: Calculate the corresponding row of the key value in the key value memory in the hash table based on the hash function, store the entry number in the first number memory in the first pointer variable of the corresponding row, store the entry number in the second number memory in the second pointer variable of the corresponding row, make i=i+1, store the key value of the i-th entry in the key value memory, and store the entry number of the i-th entry in the sorted table in the first number memory and the second number memory; then execute step D.

[0015] Optionally, before executing step A, the method further includes step H: obtaining the number of deduplicated key values ​​in the sorting table, initializing the hash table based on the number of deduplicated key values, and determining the hash function.

[0016] Optionally, step A includes: setting c=0;

[0017] Step E includes E1-E4:

[0018] E1: Calculate the corresponding row of the key value in the hash table in the key-value memory based on the hash function.

[0019] E2: Determine whether the first pointer variable and / or the second pointer variable of the corresponding row in the hash table already stores the entry number; if not, execute step E3; if yes, execute step E4;

[0020] Step E3: storing the entry number in the first number storage device in the first pointer variable of the corresponding row, and storing the entry number in the second number storage device in the second pointer variable of the corresponding row;

[0021] Step E4: storing the hash value corresponding to the key value in the hash value column of the c-th row of the temporary table, storing the entry number in the first number storage device in the first entry number column of the c-th row of the temporary table, and storing the entry number in the second number storage device in the second entry number column of the c-th row of the temporary table;

[0022] The step F also includes steps F1-F5;

[0023] Step F1: Calculate the corresponding row of the key value in the hash table in the key-value memory based on the hash function.

[0024] Step F2: Determine whether the first pointer variable and / or the second pointer variable of the corresponding row in the hash table has stored the entry number; if not, execute step F3; if yes, execute step F4;

[0025] Step F3: Store the entry number in the first number storage in the first pointer variable of the corresponding row, and store the entry number in the second number storage in the second pointer variable of the corresponding row. Then execute step F5;

[0026] Step F4: store the hash value corresponding to the key value in the hash value column of the c-th row of the temporary table, store the entry number in the first number storage device in the first entry number column of the c-th row of the temporary table, and store the entry number in the second number storage device in the second entry number column of the c-th row of the temporary table, and make c=c+1. Then execute step F5;

[0027] Step F5: set i=i+1, store the key value of the i-th entry in the key value memory, and store the entry number of the i-th entry in the sorted table in the first number memory and the second number memory.

[0028] After executing step E, the method further includes:

[0029] Step H: Determine the number of extended rows according to the number of rows c of the temporary table, and add the extended rows at the end of the hash table; calculate the row corresponding to the hash value in the extended rows according to the number of rows c of the extended rows and the hash value stored in the temporary table, and store the first entry number of the row corresponding to the hash value in the first pointer variable of the corresponding row in the extended rows, and store the second entry number of the row corresponding to the hash value in the second pointer variable of the corresponding row in the extended rows.

[0030] In a second aspect, an embodiment of the present disclosure provides a target record search method, which searches for a target record in the data table based on an index table created by the method described above, and the target record search method includes:

[0031] Based on the hash function, determine the target row corresponding to the key value to be searched in the hash table;

[0032] determining a target entry in the sorted table based on a first pointer variable and a second pointer variable in the target row;

[0033] The target record whose key value of the target field in the data table is the key value to be searched is determined based on the entry record number in the target entry.

[0034] In a third aspect, an embodiment of the present disclosure provides an index table creation device, the device comprising:

[0035] A sorting table creation unit, used to create a sorting table based on a target field of a data table, wherein the sorting table is used to sort the key values ​​of the target field, and each entry of the sorting table includes an entry number, a key value, and a record number of the key value in the data table;

[0036] a hash table creation unit, configured to create a hash table based on the sorted table, wherein each row in the hash table corresponding to each key value includes a first pointer variable and a second pointer variable, wherein the first pointer variable stores an entry number when the corresponding key value first appears in the sorted table, and the second pointer variable stores an entry number when the corresponding key value last appears in the sorted table;

[0037] The index table creation unit is used to create an index table of the data table by using the entry number field, the record number field and the hash table in the sorting table.

[0038] Optionally, the hash table creation unit includes:

[0039] A first storage unit is used to store the key value of the i-th entry in the sorted table into a key value memory, and store the entry number of the i-th entry in the sorted table into a first number memory and a second number memory, i=0;

[0040] A first judging unit, used to judge whether the key value of the i+1th entry in the sorting table is the same as the key value in the key value memory;

[0041] a second storage unit, configured to store the entry number of the i+1th entry in the second number storage unit so that i=i+1, if the first judgment unit determines that the key value of the i+1th entry in the sorting table is the same as the key value in the key value storage unit;

[0042] a third storage unit, for, when the first judgment unit determines that the key value of the i+1th entry in the sorted table is different from the key value in the key value memory, calculating the corresponding row of the key value in the key value memory in the hash table based on the hash function, storing the entry number in the first number memory in the first pointer variable of the corresponding row, storing the entry number in the second number memory in the second pointer variable of the corresponding row, making i=i+1, storing the key value of the i-th entry in the key value memory, and storing the entry number of the i-th entry in the sorted table in the first number memory and the second number memory;

[0043] A second judgment unit, used for judging whether i is equal to N-1 after the second storage unit sets i=i+1;

[0044] a fourth storage unit, configured to, when the second judgment unit determines that i is equal to N-1, calculate a corresponding row of the key value in the key value storage device in the hash table based on a hash function, store the entry number in the first number storage device in the first pointer variable of the corresponding row, and store the entry number in the second number storage device in the second pointer variable of the corresponding row;

[0045] The cyclic calling unit is used to call the first judgment unit again when the second judgment unit or the fourth judgment unit determines that i is less than N-1.

[0046] In a fourth aspect, an embodiment of the present disclosure provides a target record search device, which searches for a target record whose key value of a target field in the data table is the key value to be searched based on the index table created by the method described above, and the record search device includes:

[0047] A target row search unit, configured to determine, based on the hash function, a target row corresponding to the key value to be searched in the hash table;

[0048] A target entry search unit, configured to determine a target entry in the sorted table based on a first pointer variable and a second pointer variable in the target row;

[0049] A target record search unit is used to determine the target record whose key value of the target field in the data table is the key value to be searched based on the record number of the target entry.

[0050] In a fifth aspect, an embodiment of the present disclosure provides an electronic device, comprising: a processor, wherein the processor is used to execute a computer program stored in a memory, wherein the computer program implements the method described in the first aspect or the second aspect when executed by the processor.

[0051] In a sixth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method described in the first aspect or the second aspect is implemented.

[0052] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has the following advantages:

[0053] The index creation method and device provided by the embodiment of the present disclosure, after creating a sorting table based on the target field of the data table, creates a hash table based on the sorting table, and creates an index of the data table based on the sorting table and the hash table, wherein the rows of the hash table corresponding to each key value each include a first pointer variable and a second pointer variable, the first pointer variable stores the entry number of the corresponding key value when it first appears in the sorting table, and the second pointer variable stores the entry number of the corresponding key value when it last appears in the sorting table. Using the scheme of the embodiment of the present disclosure, even if the target field of the data table has a large number of duplicate key values, the index table established for it can effectively handle hash conflicts after deduplication. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0055] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0056] Figure 1 is a flow chart of an index creation method provided by some embodiments of the present disclosure;

[0057] Figure 2 is a flow chart of a method for creating a hash table based on a sorting table provided in some embodiments of the present disclosure;

[0058] Figure 3 is a flow chart of a method for creating a hash table based on a sorting table provided in some other embodiments of the present disclosure;

[0059] Figure 4 The present disclosure provides a flowchart of adding data of a temporary table to an extended row of a hash table.

[0060] Figure 5 is a flow chart of a target record search method provided by an embodiment of the present disclosure;

[0061] Figure 6 It is a structural schematic diagram of an index table creation device provided by an embodiment of the present disclosure;

[0062] Figure 7 is a schematic diagram of the structure of a target record search device provided by an embodiment of the present disclosure;

[0063] Figure 8 It is a schematic diagram of the structure of a computing device provided in some embodiments of the present disclosure. DETAILED DESCRIPTION

[0064] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0065] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0066] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0067] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0068] Figure 1 is a flow chart of an index creation method provided in some embodiments of the present disclosure. In some embodiments of the present disclosure, the content display method can be executed by a computing device. By way of example, the computing device can be a terminal device such as a tablet computer, a laptop computer, or a server.

[0069] like Figure 1 As shown, the content page display method provided by the embodiment of the present disclosure includes steps S101-S103.

[0070] Step S101: Create a sorting table based on the target field of the data table.

[0071] The target field in the data table is the field used to create an index table for the data table. The sort table is a table obtained by sorting the key values ​​of the target field in the data table.

[0072] In a specific embodiment of the present disclosure, a specific sorting rule can be used to sort the key values ​​of the target field in the data table to create a sorting table. For example, when the key value is a number, the key value of the target field can be sorted in ascending order to create a sorting table.

[0073] In the disclosed embodiment, the sorting table includes a plurality of entries, each of which includes an entry number, a key value, and a record number of the key value in the data table. The entry number is a number that represents the order of each entry. The record number of the key value in the data table is the record number of the record corresponding to the key value in the data table, that is, the row number of the row where the key value is located in the data table.

[0074] For example, in a specific application of the embodiment of the present disclosure, the data table is shown in Table 1. Among them, the target field is the car manufacturer, the key value is the name of the corresponding manufacturer, the sorting rule for sorting the target field is the character order, and the record number of the key value in the data table is the car number. Based on the above information, the obtained sorting table is shown in Table 2.

[0075] It should be noted that the sorting table mentioned in the embodiment of the present disclosure includes the entry number, key value and the record number of the key value in the data table, which is only a logical expression of establishing a hash table. In the sorting table created in actual application, the entry number can be determined by the memory address of the corresponding entry data in the sorting table, and the key value can be obtained by searching the data table according to the record number.

[0076] Table 1 Data sheet

[0077]

[0078]

[0079] Table 2 Sorting table

[0080] Item Number Record Number Key-value 0 0 Ford 1 2 Ford 2 4 Ford 3 7 Ford 4 6 Honda 5 3 Kia 6 8 Kia 7 9 Kia 8 1 VW 9 5 VW

[0081] In the specific embodiment of the present disclosure, the computing device can use various existing sorting methods such as bubble sort, quick sort, simple sort, shell sort, simple selection sort, heap sort, two-way merge sort, multi-way merge sort, counting sort, bucket sort, radix sort, etc. to create a sort table based on the target field of the data table, which is not particularly limited in the embodiment of the present disclosure. Considering the time complexity and space complexity of sorting, it is preferred to use the radix sort method to create the sort table in the embodiment of the present disclosure.

[0082] Step S102: Create a hash table based on the sorting table.

[0083] In the disclosed embodiment, the hash table is a data table that determines the entry corresponding to the key value in the sorting table according to the hash value of the key value. The rows corresponding to each key value in the hash table include a first pointer variable and a second pointer variable. The first pointer variable stores the entry number of the corresponding key value when it first appears in the sorting table, and the second pointer variable stores the entry number of the corresponding key value when it last appears in the sorting table. In other words, the first pointer variable and the second pointer variable can determine the entry range of a specific key value in the sorting table.

[0084] For example, in one embodiment of the present disclosure, the hash table obtained based on the aforementioned Table 2 is shown in Table 3. Among them, the first row in Table 3 corresponds to the row with the key value Ford, the first pointer variable in the first row points to the 0th row in the sorted table, and the second pointer variable points to the 3rd row in the sorted table, that is, the key values ​​corresponding to the 0th to 3rd rows in the sorted table are all Ford. Similarly, the fourth row in Table 3 corresponds to the row with the key value Honda, and the first pointer variable and the second pointer variable in the 3rd row both point to the 4th row in the sorted table, that is, only the 4th row in the sorted table corresponds to the key value Honda. As shown in Table 3, in the embodiment of the present disclosure, the hash table may include a non-number row (Not A Number, NAN), indicating that this row has no corresponding key value.

[0085] Table 3 Hash table

[0086] Number of lines First pointer variable Second pointer variable 0 NAN NAN 1 0 3 2 NAN NAN 3 4 4 4 NAN NAN 5 5 7 6 8 9 7 NAN NAN 8 NAN NAN 9 NAN NAN

[0087] Figure 2 1 is a flow chart of a method for creating a hash table based on a sorting table provided in some embodiments of the present disclosure. Figure 2 As shown, in some embodiments of the present disclosure, creating a hash table based on the sorting table in step S102 may include steps S1021-S1028.

[0088] Step S1021: store the key value of the i-th entry in the sorted table to the key value memory, and store the entry number of the i-th entry in the sorted table to the first number memory and the second number memory, i=0.

[0089] In the embodiment of the present disclosure, the hash table is created based on the sorting table starting from the 0th entry in the sorting table to the N-1th entry in the sorting table (that is, the last entry in the sorting table).

[0090] In the embodiment of the present disclosure, a computing device creates a key-value memory, which is used to store a key value of a previous entry so that the key value of the previous entry can be compared with the key value of the subsequent entry. In a specific implementation, the key-value memory can be a register in a CPU in the computing device, that is, it can be a key storage register.

[0091] In the embodiment of the present disclosure, the computing device creates a first numbering memory and a second numbering memory, the first numbering memory is used to store the number of the entry when a specific key value appears for the first time in the sorted table, and the second numbering memory is used to store the number of the entry when a specific key value appears for the jth time in the sorted table (depending on the actual situation, j may be any integer in (0, N-1)).

[0092] In a specific implementation, both the first numbered memory and the second numbered memory may be registers in a CPU in a computing device, that is, the first numbered memory may be a first numbered register, and the second numbered memory may be a second numbered register.

[0093] In step S1021 , the key value of the first entry in the sort table is stored in the key value memory, and the entry number of the first entry is stored in the first number memory and the second number memory.

[0094] Step S1022: Determine whether the key value of the i+1th entry in the sorting table is the same as the key value in the key value storage. If yes, execute step S1023. If no, execute step S1026.

[0095] In the disclosed embodiment, the computing device may create a comparison memory for temporarily storing the key value of the i+1th entry. After reading the key value of the i+1th entry, the key value of the i+1th entry is first placed in the comparison memory, and then the key value in the comparison memory is compared with the key value in the key value memory. In a specific implementation, the comparison memory may be a register in a CPU in the computing device.

[0096] Step S1023: Store the entry number of the (i+1)th entry in the second number storage device, so that i=i+1.

[0097] If the key value of the i+1th entry is the same as the key value in the key-value memory, it can be determined that the i-th entry is not the entry where the key value last appears in the key-value memory, and the i+1th entry may be the entry where the key value last appears in the key-value memory. Therefore, the entry number of the i+1th entry is stored in the second number memory.

[0098] In the embodiment of the present disclosure, in order to continue the subsequent loop calculation, after the entry number of the i+1th entry is stored in the second number storage, i=i+1, and step S1024 is executed again.

[0099] Step S1024: Determine whether i is equal to N-1; if so, execute step S1025; if not, execute step S1022.

[0100] If i is equal to N - 1, it can be determined that all entries in the sorted table have been traversed, so step S1025 is executed. If i < N - 1, it can be determined that the entries in the sorted table have not been traversed, so step S1022 is repeatedly executed.

[0101] Step S1025: Calculate the corresponding row of the key value in the key value memory in the hash table based on the hash function, store the entry number in the first number memory in the first pointer variable of the corresponding row, and store the entry number in the second number memory in the second pointer variable of the corresponding row.

[0102] As described above, when i is equal to N - 1, all entries in the sorted table have been traversed. At this time, it is necessary to transfer the entry numbers stored in the first number memory and the second number memory to the corresponding rows in the hash table.

[0103] In the embodiment of the present disclosure, first, the row number (i.e., the address of the corresponding row) of the key value in the key value memory in the hash table is calculated using the hash function. Subsequently, the entry number in the first number memory is stored in the first pointer variable of the corresponding row, and the entry number in the second number memory is stored in the second pointer variable of the corresponding row.

[0104] Step S1026: Calculate the corresponding row of the key value in the key value memory in the hash table based on the hash function, store the entry number in the first number memory in the first pointer variable of the corresponding row, store the entry number in the second number memory in the second pointer variable of the corresponding row, set i = i + 1, and store the key value of the i-th entry in the key value memory, store the entry number of the i-th entry in the sorted table in the first number memory and the second number memory; then execute step S1024.

[0105] If the key value of the (i + 1)-th entry is different from the key value in the key value memory, it can be determined that the i-th entry is the entry where the key value in the key value memory appears for the last time. At this time, calculate the corresponding row of the key value in the key value memory in the hash table based on the hash function, store the entry number in the first number memory in the first pointer variable of the corresponding row, store the entry number in the second number memory in the second pointer variable of the corresponding row, and implement the storage of the entry corresponding to the key value in the key value memory.

[0106] After storing the entry number in the first number memory in the first pointer variable of the corresponding row and storing the entry number in the second number memory in the second pointer variable of the corresponding row, then set i = i + 1, store the key value of the i-th entry in the key value memory, and store the entry number of the i-th entry in the sorted table in the first number memory and the second number memory.

[0107] In some embodiments of the present disclosure, the method for creating a hash table based on a sorting table may further include step S1020 before executing step S1021 in addition to the aforementioned steps S1021-S1026.

[0108] Step S1020: Obtain the number of deduplicated key values ​​in the sorting table, initialize the hash table based on the number of deduplicated key values, and determine the hash function.

[0109] In the specific embodiment of the present disclosure, the sorting table can be quickly traversed, and the number of deduplicated key values ​​in the sorting table can be determined by comparison, and the hash table can be initialized and the hash function can be determined based on the number of deduplicated key values. By initializing the hash table and determining the hash function using the number of deduplicated key values, the size of the hash table can be made more reasonable, avoiding the waste of storage space due to the hash table being too large, and avoiding the hash table being too small to cause hash conflicts.

[0110] Step S103: Create an index table of the data table using the entry number field, record number field and hash table in the sorting table.

[0111] After obtaining the aforementioned sorting table and obtaining a hash table based on the sorting table, the computing device can extract the entry number field, the record number field and the hash table in the sorting table to create an index of the data table. That is, when creating an index of a data table in the embodiment of the present disclosure, there is no need to use the key value field in the sorting table.

[0112] The index creation method provided by the embodiment of the present disclosure is to create a sorting table based on the target field of the data table, create a hash table based on the sorting table, and create an index of the data table based on the sorting table and the hash table, wherein the rows of the hash table corresponding to each key value each include a first pointer variable and a second pointer variable, the first pointer variable stores the entry number of the corresponding key value when it first appears in the sorting table, and the second pointer variable stores the entry number of the corresponding key value when it last appears in the sorting table. Using the index created by the embodiment of the present disclosure, even if the target field of the data table has a large number of duplicate key values ​​(that is, the target field is not unique), indexing it can effectively handle hash conflicts after deduplication.

[0113] In some practical applications of the present disclosure, in rare cases, hash values ​​corresponding to multiple different key values ​​may be assigned to the same position in the hash table.

[0114] Figure 31 is a flowchart of a method for creating a hash table based on a sorting table provided by other embodiments of the present disclosure. In order to avoid the problems caused by the aforementioned conflicts, the index table creation method provided by the embodiment of the present disclosure includes steps S1025A-S1025D when executing step S1025, and steps S1026 include steps S1026A-S1026E. When executing step S1021, it also includes initializing c=0.

[0115] Step S1025A: Calculate the corresponding row of the key value in the hash table in the key-value memory based on the hash function.

[0116] Step S1025B: Determine whether the first pointer variable and / or the second pointer variable of the corresponding row in the hash table has stored the entry number; if not, execute step S1025C; if so, execute step S1025D.

[0117] Step S1025C: Store the entry number in the first number storage device in the first pointer variable of the corresponding row, and store the entry number in the second number storage device in the second pointer variable of the corresponding row.

[0118] Step S1025D: Store the hash value corresponding to the key value in the hash value column of the cth row of the temporary table, store the entry number in the first number memory in the first entry number column of the cth row of the temporary table, and store the entry number in the second number memory in the second entry number column of the cth row of the temporary table.

[0119] Step S1026A: Calculate the corresponding row of the key value in the hash table in the key-value memory based on the hash function.

[0120] Step S1026B: Determine whether the first pointer variable and / or the second pointer variable of the corresponding row in the hash table has stored the entry number; if not, execute step S1026C; if so, execute step S1026D.

[0121] Step S1026C: Store the entry number in the first number storage in the first pointer variable of the corresponding row, and store the entry number in the second number storage in the second pointer variable of the corresponding row. Then execute step S1026E.

[0122] Step S1026D: Store the hash value corresponding to the key value in the hash value column of the c-th row of the temporary table, store the entry number in the first number storage device in the first entry number column of the c-th row of the temporary table, and store the entry number in the second number storage device in the second entry number column of the c-th row of the temporary table, and set c = c + 1. Then execute step S1026E.

[0123] Step S1026E: set i=i+1, store the key value of the i-th entry in the key value memory, and store the entry number of the i-th entry in the sorted table in the first number memory and the second number memory.

[0124] If the corresponding row in the hash table already stores the entry number, it indicates that a hash conflict has occurred. At this time, the hash value corresponding to this key value, the first occurrence entry number corresponding to this key value, and the last occurrence entry number are stored in a temporary table for subsequent processing.

[0125] After completing the execution of step S1025, the method provided by the embodiment of the present disclosure may further include step S1027.

[0126] Step S1027: Determine the number of extended rows according to the number of rows c of the temporary table, and add the extended rows at the end of the hash table; calculate the row corresponding to the hash value in the extended rows according to the number of rows c of the extended rows and the hash value stored in the temporary table; store the first entry number of the row corresponding to the hash value in the first pointer variable of the corresponding row in the extended rows; and store the second entry number of the row corresponding to the hash value in the second pointer variable of the corresponding row in the extended rows.

[0127] In a specific implementation, the hash value and the number of rows in the extended row may be modulo calculated to determine the row corresponding to the hash value in the extended row. After determining the row corresponding to the hash value in the extended row, the first entry number of the row corresponding to the hash value may be stored in the first pointer variable of the corresponding row in the extended row, and the second entry number of the row corresponding to the hash value may be stored in the second pointer variable of the corresponding row in the extended row, thereby implementing the storage of the entry numbers corresponding to the subsequent key values ​​with hash conflicts.

[0128] Figure 4 The present disclosure provides a flowchart of adding data of a temporary table to an extended row of a hash table. Figure 4 As shown, step S1027 includes steps S1027A-S1027F.

[0129] Step S1027A: Determine the number of extended rows according to the number of rows c in the temporary table, and add the extended rows to the end of the hash table so that b=0, d=0.

[0130] Step S1027B: Calculate the corresponding row of the hash value of row b in the temporary table in the extended row, and determine whether the first pointer variable and / or the second pointer variable of the corresponding row has stored the entry number. If yes, execute step S1027C; if not, execute step S1027D.

[0131] Step S1027C: Store the hash value of row b in row d of the new temporary table, store the entry number in the first entry number column of row b in the first entry number column of row d of the new temporary table, and store the entry number in the second entry number column of row b in the second entry number column of row d of the new temporary table, so that d=d+1, b=b+1. Then execute step S1027E.

[0132] Step S1027D: Store the entry number in the first entry number column of the bth row into the first pointer variable of the row corresponding to the extended row, and store the entry number in the second entry number column of the bth row into the second pointer variable of the row corresponding to the extended row, so that b = b + 1. Then execute step S1027E.

[0133] Step S1027E: Determine whether b is equal to c. If not, return to step S1027B; if so, execute step S1027F.

[0134] Step S1027F: Determine whether d is greater than 0; if so, set c=d and return to execute step S1027A; if not, the execution ends.

[0135] In addition to providing the aforementioned index creation method, the embodiment of the present disclosure also provides a target record search method for searching a target record in a data table based on an index created by the aforementioned index creation method. Figure 5 is a flow chart of a target record search method provided by an embodiment of the present disclosure, such as Figure 5 As shown, the target record search method provided by the embodiment of the present disclosure includes steps S501 to S503. It should be noted that the target record search method provided by the embodiment of the present disclosure can also be executed by a computing device.

[0136] Step S501: Based on a hash function, determine a target row corresponding to the key value to be searched in the hash table.

[0137] After determining the value to be searched, the computing device processes the value to be searched using a hash function to obtain a hash value. Subsequently, the target row in the hash table can be determined according to the hash value, and the target row is the target row of the value to be searched in the index table.

[0138] Step S502: Determine a target entry in the sorting table based on the first pointer variable and the second pointer variable in the target row.

[0139] After determining the target row in the hash table, the computing device can find the first pointer variable and the second pointer variable in the target row according to the row number of the target row (that is, the hash value calculated according to the value to be indexed), and determine the target entry in the sorted table based on the first pointer variable and the second pointer variable. According to the steps of the index creation method in the foregoing text, the target entry in the sorted table is the entry where the value to be searched is sorted in the sorted table.

[0140] Step S503: Determine the target record whose key value of the target field in the data table is the key value to be searched based on the record number of the target entry.

[0141] Because the target entry in the sorted table stores the record number of the key value to be searched in the data table, the target record whose key value of the target field in the data table is the key value to be searched can be determined based on the record number in the target entry.

[0142] In order to more clearly understand the target record search method provided by the embodiment of the present disclosure, the following description is made of Tables 1-3 to explain how to search for the target record corresponding to the key value to be searched in the data table. Assuming that the key value to be searched is Kia, the hash value obtained by processing the search key value Kia with a preset hash function is 5. Then search the 5th row in the hash table, and determine that the record number stored in the first pointer variable is 5, and the record number stored in the second pointer variable is 7. In other words, the entries in rows 5-7 in the sorted table store the target field with the key value of Kia. By searching the record numbers in rows 5-7 in the sorted table, it is determined that the 3rd, 8th, and 9th in the data table are the target records, that is, the records with the target field key value of Kia.

[0143] The target record search method provided by the embodiment of the present disclosure is adopted to determine the target row in the hash table based on the key value to be searched, determine the target entry in the sort table based on the first pointer variable and the second pointer variable in the target row, and determine the target record in the data table whose key value is the key value to be searched based on the record number in the target entry, thereby realizing fast search of the target record in the data table including the key value to be searched.

[0144] In some embodiments of the present disclosure, if the index table creation method adopts the aforementioned steps S1025A-S1025D, steps S1026A-S1026E and steps S1027-S1028 to solve the problem of key value hash conflict, the search method provided in the embodiment of the present disclosure will also execute steps S504-S507 after executing step S503.

[0145] Step S504: Determine whether the key value of the target record is the same as the key value to be searched; if so, terminate the execution; if not, execute step S505.

[0146] Step S505: determining the target row corresponding to the key value to be searched in the expanded rows;

[0147] Step S506: Determine a target entry in the sorting table based on the first pointer variable and the second pointer variable in the target row in the extended row.

[0148] Step S507: Determine the target record based on the record number of the target entry, and repeat step S504 until all extended rows in the hash table are queried.

[0149] If the corresponding target entry is found by the above method, it is determined that the key value to be searched has a match in the data table. If the target entry is not found by the above method, it is determined that the key value to be searched has no match in the data table.

[0150] Figure 6 Schematic diagram of the structure of the index table creation device provided by the embodiment of the present disclosure. Figure 6 As shown, the index table creation device 600 provided in the embodiment of the present disclosure includes a sort table creation unit 601 , a hash table creation unit 602 and an index table creation unit 603 .

[0151] The sorting table creation unit 601 is used to create a sorting table based on the target field of the data table, the sorting table is used to sort the key value of the target field, and each entry of the sorting table includes an entry number, a key value and a record number of the key value in the data table;

[0152] The hash table creation unit 602 is used to create a hash table based on the sorted table, wherein each row in the hash table corresponding to each key value includes a first pointer variable and a second pointer variable, wherein the first pointer variable stores the entry number when the same key value appears in the sorted table for the first time, and the second pointer variable stores the entry number when the same key value appears in the sorted table for the last time;

[0153] The index table creation unit 603 is used to create an index of the data table by using the entry number field, the record number field and the hash table in the sorting table.

[0154] In some embodiments of the present disclosure, the hash table creation unit 602 includes a first storage unit, a first judgment unit, a second storage unit, a second judgment unit, a third storage unit, a fourth judgment unit, a fourth storage unit, and a loop calling unit. :

[0155] The first storage unit is used to store the key value of the i-th entry in the sorted table into the key value memory, and store the entry number of the i-th entry in the sorted table into the first number memory and the second number memory, i=0.

[0156] The first judging unit is used to judge whether the key value of the (i+1)th entry in the sorting table is the same as the key value in the key value memory.

[0157] The second storage unit is used to store the entry number of the i+1th entry in the second number memory so that i=i+1 when the first judgment unit determines that the key value of the i+1th entry in the sorting table is the same as the key value in the key value memory.

[0158] The third storage unit is used to calculate the corresponding row of the key value in the key value memory in the hash table based on the hash function when the first judgment unit determines that the key value of the i+1th entry in the sorted table is different from the key value in the key value memory, store the entry number in the first number memory in the first pointer variable of the corresponding row, store the entry number in the second number memory in the second pointer variable of the corresponding row, so that i=i+1, store the key value of the i-th entry in the key value memory, and store the entry number of the i-th entry in the sorted table in the first number memory and the second number memory.

[0159] The second judgment unit is used for judging whether i is equal to N-1 after the second storage unit sets i=i+1.

[0160] The fourth storage unit is used to calculate the corresponding row of the key value in the key value memory in the hash table based on the hash function when the second judgment unit determines that i is equal to N-1, store the entry number in the first numbering memory in the first pointer variable of the corresponding row, and store the entry number in the second numbering memory in the second pointer variable of the corresponding row.

[0161] The cyclic calling unit is used to call the first judgment unit again when the second judgment unit or the fourth judgment unit determines that i is less than N-1.

[0162] In some embodiments of the present disclosure, the hash table creation unit 602 further includes a hash parameter determination unit. The hash parameter determination unit is used to obtain the number of deduplicated key values ​​in the sorting table, initialize the hash table based on the number of deduplicated key values, and determine the hash function.

[0163] In some embodiments of the present disclosure, the sorting table creating unit 601 uses a radix sorting algorithm to create the sorting table based on the target field in the data table.

[0164] Figure 7 is a schematic diagram of the structure of a target record search device provided by an embodiment of the present disclosure, Figure 7 The target record search device 700 shown searches for the target record based on the index table determined in the foregoing text. Figure 7As shown, the target record search device 700 includes a target row search unit 701 , a target entry search unit 702 and a target record search unit 703 .

[0165] The target row searching unit 701 is used to determine the target row corresponding to the key value to be searched in the hash table based on the hash function.

[0166] The target entry search unit 702 is used to determine the target entry in the sorting table based on the first pointer variable and the second pointer variable in the target row.

[0167] The target record search unit 703 is used to determine the target record whose key value of the target field in the data table is the key value to be searched based on the record number of the target entry.

[0168] An embodiment of the present disclosure also provides a computing device, which includes a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the above-mentioned index table creation method or target record search method can be implemented.

[0169] Figure 8 is a schematic diagram of the structure of a computing device provided by some embodiments of the present disclosure. Figure 8 As shown, the computing device 800 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage device 808 to a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the computing device 800 are also stored. The processing device 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0170] Typically, the following devices may be connected to the I / O interface 805: input devices 806 including, for example, a touch screen, a touch pad, a keyboard, a mouse, etc.; output devices 807 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 808 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 809. The communication devices 809 may allow the computing device 800 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 8 The computing device 800 is shown with various devices, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have instead.

[0171] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 809, or installed from a storage device 808, or installed from a ROM 802. When the computer program is executed by the processing device 801, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0172] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0173] The computer-readable medium may be included in the computing device, or may exist independently without being installed in the computing device. The computer-readable medium carries one or more programs, and when the one or more programs are executed by the computing device, the computing device implements the index table creation method or target record search method.

[0174] Computer program code for performing operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including but not limited to object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages.

[0175] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0176] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.

[0177] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0178] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0179] The embodiment of the present disclosure also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the above-mentioned index table creation method or target record search method can be implemented. Its execution method and beneficial effects are similar and will not be repeated here.

[0180] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for creating an index table, characterized in that: The method comprises: Creating a sorting table based on a target field of a data table, wherein the sorting table is used to sort the key value of the target field, and each entry of the sorting table includes an entry number, a key value, and a record number of the key value in the data table; Creating a hash table based on the sorted table, wherein each row in the hash table corresponding to each key value includes a first pointer variable and a second pointer variable, wherein the first pointer variable stores an entry number when the corresponding key value first appears in the sorted table, and the second pointer variable stores an entry number when the corresponding key value last appears in the sorted table; Using the entry number field, the record number field and the hash table in the sorting table, an index table of the data table is created; The step of creating a hash table based on the sorting table comprises: Step A: storing the key value of the i-th entry in the sorted table into the key value memory, and storing the entry number of the i-th entry in the sorted table into the first number memory and the second number memory, i=0; Step B: Determine whether the key value of the i+1th entry in the sorting table is the same as the key value in the key value storage; if so, execute step C; if not, execute step F; Step C: storing the entry number of the i+1th entry into the second number storage device, so that i=i+1; Step D: Determine whether i is equal to N-1; if so, execute step E; if not, execute step B; wherein N is the number of entries in the sorting table; Step E: calculating the corresponding row of the key value in the key value memory in the hash table based on the hash function, storing the entry number in the first number memory in the first pointer variable of the corresponding row, and storing the entry number in the second number memory in the second pointer variable of the corresponding row; Step F: Calculate the corresponding row of the key value in the key value memory in the hash table based on the hash function, store the entry number in the first number memory in the first pointer variable of the corresponding row, store the entry number in the second number memory in the second pointer variable of the corresponding row, make i=i+1, store the key value of the i-th entry in the key value memory, and store the entry number of the i-th entry in the sorted table in the first number memory and the second number memory; then execute step D.

2. The method according to claim 1, characterized in that: Before executing step A, the method further includes step G: obtaining the number of deduplicated key values ​​in the sorting table, initializing the hash table based on the number of deduplicated key values, and determining the hash function.

3. The method according to claim 1, characterized in that Step A includes: setting c=0; Step E includes E1-E4: E1: Calculate the corresponding row of the key value in the hash table in the key-value memory based on the hash function; E2: Determine whether the first pointer variable and / or the second pointer variable of the corresponding row in the hash table already stores the entry number; if not, execute step E3; if yes, execute step E4; Step E3: storing the entry number in the first number storage device in the first pointer variable of the corresponding row, and storing the entry number in the second number storage device in the second pointer variable of the corresponding row; Step E4: storing the hash value corresponding to the key value in the hash value column of the c-th row of the temporary table, storing the entry number in the first number storage device in the first entry number column of the c-th row of the temporary table, and storing the entry number in the second number storage device in the second entry number column of the c-th row of the temporary table; The step F also includes steps F1-F5; Step F1: Calculate the corresponding row of the key value in the hash table in the key value storage based on the hash function; Step F2: Determine whether the first pointer variable and / or the second pointer variable of the corresponding row in the hash table has stored the entry number; if not, execute step F3; if yes, execute step F4; Step F3: storing the entry number in the first number storage in the first pointer variable of the corresponding row, and storing the entry number in the second number storage in the second pointer variable of the corresponding row; then executing step F5; Step F4: store the hash value corresponding to the key value in the hash value column of the c-th row of the temporary table, store the entry number in the first number storage device in the first entry number column of the c-th row of the temporary table, and store the entry number in the second number storage device in the second entry number column of the c-th row of the temporary table, and make c=c+1; then execute step F5; Step F5: set i=i+1, and store the key value of the i-th entry in the key value memory, and store the entry number of the i-th entry in the sorted table in the first number memory and the second number memory; After executing step E, the method further includes: Step H: Determine the number of extended rows according to the number of rows c of the temporary table, and add the extended rows at the end of the hash table; calculate the row corresponding to the hash value in the extended rows according to the number of rows c of the extended rows and the hash value stored in the temporary table, and store the first entry number of the row corresponding to the hash value in the first pointer variable of the corresponding row in the extended rows, and store the second entry number of the row corresponding to the hash value in the second pointer variable of the corresponding row in the extended rows.

4. A target record search method, characterized in that: Searching for a target record in the data table based on the index table created by the method according to any one of claims 1 to 3, the target record search method comprising: Based on the hash function, determine the target row corresponding to the key value to be searched in the hash table; determining a target entry in the sorted table based on a first pointer variable and a second pointer variable in the target row; The target record whose key value of the target field in the data table is the key value to be searched is determined based on the record number in the target entry.

5. An index table creation device, characterized in that: The device comprises: A sorting table creation unit, used to create a sorting table based on a target field of a data table, wherein the sorting table is used to sort the key values ​​of the target field, and each entry of the sorting table includes an entry number, a key value, and a record number of the key value in the data table; a hash table creation unit, configured to create a hash table based on the sorted table, wherein each row in the hash table corresponding to each key value includes a first pointer variable and a second pointer variable, wherein the first pointer variable stores an entry number when the corresponding key value first appears in the sorted table, and the second pointer variable stores an entry number when the corresponding key value last appears in the sorted table; An index table creation unit, used to create an index table of the data table by using the entry number field, the record number field and the hash table in the sorting table; The hash table creation unit comprises: A first storage unit is used to store the key value of the i-th entry in the sorted table into a key value memory, and store the entry number of the i-th entry in the sorted table into a first number memory and a second number memory, i=0; A first judging unit, used to judge whether the key value of the i+1th entry in the sorting table is the same as the key value in the key value memory; a second storage unit, configured to store the entry number of the i+1th entry in the second number storage unit so that i=i+1, if the first judgment unit determines that the key value of the i+1th entry in the sorting table is the same as the key value in the key value storage unit; a third storage unit, for, when the first judgment unit determines that the key value of the i+1th entry in the sorted table is different from the key value in the key value memory, calculating the corresponding row of the key value in the key value memory in the hash table based on the hash function, storing the entry number in the first number memory in the first pointer variable of the corresponding row, storing the entry number in the second number memory in the second pointer variable of the corresponding row, making i=i+1, storing the key value of the i-th entry in the key value memory, and storing the entry number of the i-th entry in the sorted table in the first number memory and the second number memory; A second judgment unit, used for judging whether i is equal to N-1 after the second storage unit sets i=i+1; a fourth storage unit, configured to, when the second judgment unit determines that i is equal to N-1, calculate a corresponding row of the key value in the key value storage device in the hash table based on a hash function, store the entry number in the first number storage device in the first pointer variable of the corresponding row, and store the entry number in the second number storage device in the second pointer variable of the corresponding row; The cyclic calling unit is used to call the first judgment unit again when the second judgment unit or the fourth judgment unit determines that i is less than N-1.

6. A target record search device, characterized in that: Based on the index table created by the method according to any one of claims 1 to 3, the target record whose key value of the target field in the data table is the key value to be searched is searched, and the record search device comprises: A target row search unit, used to determine the target row corresponding to the key value to be searched in the hash table based on a hash function; A target entry search unit, configured to determine a target entry in the sorted table based on a first pointer variable and a second pointer variable in the target row; A target record search unit is used to determine the target record whose key value of the target field in the data table is the key value to be searched based on the record number of the target entry.

7. An electronic device, characterized in that: include: A processor, wherein the processor is used to execute a computer program stored in a memory, wherein the computer program, when executed by the processor, implements the steps of the method according to any one of claims 1 to 3, or the steps of the method according to claim 4.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 3 or the steps of the method according to claim 4 are implemented.

Citation Information

Patent Citations

  • Method, system and non-transitory computer readable medium for searching target key

    CN112540981A