CN115576954B - Hash table determining method and device - Google Patents
Hash table determining method and device Download PDFInfo
- Publication number
- CN115576954B CN115576954B CN202211480873.8A CN202211480873A CN115576954B CN 115576954 B CN115576954 B CN 115576954B CN 202211480873 A CN202211480873 A CN 202211480873A CN 115576954 B CN115576954 B CN 115576954B
- Authority
- CN
- China
- Prior art keywords
- hash
- target
- hash table
- preset
- determining
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/2228—Indexing structures
- G06F16/2255—Hash tables
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Computational Linguistics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application provides a method and a device for determining a hash table, wherein the method for determining the hash table comprises the following steps: responding to a hash table creation request aiming at a target business data table, and determining at least one hash algorithm to be matched; respectively calculating to obtain service field information in the target service data table through each hash algorithm to be matched, and obtaining a reference hash table generated by the target service data table according to each hash algorithm to be matched; and determining a reference hash table with the hash collision number less than or equal to a preset threshold value as a target hash table corresponding to the target service data table.
Description
Technical Field
The application relates to the technical field of computers, in particular to a hash table determining method. The application also relates to a hash table determination device, a computing device and a computer readable storage medium.
Background
With the continuous development of computer technology, users can store data through the data table, so that the data can be conveniently inquired based on the data table.
Currently, in order to reduce the complexity of the query algorithm, a method of creating a hash table corresponding to a data table is often adopted, and data query is performed based on the hash table, so that higher algorithm complexity is avoided.
However, the current use of the same hash algorithm for different data tables in the database to calculate corresponding hash tables causes the problems of higher hash value collision number in the hash tables, larger hash tables and lower query speed; therefore, how to determine the hash table with high query efficiency becomes a technical problem to be solved urgently by those skilled in the art.
Disclosure of Invention
In view of this, the present application provides a method for determining a hash table. The present application also relates to a hash table determination apparatus, a computing device, and a computer-readable storage medium, which are used to solve the above problems in the prior art.
According to a first aspect of embodiments of the present application, a method for determining a hash table is provided, including:
responding to a hash table creation request aiming at a target business data table, and determining at least one hash algorithm to be matched;
respectively calculating to obtain service field information in the target service data table through each hash algorithm to be matched, and obtaining a reference hash table generated by the target service data table according to each hash algorithm to be matched;
and determining a reference hash table with the hash collision number smaller than or equal to a preset threshold value as a target hash table corresponding to the target service data table.
According to a second aspect of the embodiments of the present application, there is provided a hash table determination apparatus, including:
the first determining module is configured to respond to a hash table creation request aiming at the target business data table and determine at least one hash algorithm to be matched;
the calculation module is configured to calculate and obtain the service field information in the target service data table through each hash algorithm to be matched respectively, and obtain a reference hash table generated by the target service data table according to each hash algorithm to be matched;
and the second determining module is configured to determine that the reference hash table with the hash collision number smaller than or equal to a preset threshold is the target hash table corresponding to the target service data table.
According to a third aspect of embodiments of the present application, there is provided a computing device comprising a memory, a processor and computer instructions stored on the memory and executable on the processor, the processor implementing the steps of the method for determining the hash table when executing the computer instructions.
According to a fourth aspect of embodiments of the present application, there is provided a computer-readable storage medium storing computer instructions which, when executed by a processor, implement the steps of the method for determining a hash table.
The method for determining the hash table, provided by the application, is used for responding to a hash table creation request aiming at a target service data table and determining at least one hash algorithm to be matched; respectively calculating to obtain service field information in the target service data table through each hash algorithm to be matched, and obtaining a reference hash table generated by the target service data table according to each hash algorithm to be matched; and determining a reference hash table with the hash collision number smaller than or equal to a preset threshold value as a target hash table corresponding to the target service data table.
The embodiment of the application realizes that at least one hash algorithm to be matched is determined, so that the hash algorithm for generating the hash table is determined based on each hash algorithm to be matched; respectively calculating the service field information corresponding to each hash algorithm to be matched so as to generate a reference hash table corresponding to each hash algorithm to be matched; and selecting the reference hash table with the hash collision number smaller than the preset threshold value as the target hash table corresponding to the target service data table, so as to obtain the hash table with higher efficiency in subsequent query, and further facilitate the subsequent improvement of the query efficiency of the target service data table.
Drawings
Fig. 1 is a schematic diagram of a hash table determination method according to an embodiment of the present application;
fig. 2 is a flowchart of a hash table determination method according to an embodiment of the present application;
fig. 3 is a processing flow chart of a method for determining a hash table applied to an employee information data table according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a hash table determining apparatus according to an embodiment of the present application;
fig. 5 is a block diagram of a computing device according to an embodiment of the present application.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. This application is capable of implementation in many different ways than those herein set forth and of similar import by those skilled in the art without departing from the spirit of this application and is therefore not limited to the specific implementations disclosed below.
The terminology used in the one or more embodiments of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of the present application. As used in one or more embodiments of the present application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used in one or more embodiments of the present application refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It will be understood that, although the terms first, second, etc. may be used herein in one or more embodiments of the present application to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first aspect may be termed a second aspect, and, similarly, a second aspect may be termed a first aspect, without departing from the scope of one or more embodiments of the present application. The word "if," as used herein, may be interpreted as "at … …" or "at … …" or "in response to a determination," depending on the context.
First, the noun terms to which one or more embodiments of the present application relate are explained.
A hash table: the hash table is a linear data structure that maps a key to a value and uses the value for direct access to speed up the lookup, and a mapping method of mapping a key to a value is called a hash algorithm.
Hash collision: when two different keywords are calculated by the hash algorithm to obtain the same result, that is, they are mapped to the same position of the hash table, it is said that a hash collision occurs. It is simply the address calculated by the hash algorithm that is occupied by another element.
As an example of fields of a database table, a database usually has a plurality of tables, each table has a plurality of fields, and the fields are generally kept unchanged during the runtime, all the fields of each table are called a batch of fixed entries, and the field names are keys. If the entry needs to be searched for many times, that is, corresponding field attribute information, such as length information, type information and the like, needs to be acquired according to the field name for many times, an index is often established to accelerate the search speed; if only one entry is required to be searched, and ordering is not required, a hash table is generally adopted to achieve the algorithm complexity of O (1). The actual lookup speed of the hash table depends mainly on the hash collision number and the hash table size.
For different batches of entries, the same hash algorithm is used, the number of possible conflicts is large, the hash table is large, and finally the lookup speed is low. According to the scheme, the hash algorithm is selected from the multiple hash algorithms aiming at different batches of entries to be used for building the hash table, so that the searching speed is improved.
In the present application, a hash table determination method is provided, and the present application relates to a hash table determination apparatus, a computing device, and a computer-readable storage medium, which are described in detail in the following embodiments one by one.
Fig. 1 is a schematic diagram of a hash table determination method provided in an embodiment of the present application, receiving a hash table creation request, and parsing the hash table creation request to determine that a target service data table of the hash table creation request exists; meanwhile, determining a hash algorithm set which can be used for creating a hash table, wherein the hash algorithm set comprises a hash algorithm 1, a hash algorithm 2 and a hash algorithm 3; determining a preset hash calculation initial value seed1 and a preset hash size threshold size1, and calculating fields in a target service data table based on the preset hash calculation initial value seed1, the preset hash size threshold size1 and each hash algorithm to obtain a reference hash table corresponding to each hash algorithm, wherein the reference hash table comprises a reference hash table 1, a reference hash table 2 and a reference hash table 3. It should be noted that in the present application, the field names in the target service data table are calculated by the hash algorithm, not the service data corresponding to the fields in the target service data.
Referring to fig. 1, after determining the hash table corresponding to each hash algorithm, determining the number of collisions corresponding to each hash table, specifically, the target service data table and the hash table corresponding to each hash algorithm are shown in the following table 1:
TABLE 1
In the reference hash table 1, if the hash value corresponding to the field 1 and the hash value corresponding to the field 2 are both 2, determining that the hash value 2 has a conflict in the reference hash table 1, and determining that the number of conflicts corresponding to the reference hash table 1 is 1; in the reference hash table 2, if the hash values corresponding to the field 1 and the field 2 are both 3, and the hash values corresponding to the field 3 and the field 4 are both 4, it is determined that the hash values 3 and 4 have conflicts in the hash table, and it is determined that the number of conflicts corresponding to the reference hash table 2 is 2; in the reference hash table 3, if no hash value with collision exists, determining that the collision value corresponding to the reference hash table 3 is 0; since the number of collisions greatly affects the query efficiency of the hash table, the reference hash table 3 with the smallest number of collisions may be selected as the target hash table corresponding to the target service data table.
Further, if the number of collisions corresponding to each obtained reference hash table is greater than the preset number of collisions, the preset hash calculation initial value seed1 and/or the preset hash size threshold size1 may be adjusted, a new reference hash table is determined based on the new seed, size and each hash algorithm, and the reference hash table with the smaller number of collisions is selected from the new reference hash table as the target hash table.
The method for determining the hash table obtains a plurality of reference hash tables based on a plurality of hash algorithms; selecting a hash table with a smaller number of collisions based on the hash collision number corresponding to the reference hash table; further, under the condition that the number of conflicts does not meet the requirement, after the preset hash calculation initial value and the preset hash size threshold value are adjusted, a new reference hash table is determined, and a target hash table with a smaller number of conflicts is determined in the new reference hash table, namely, the target hash table capable of improving the query efficiency of the subsequent target service data table is determined.
Fig. 2 is a flowchart illustrating a method for determining a hash table according to an embodiment of the present application, which specifically includes the following steps:
step 202: and responding to a hash table creation request aiming at the target business data table, and determining at least one hash algorithm to be matched.
In practical application, when a certain field in a data table is searched, a hash table mode can be usually adopted; the field query is completed based on the hash table, so that the complexity of a search algorithm can be reduced; the hash table generation needs to be based on a hash algorithm, and the same hash algorithm can be adopted for different data tables to obtain corresponding hash tables; however, the number of hash table collisions obtained by using the same hash algorithm for different data tables may be large, so that the subsequent lookup speed based on the hash table is slow, and the field lookup efficiency is affected.
Therefore, according to the scheme of the application, after the hash table creation request for the target service data table is received, a plurality of hash algorithms which can be used for creating the hash table can be determined, so that a plurality of hash tables corresponding to the data table can be obtained based on the plurality of hash algorithms subsequently.
The target service data table is a data table with a hash table creation requirement, and a data table structure of the data table usually includes a service field and a corresponding field type, for example, the target service data table includes a field name "and a corresponding field type" char (16) ", a field name" age "and a corresponding field type" int ", a field name" seq "and a corresponding field type" char "; the hash table creation request refers to a request for creating a hash table for a target service data table, for example, a hash table creation request for creating a hash table for a department personnel data table; the hash algorithm to be matched is a hash algorithm which can be used for creating a hash table for a target service data table, and in practical application, the hash algorithm can be an algorithm which can meet the requirement of creating the hash table, such as BKDR, DJB, SDBM, DEK, FNV1 and the like, and the application is not specifically limited; by determining at least one hash algorithm to be matched, the reference hash table of the target business data table corresponding to each algorithm to be matched can be conveniently determined in the follow-up process, and then the hash table with higher query efficiency can be selected from the multiple reference hash tables.
Specifically, a hash table creation request for a target service data table is received; responding to a hash table establishing request, and determining at least one hash algorithm to be matched corresponding to a target service data table; and forming a hash algorithm set to be matched by each hash algorithm to be matched.
In a specific embodiment of the present application, a hash table creation request for a target service data table is received, where the target service data table includes field names and field types corresponding to each field name; and responding to the hash table creation request, and determining at least one hash algorithm corresponding to the target service data table, wherein the hash algorithm comprises a BKDR hash algorithm, a DJB hash algorithm, an SDBM hash algorithm and the like.
At least one hash algorithm to be matched corresponding to the target business data table is determined by responding to the target business data table creation request, so that the hash table corresponding to each hash algorithm to be matched is conveniently determined in the follow-up process, and the hash table with high searching efficiency can be selected from the plurality of hash tables.
Step 204: and respectively calculating to obtain the service field information in the target service data table through each hash algorithm to be matched, and obtaining a reference hash table generated by the target service data table according to each hash algorithm to be matched.
After at least one hash algorithm to be matched is determined, a reference hash table corresponding to the target service data table can be calculated based on each hash algorithm to be matched, so that selection is convenient to be performed in the reference hash table corresponding to each hash algorithm to be matched.
The service field information refers to a hash value corresponding to a service field in the target service data table, and the service field information can also be understood as a hash value obtained after the field name in the target service data table is calculated through a hash algorithm; in practical application, the service fields in the target service data table can be converted based on a hash algorithm to be matched to obtain a hash value corresponding to each service field, namely service field information; for example, the target service data table includes a service field "age", and the "age" is converted into a corresponding hash value 2, that is, the service field information of the service field "age" is 2; the reference hash table refers to each reference hash table corresponding to the target service data table generated based on each hash algorithm to be matched, for example, a hash value corresponding to each service field in the target service data table is calculated based on the hash algorithm 1, and the reference hash table corresponding to the hash algorithm 1 is generated based on each hash value and the corresponding service field.
Specifically, a target hash algorithm to be matched in at least one hash algorithm to be matched is determined; calculating the service field information corresponding to each service field in the target service data table based on the target hash algorithm to be matched, and generating a reference hash table based on the service field and the service field information; and taking each hash algorithm to be matched as a target hash algorithm to be matched, thereby obtaining a reference hash table corresponding to each target hash algorithm to be matched.
In a specific embodiment of the application, a target service data table is determined, and a hash algorithm 1, a hash algorithm 2 and a hash algorithm 3 are determined; calculating service field information corresponding to a service field in a target service data table based on a Hash algorithm 1 to generate a Hash table a; calculating service field information corresponding to the service field in the target service data table based on a Hash algorithm 2 to generate a Hash table b; calculating service field information corresponding to the service field in the target service data table based on a Hash algorithm 3 to generate a Hash table c; namely, a reference hash table a, a reference hash table b and a reference hash table c generated by the target service data table according to the hash algorithm 1, the hash algorithm 2 and the hash algorithm 3 are obtained.
Further, the method for obtaining the service field information in the target service data table through calculation by each hash algorithm to be matched may include:
determining a preset hash calculation initial value and a preset hash size threshold value;
and calculating to obtain the service field information corresponding to each service field of the target data table based on the preset Hash calculation initial value, the preset Hash size threshold value and each Hash algorithm to be matched.
The preset hash calculation initial value is a hash calculation initial value used for calculating a hash value, and in practical application, the preset hash calculation initial value can be circularly multiplied to calculate a hash value corresponding to a field; the preset initial hash calculation value can be set based on actual requirements, and in a preferred embodiment, the initial hash calculation value can be an odd number; taking the hash algorithm to be matched as the BKDR algorithm as an example, the initial value of the hash calculation may be 31, 131, 1313, 13131, or the like; the preset hash size threshold refers to a storage size of a preset hash table, for example, a preset hash size threshold of 5 indicates that the hash table may include 5 hash values; the preset hash SIZE threshold is also used for calculating a hash value corresponding to the field, and in practical application, as the SIZE of the hash table is limited, modulo operation needs to be performed, that is, hash = hash% SIZE, where hash refers to the hash value and SIZE refers to the SIZE of the hash table.
Specifically, a preset hash calculation initial value and a preset hash size threshold value set based on actual requirements are obtained; calculating the service field information corresponding to the hash algorithm to be matched based on a preset hash calculation initial value, a preset hash size threshold value and any one hash algorithm to be matched; and similarly, calculating and obtaining the service field information of the target service data table corresponding to each hash algorithm to be matched.
In a specific embodiment of the present application, a preset hash calculation initial value seed1 and a preset hash size threshold size1 are determined; determining a hash algorithm 1 and a hash algorithm 2 corresponding to the target business data table; calculating to obtain service field information corresponding to each service field in the target service data table according to a preset hash calculation initial value seed1, a preset hash size threshold size1 and a hash algorithm 1; and calculating the service field information corresponding to each service field in the target service data table according to the preset hash calculation initial value seed1, the preset hash size threshold size1 and the hash algorithm 2.
And calculating the service field information corresponding to each hash algorithm to be matched so as to generate a hash table corresponding to the target service data table based on the service field information corresponding to each hash algorithm to be matched.
Further, after determining the service field information corresponding to different algorithms to be matched, a reference hash table of the target service data table corresponding to the algorithm to be matched may be generated based on the service field information corresponding to the algorithm to be matched and the service field in the target service data table.
Specifically, the method for obtaining the reference hash table generated by the target service data table according to each hash algorithm to be matched may include:
and generating a reference hash table corresponding to each hash algorithm to be matched according to the service field information corresponding to each hash algorithm to be matched.
In a specific embodiment of the application, determining that the hash algorithm to be matched is a BKDR algorithm; determining that a preset hash calculation initial value seed is equal to 1 and a preset hash size threshold size is equal to 5; calculating to obtain the service field information of a field a, the service field information of a field b and the service field information of a field c corresponding to the data table L based on a preset hash calculation initial value, a preset hash size threshold value and a BKDR algorithm, wherein the service field information is 4, the service field information of the field b is 2 and the service field information of the field c is 2; and generating a reference hash table of the data table L corresponding to the BKDR algorithm based on the service field and the service field information.
And generating a reference hash table corresponding to each hash algorithm to be matched based on the service field information corresponding to each hash algorithm to be matched and the service field of the target service data table, so as to determine the hash table corresponding to the target service data table in each reference hash table subsequently.
Step 206: and determining a reference hash table with the hash collision number smaller than or equal to a preset threshold value as a target hash table corresponding to the target service data table.
The hash collision number refers to the number of hash values with which hash values in a hash table collide, for example, the hash table includes hash values 2, 3, 2, and 4, and since two hash values are "2", it is determined that the hash collision number corresponding to the hash table is 1, that is, one hash value collides; the preset threshold value is an upper limit value of the hash collision number set based on actual requirements; if the hash collision number corresponding to the hash table is larger than a preset threshold value, determining that the hash table has more hash collisions, and causing the problem of slow searching speed when the hash table is subsequently used for searching a data table; the target hash table is a hash table with high query efficiency selected from the reference hash table.
In a specific embodiment of the present application, it is determined that the number of collisions corresponding to the reference hash table 1 is 2, the number of collisions corresponding to the reference hash table 2 is 1, and the number of collisions corresponding to the reference hash table 3 is 0; and if the preset threshold value is 0, determining that the reference hash table 3 is a target hash table corresponding to the target service data table.
In practical application, the method for determining the reference hash table with the hash collision number less than or equal to the preset threshold as the target hash table corresponding to the target service data table may include:
determining at least one target reference hash table with the hash collision number less than or equal to a preset threshold value;
sorting the reference hash tables according to the hash collision number from large to small based on each target reference hash table to obtain a reference hash table queue;
and selecting a target reference hash table positioned at the tail of the queue in the reference hash table queue as a target hash table corresponding to the target service data table.
Specifically, if a plurality of reference hash tables with hash collision numbers less than or equal to a preset threshold are obtained, each reference hash table may be sorted based on the hash collision numbers, and the reference hash table with the smallest hash collision number is selected as a target reference hash table corresponding to the target service data table; if the obtained reference hash table with the hash collision number being equal to or less than the preset threshold value has the condition of equal hash collision number, determining the hash size threshold value corresponding to the reference hash table with the equal hash collision number, wherein the smaller the hash size threshold value, the higher the query efficiency of the corresponding reference hash table; therefore, in the case where the hash collision numbers are consistent, the reference hash table having a smaller hash size threshold value may be selected as the target hash table.
In a specific embodiment of the application, if the hash collision numbers of the reference hash table 1, the reference hash table 2 and the reference hash table 3 corresponding to the target service data table are all smaller than the preset threshold value 2, the hash tables can be sorted based on the hash collision numbers, and the reference hash table 1 with the smallest hash collision number is determined; the hash table 1 will be referred to as a target hash table corresponding to the data table D.
In the above description, the reference hash table with the size less than or equal to the preset threshold may be obtained, but in practical application, the hash collision number corresponding to each reference hash table may be greater than the preset threshold, and at this time, the reference hash table may be obtained again by adjusting the preset hash to calculate the initial value and the preset hash size threshold.
Specifically, the method for modifying the initial value of the preset hash calculation may include:
determining a current hash calculation initial value based on the preset hash calculation initial value under the condition that a reference hash table with the hash collision number smaller than or equal to a preset threshold value is not acquired;
establishing a first reference hash table corresponding to each hash algorithm to be matched based on the current hash calculation initial value and the preset hash size threshold;
and determining a target first reference hash table with the hash collision number smaller than or equal to a preset threshold value as a target hash table.
The current hash calculation initial value refers to a hash calculation initial value obtained based on a preset hash calculation initial value, for example, if the preset hash calculation initial value is 3, the current hash calculation initial value may be obtained by adding 2 to the preset hash calculation initial value, that is, 5; in practical application, the initial hash calculation value has a preset value range, and the initial hash calculation value unequal to the preset initial hash calculation value can be arbitrarily selected in the value range to serve as the current initial hash calculation value.
The first reference hash table is a hash table generated by calculating the service field information of the target service data table according to the current hash calculation initial value and a preset hash size threshold; the target first reference hash table is a first reference hash table with the hash collision number less than or equal to a preset threshold value.
Specifically, a current hash calculation initial value is determined according to a preset hash calculation initial value; determining each hash algorithm to be matched corresponding to the target business data table, and generating a first reference hash table of the target business data table corresponding to each hash algorithm to be matched according to each hash algorithm to be matched, the current hash calculation initial value and a preset hash size threshold; and selecting a target first reference hash table with the hash collision number less than or equal to a preset threshold value from the first reference hash table as a target hash table.
In a specific embodiment of the application, based on a preset hash calculation initial value, a preset hash size threshold value and each hash algorithm to be matched, if the number of hash table conflicts is greater than a preset threshold value, adding 2 to the preset hash calculation initial value 3 to obtain a current hash calculation initial value 5; calculating a first reference hash table 6, a first reference hash table 7 and a first reference hash table 8 corresponding to the data table K based on the current hash calculation initial value 5, the preset hash size threshold value and each hash algorithm to be matched; and taking the first reference hash table 8 with the hash collision number smaller than the preset threshold value as a target hash table corresponding to the data table K.
Further, since the initial hash calculation value has a value range, if the hash collision numbers corresponding to the hash tables generated based on the initial hash calculation value within the value range are all greater than the preset threshold, the preset hash size threshold may be further adjusted.
Specifically, the method for modifying the preset hash size threshold further includes:
under the condition that a first reference hash table with the hash collision number smaller than or equal to a preset threshold value is not acquired, determining a current hash size threshold value based on the preset hash size threshold value;
establishing a second reference hash table corresponding to each hash algorithm to be matched according to the current hash calculation initial value and the current hash size threshold value;
and determining a target second reference hash table with the hash collision number smaller than or equal to a preset threshold value as a target hash table.
The current hash size threshold value is a hash size threshold value obtained based on a preset hash size threshold value; for example, if the preset hash size threshold is 5, the current hash size threshold may be 6; in practical application, the larger hash size threshold value affects the efficiency of subsequent lookup based on the hash table, so that the hash size threshold value is increased under the condition that the hash table meeting the requirement cannot be obtained after the hash algorithm to be matched is adjusted and the initial hash calculation value is preset.
The second reference hash table is a hash table generated by calculating the service field information of the target service data table according to the current hash calculation initial value and the current hash size threshold; the target second reference hash table is a second reference hash table with the hash collision number less than or equal to a preset threshold value.
Specifically, a current hash size threshold is determined according to a preset hash size threshold; and determining each hash algorithm to be matched corresponding to the target business data table, and generating a second reference hash table of the target business data table corresponding to each hash algorithm to be matched according to each hash algorithm to be matched, the current hash calculation initial value and the current hash size threshold value.
In a specific embodiment of the present application, 1 is added on the basis of a preset hash size threshold 5 to obtain a current hash size threshold 6; calculating each second reference hash table 2 and each second reference hash table 3 corresponding to the target service data table according to the current hash size threshold 6, the current hash calculation initial value 5 and each hash algorithm to be matched corresponding to the target service data table; and selecting a second reference hash table 3 with the hash collision number equal to a preset threshold value from each second reference hash table as a target hash table corresponding to the target service data table.
By adjusting the preset hash calculation initial value or the preset hash size threshold, a new hash table is created for the target business data table, and the target hash table is determined again in the new hash table, so that the target hash table with higher follow-up query efficiency can be obtained, and the query efficiency of the target business data table can be improved.
After determining the target hash table corresponding to the target service data table, the query of the target service data table may be completed based on the target hash table.
In practical application, after determining that the reference hash table with the hash collision number less than or equal to the preset threshold is the target hash table corresponding to the target service data table, the method further includes:
and determining the hash algorithm to be matched corresponding to the target hash table as a target hash algorithm.
Specifically, the target hash algorithm refers to a hash algorithm used for creating the target hash table.
In a specific embodiment of the present application, the hash algorithm used by the target hash table a is determined to be a DJB algorithm.
And determining a target hash algorithm corresponding to the target hash table so as to complete the query of the target service data table based on the target hash algorithm in the following.
Specifically, the method further comprises:
receiving a data query request aiming at a target service data table, and determining the target hash table and the target hash algorithm;
and executing the data query request based on the target hash table and the target hash algorithm to obtain a data query result.
The data query request refers to a request for querying service data in a target service data table; determining a target hash table and a target hash algorithm corresponding to the target service data table under the condition of determining to perform data query on the target service data table; the data query result refers to a result obtained by executing the data query request, for example, the field type corresponding to the field name age in the department staff table is queried to be int type.
Further, the method for obtaining the data query result by executing the data query request based on the target hash table and the target hash algorithm may include:
determining a field to be queried in the data query request;
calculating a field hash value corresponding to the field to be queried based on the target hash algorithm;
and determining a target field corresponding to the field hash value in the hash table, and obtaining a data query result based on the target field.
The field to be queried refers to a field to be queried, such as a name field, an age field, and the like; the field hash value is the hash value corresponding to the field to be inquired; in practical application, in order to realize a search function based on a target hash table, a field hash value corresponding to a field to be queried needs to be calculated based on a target hash algorithm corresponding to the target hash table; the target field refers to a field corresponding to a field hash value in the target hash table.
Specifically, the data query request is analyzed to obtain a field to be queried; calculating a field hash value corresponding to a field to be queried according to a target hash algorithm; determining a target field corresponding to the field hash value based on the field hash value in the target hash table; and inquiring field information corresponding to the target field in the target service data table based on the target field, namely obtaining a data inquiry result.
In a specific embodiment of the present application, a data query request is parsed to determine a field "name" to be queried; calculating a field hash value 4 corresponding to the field 'name' to be inquired based on a target hash algorithm corresponding to the target service data table; according to the field hash value 4, a target field 'name' in a position corresponding to the field hash value 4 is taken from a target hash table; further, according to the target field "name", field information corresponding to the target field "name" is taken from the service data table as a data query result corresponding to the data query request.
The method for determining the hash table, provided by the application, is used for responding to a hash table creation request aiming at a target service data table and determining at least one hash algorithm to be matched; respectively calculating to obtain service field information in the target service data table through each hash algorithm to be matched, and obtaining a reference hash table generated by the target service data table according to each hash algorithm to be matched; and determining a reference hash table with the hash collision number smaller than or equal to a preset threshold value as a target hash table corresponding to the target service data table.
The embodiment of the application realizes that at least one hash algorithm to be matched is determined, so that the hash algorithm for generating the hash table is determined based on each hash algorithm to be matched; respectively calculating the service field information corresponding to each hash algorithm to be matched so as to generate a reference hash table corresponding to each hash algorithm to be matched; and selecting the reference hash table with the hash collision number smaller than the preset threshold value as the target hash table corresponding to the target service data table, so as to obtain the hash table with higher efficiency in subsequent query, and further facilitate the subsequent improvement of the query efficiency of the target service data table.
The following describes the method for determining a hash table further by taking an application of the method for determining a hash table provided in the present application to an employee information data table as an example, with reference to fig. 3. Fig. 3 shows a processing flow chart of a method for determining a hash table applied to an employee information data table according to an embodiment of the present application, which specifically includes the following steps:
step 302: and responding to a hash table creation request aiming at the employee information data table, and determining a hash algorithm set to be matched.
Specifically, the employee information data table includes service fields "name", "birthday", "native", "age", and "six". The hash algorithm set to be matched comprises a hash algorithm 1, a hash algorithm 2 and a hash algorithm 3.
Step 304: and determining a preset hash calculation initial value and a preset hash size threshold value.
Step 306: and calculating the hash value corresponding to each business field in the employee information data table based on the preset hash calculation initial value, the preset hash size threshold value and each hash algorithm to be matched.
Specifically, a hash value corresponding to each service field in the employee information data table is calculated through a hash algorithm 1, a preset hash calculation initial value and a preset hash size threshold, so that a hash value 1 corresponding to a service field ' name ', a hash value 2 corresponding to a birthday ', a hash value 3 corresponding to a native ', a hash value 3 corresponding to an age ' and a hash value 4 corresponding to a ' sex ' are obtained;
calculating a hash value corresponding to each service field in the employee information data table through a hash algorithm 2, a preset hash calculation initial value and a preset hash size threshold value to obtain a hash value 1 corresponding to a service field ' name ', a hash value 2 corresponding to a birthday ', a hash value 3 corresponding to a native ', a hash value 4 corresponding to an age ' and a hash value 5 corresponding to a ' six ';
calculating a hash value corresponding to each service field in the employee information data table through a hash algorithm 3, a preset hash calculation initial value and a preset hash size threshold, and obtaining a hash value 1 corresponding to a service field ' name ', a hash value 1 corresponding to a birthday ', a hash value 3 corresponding to a native ', a hash value 3 corresponding to an age ' and a hash value 4 corresponding to a ' sex '.
Step 308: and generating a reference hash table corresponding to each hash algorithm to be matched according to the hash value of the service field corresponding to each hash algorithm to be matched.
Specifically, as shown in table 2 below, a reference hash table a corresponding to the hash algorithm 1 is generated based on the hash value 1 corresponding to the service field "name", the hash value 2 corresponding to "birthday", the hash value 3 corresponding to "native", the hash value 3 corresponding to "age", and the hash value 4 corresponding to "six"; generating a reference hash table b corresponding to a hash algorithm 2 based on a hash value 1 corresponding to a business field 'name', a hash value 2 corresponding to a 'birthday', a hash value 3 corresponding to a 'native', a hash value 4 corresponding to an 'age' and a hash value 5 corresponding to an 'six'; and generating a corresponding reference hash table c based on the hash value 1 corresponding to the service field 'name', the hash value 1 corresponding to the 'birthday', the hash value 3 corresponding to the 'native', the hash value 3 corresponding to the 'age' and the hash value 4 corresponding to the 'six'.
TABLE 2
Staff information data sheet | name | birth | native | age | sex |
Reference hash table a | 1 | 2 | 3 | 3 | 4 |
Reference |
1 | 2 | 3 | 4 | 5 |
Reference |
1 | 1 | 3 | 3 | 4 |
Step 310: and determining each target reference hash table with the hash collision number smaller than or equal to a preset threshold value.
Specifically, determining that the hash values of the service field "native" and the service field "age" in the reference hash table a have a conflict, and setting the number of conflicts corresponding to the reference hash table a to be 1; determining that no conflict exists in the hash value corresponding to the service field in the reference hash table b, and determining that the number of conflicts corresponding to the reference hash table b is 0; and determining that the business field 'name' in the reference hash table c conflicts with the business field 'birthday' hash value, and determining that the business field 'native' conflicts with the business field 'age', and determining that the number of conflicts corresponding to the reference hash table c is 2.
And if the preset threshold value is determined to be 1, taking the reference hash table b and the reference hash table a as target hash tables.
Step 312: and sequencing each target reference hash table according to the hash collision number from large to small to obtain a reference hash table queue.
Specifically, the reference hash table b and the reference hash table a are sorted based on hash collision to obtain a hash table queue: refer to hash table a and hash table b.
Step 314: and selecting a target reference hash table positioned at the tail of the queue in the reference hash table queue as a target hash table corresponding to the employee information data table.
Specifically, the reference hash table b located at the tail of the queue, that is, the reference hash table b with the minimum hash collision number is selected as the target hash table.
Step 316: and determining the hash algorithm to be matched corresponding to the target hash table as a target hash algorithm.
Specifically, the hash algorithm 2 corresponding to the reference hash table b is determined as the target hash algorithm.
Step 318: and receiving a data query request aiming at the employee information data table, and determining a target hash table and a target hash algorithm.
Specifically, a reference hash table b and a hash algorithm 2 are determined.
Step 320: and determining a field to be queried in the data query request, and calculating a hash value to be queried corresponding to the field to be queried based on a target hash algorithm.
Specifically, the field to be queried 'name' in the data query request is determined, and the hash value to be queried corresponding to the field to be queried 'name' is calculated to be '1' according to the hash algorithm 2.
Step 322: and determining a target field corresponding to the hash value to be inquired in the employee information data table according to the hash value to be inquired.
Specifically, the business field 'name' in the employee information data table is determined according to the fact that the hash value to be inquired is '1'.
The method for determining the hash table, provided by the application, is used for responding to a hash table creation request aiming at a target service data table and determining at least one hash algorithm to be matched; respectively calculating to obtain service field information in the target service data table through each hash algorithm to be matched, and obtaining a reference hash table generated by the target service data table according to each hash algorithm to be matched; and determining a reference hash table with the hash collision number smaller than or equal to a preset threshold value as a target hash table corresponding to the target service data table.
The embodiment of the application realizes that at least one hash algorithm to be matched is determined, so that the hash algorithm for generating the hash table is determined based on each hash algorithm to be matched; respectively calculating the service field information corresponding to each hash algorithm to be matched so as to generate a reference hash table corresponding to each hash algorithm to be matched; and selecting the reference hash table with the hash collision number smaller than the preset threshold value as the target hash table corresponding to the target service data table, so as to obtain the hash table with higher efficiency in subsequent query, and further facilitate the subsequent improvement of the query efficiency of the target service data table.
Corresponding to the foregoing method embodiment, the present application further provides an embodiment of a device for determining a hash table, and fig. 4 illustrates a schematic structural diagram of a device for determining a hash table provided in an embodiment of the present application. As shown in fig. 4, the apparatus includes:
a first determining module 402, configured to determine at least one hash algorithm to be matched in response to a hash table creation request for a target business data table;
a calculating module 404, configured to calculate and obtain service field information in the target service data table through each hash algorithm to be matched, and obtain a reference hash table generated by the target service data table according to each hash algorithm to be matched;
a second determining module 406, configured to determine that the reference hash table with the hash collision number less than or equal to the preset threshold is the target hash table corresponding to the target service data table.
Optionally, the apparatus further comprises a determination submodule configured to:
and determining the hash algorithm to be matched corresponding to the target hash table as a target hash algorithm.
Optionally, the apparatus further comprises an execution module configured to:
receiving a data query request aiming at a target service data table, and determining the target hash table and the target hash algorithm;
and executing the data query request based on the target hash table and the target hash algorithm to obtain a data query result.
Optionally, the execution module is further configured to:
determining a field to be queried in the data query request;
calculating a field hash value corresponding to the field to be queried based on the target hash algorithm;
and determining a target field corresponding to the field hash value in the target hash table, and obtaining a data query result based on the target field.
Optionally, the calculating module 404 is further configured to:
determining a preset hash calculation initial value and a preset hash size threshold;
and calculating to obtain the service field information corresponding to each service field of the target data table based on the preset Hash calculation initial value, the preset Hash size threshold value and each Hash algorithm to be matched.
Optionally, the calculating module 404 is further configured to:
and generating a reference hash table corresponding to each hash algorithm to be matched according to the service field information corresponding to each hash algorithm to be matched.
Optionally, the second determining module 406 is further configured to:
determining at least one target reference hash table with the hash collision number less than or equal to a preset threshold value;
sorting the reference hash tables according to the hash collision number from large to small based on each target reference hash table to obtain a reference hash table queue;
and selecting a target reference hash table positioned at the tail of the queue in the reference hash table queue as a target hash table corresponding to the target service data table.
Optionally, the apparatus further comprises a first creating module configured to:
determining a current hash calculation initial value based on the preset hash calculation initial value under the condition that a reference hash table with the hash collision number smaller than or equal to a preset threshold value is not acquired;
establishing a first reference hash table corresponding to each hash algorithm to be matched based on the current hash calculation initial value and the preset hash size threshold;
and determining a target first reference hash table with the hash collision number smaller than or equal to a preset threshold value as a target hash table.
Optionally, the apparatus further comprises a second creating module configured to:
under the condition that a first reference hash table with the hash collision number smaller than or equal to a preset threshold value is not acquired, determining a current hash size threshold value based on the preset hash size threshold value;
obtaining a second reference hash table corresponding to each hash algorithm to be matched according to the current hash calculation initial value and the current hash size threshold;
and determining a target second reference hash table with the hash collision number smaller than or equal to a preset threshold value as a target hash table.
The device for determining the hash table comprises a first determining module, a second determining module and a matching module, wherein the first determining module is used for responding to a hash table establishing request aiming at a target business data table and determining at least one hash algorithm to be matched; the calculation module is used for calculating and obtaining the service field information in the target service data table through each hash algorithm to be matched and obtaining a reference hash table generated by the target service data table according to each hash algorithm to be matched; and the second determining module is used for determining the reference hash table with the hash collision number smaller than or equal to a preset threshold value as the target hash table corresponding to the target service data table.
Determining at least one hash algorithm to be matched so as to determine a hash algorithm for generating a hash table based on each hash algorithm to be matched; respectively calculating the service field information corresponding to each hash algorithm to be matched so as to generate a reference hash table corresponding to each hash algorithm to be matched; and selecting the reference hash table with the hash collision number smaller than the preset threshold value as the target hash table corresponding to the target service data table, so as to obtain the hash table with higher efficiency in subsequent query, and further facilitate the subsequent improvement of the query efficiency of the target service data table.
The above is an exemplary scheme of the hash table determination apparatus of this embodiment. It should be noted that the technical solution of the apparatus for determining a hash table and the technical solution of the method for determining a hash table belong to the same concept, and details that are not described in detail in the technical solution of the apparatus for determining a hash table can be referred to the description of the technical solution of the method for determining a hash table.
Fig. 5 illustrates a block diagram of a computing device 500 provided according to an embodiment of the present application. The components of the computing device 500 include, but are not limited to, a memory 510 and a processor 520. Processor 520 is coupled to memory 510 via bus 530, and database 550 is used to store data.
Computing device 500 also includes access device 540, access device 540 enabling computing device 500 to communicate via one or more networks 560. Examples of such networks include a Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the internet. The Access device 540 may include one or more of any type of Network interface (e.g., a Network interface controller) that may be wired or Wireless, such as an IEEE802.11 Wireless Local Area Network (WLAN) Wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an ethernet interface, a Universal Serial Bus (USB) interface, a cellular Network interface, a bluetooth interface, a Near Field Communication (NFC) interface, and so forth.
In one embodiment of the application, the above-described components of computing device 500 and other components not shown in FIG. 5 may also be connected to each other, such as by a bus. It should be understood that the block diagram of the computing device architecture shown in FIG. 5 is for purposes of example only and is not limiting as to the scope of the present application. Those skilled in the art may add or replace other components as desired.
Computing device 500 may be any type of stationary or mobile computing device, including a mobile Computer or mobile computing device (e.g., tablet, personal digital assistant, laptop, notebook, netbook, etc.), a mobile phone (e.g., smartphone), a wearable computing device (e.g., smartwatch, smartglasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop Computer or Personal Computer (PC). Computing device 500 may also be a mobile or stationary server.
Wherein, the processor 520, when executing the computer instructions, implements the steps of the hash table determination method.
The foregoing is a schematic diagram of a computing device of the present embodiment. It should be noted that the technical solution of the computing device and the technical solution of the above hash table determination method belong to the same concept, and details that are not described in detail in the technical solution of the computing device can be referred to the description of the technical solution of the above hash table determination method.
An embodiment of the present application further provides a computer readable storage medium, which stores computer instructions, and the computer instructions, when executed by a processor, implement the steps of the method for determining the hash table as described above.
The above is an illustrative scheme of a computer-readable storage medium of the present embodiment. It should be noted that the technical solution of the storage medium and the technical solution of the above-mentioned method for determining a hash table belong to the same concept, and details that are not described in detail in the technical solution of the storage medium can be referred to the description of the technical solution of the above-mentioned method for determining a hash table.
The foregoing description has been directed to specific embodiments of this application. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The computer instructions comprise computer program code which may be in source code form, object code form, an executable file or some intermediate form, or the like. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, read-Only Memory (ROM), random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer-readable medium may contain suitable additions or subtractions depending on the requirements of legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer-readable media may not include electrical carrier signals or telecommunication signals in accordance with legislation and patent practice.
It should be noted that, for the sake of simplicity, the above-mentioned method embodiments are described as a series of acts or combinations, but those skilled in the art should understand that the present application is not limited by the described order of acts, as some steps may be performed in other orders or simultaneously according to the present application. Further, those skilled in the art will appreciate that the embodiments described in this specification are presently considered to be preferred embodiments and that acts and modules are not required in the present application.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
The preferred embodiments of the present application disclosed above are intended only to aid in the explanation of the application. Alternative embodiments are not exhaustive and do not limit the invention to the precise embodiments described. Obviously, many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the application and its practical applications, to thereby enable others skilled in the art to best understand and utilize the application. The application is limited only by the claims and their full scope and equivalents.
Claims (10)
1. A method for determining a hash table, comprising:
responding to a hash table creation request aiming at a target business data table, and determining at least one hash algorithm to be matched;
respectively calculating to obtain service field information in the target service data table through each hash algorithm to be matched, and obtaining a reference hash table generated by the target service data table according to each hash algorithm to be matched, wherein the service field information is obtained through calculation based on a preset hash calculation initial value and a preset hash size threshold value, and the preset hash size threshold value is the preset hash table storage size;
determining a reference hash table with the hash collision number smaller than or equal to a preset threshold value as a target hash table corresponding to the target service data table;
under the condition that a reference hash table with the hash collision number smaller than or equal to a preset threshold value is not acquired, determining a current hash calculation initial value based on the preset hash calculation initial value;
establishing a first reference hash table corresponding to each hash algorithm to be matched based on the current hash calculation initial value and the preset hash size threshold value;
determining a target first reference hash table with the hash collision number smaller than or equal to a preset threshold value as a target hash table;
under the condition that a first reference hash table with the hash collision number smaller than or equal to a preset threshold value is not acquired, determining a current hash size threshold value based on the preset hash size threshold value;
creating a second reference hash table corresponding to each hash algorithm to be matched according to the current hash calculation initial value and the current hash size threshold;
and determining a target second reference hash table with the hash collision number smaller than or equal to a preset threshold value as a target hash table.
2. The method according to claim 1, wherein after determining that the reference hash table with the hash collision number less than or equal to the preset threshold is the target hash table corresponding to the target service data table, the method further comprises:
and determining the hash algorithm to be matched corresponding to the target hash table as a target hash algorithm.
3. The method of claim 2, wherein the method further comprises:
receiving a data query request aiming at a target service data table, and determining the target hash table and the target hash algorithm;
and executing the data query request based on the target hash table and the target hash algorithm to obtain a data query result.
4. The method of claim 3, wherein executing the data query request based on the target hash table and the target hash algorithm to obtain a data query result comprises:
determining a field to be queried in the data query request;
calculating a field hash value corresponding to the field to be queried based on the target hash algorithm;
and determining a target field corresponding to the field hash value in the target hash table, and obtaining a data query result based on the target field.
5. The method of claim 1, wherein the calculating the service field information in the target service data table by each hash algorithm to be matched comprises:
determining a preset hash calculation initial value and a preset hash size threshold;
and calculating the service field information corresponding to each service field of the target data table based on the preset Hash calculation initial value, the preset Hash size threshold value and each Hash algorithm to be matched.
6. The method of claim 5, wherein obtaining the reference hash table generated by the target service data table according to each hash algorithm to be matched comprises:
and generating a reference hash table corresponding to each hash algorithm to be matched according to the service field information corresponding to each hash algorithm to be matched.
7. The method as claimed in claim 5, wherein determining the reference hash table with the hash collision number less than or equal to the preset threshold as the target hash table corresponding to the target service data table comprises:
determining at least one target reference hash table with the hash collision number smaller than or equal to a preset threshold value;
sorting the reference hash tables according to the hash collision number from large to small based on each target reference hash table to obtain a reference hash table queue;
and selecting a target reference hash table positioned at the tail of the queue in the reference hash table queue as a target hash table corresponding to the target service data table.
8. An apparatus for determining a hash table, comprising:
the system comprises a first determination module, a second determination module and a third determination module, wherein the first determination module is configured to respond to a hash table creation request aiming at a target business data table and determine at least one hash algorithm to be matched;
the calculation module is configured to calculate and obtain service field information in the target service data table through each hash algorithm to be matched respectively, and obtain a reference hash table generated by the target service data table according to each hash algorithm to be matched, wherein the service field information is obtained by calculation based on a preset hash calculation initial value and a preset hash size threshold, and the preset hash size threshold is a preset hash table storage size;
the second determining module is configured to determine that the reference hash table with the hash collision number smaller than or equal to a preset threshold value is a target hash table corresponding to the target service data table;
determining a current hash calculation initial value based on the preset hash calculation initial value under the condition that a reference hash table with the hash collision number smaller than or equal to a preset threshold value is not acquired;
establishing a first reference hash table corresponding to each hash algorithm to be matched based on the current hash calculation initial value and the preset hash size threshold;
determining a target first reference hash table with the hash collision number smaller than or equal to a preset threshold value as a target hash table;
under the condition that a first reference hash table with the hash collision number smaller than or equal to a preset threshold value is not acquired, determining a current hash size threshold value based on the preset hash size threshold value;
creating a second reference hash table corresponding to each hash algorithm to be matched according to the current hash calculation initial value and the current hash size threshold;
and determining a target second reference hash table with the hash collision number smaller than or equal to a preset threshold value as a target hash table.
9. A computing device comprising a memory, a processor, and computer instructions stored on the memory and executable on the processor, wherein the processor implements the steps of the method of any one of claims 1-7 when executing the computer instructions.
10. A computer-readable storage medium storing computer instructions, which when executed by a processor, perform the steps of the method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211480873.8A CN115576954B (en) | 2022-11-24 | 2022-11-24 | Hash table determining method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211480873.8A CN115576954B (en) | 2022-11-24 | 2022-11-24 | Hash table determining method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115576954A CN115576954A (en) | 2023-01-06 |
CN115576954B true CN115576954B (en) | 2023-04-07 |
Family
ID=84590343
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211480873.8A Active CN115576954B (en) | 2022-11-24 | 2022-11-24 | Hash table determining method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115576954B (en) |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1437357A (en) * | 2002-02-07 | 2003-08-20 | 华为技术有限公司 | Virtual channel mark/virtual route mark searching method of multipl hash function |
CN103001878A (en) * | 2012-11-26 | 2013-03-27 | 中兴通讯股份有限公司 | Determination method and device for media access control (MAC) address Hash collision |
JP2013179421A (en) * | 2012-02-28 | 2013-09-09 | Nippon Telegr & Teleph Corp <Ntt> | Registration method of entry and processor |
CN107357843A (en) * | 2017-06-23 | 2017-11-17 | 东南大学 | Mass network data search method based on data flow architecture |
WO2018099107A1 (en) * | 2016-12-02 | 2018-06-07 | 深圳市中兴微电子技术有限公司 | Hash table management method and device, and computer storage medium |
CN109885576A (en) * | 2019-03-06 | 2019-06-14 | 珠海金山网络游戏科技有限公司 | A kind of Hash table creation method and system calculate equipment and storage medium |
CN111352931A (en) * | 2018-12-21 | 2020-06-30 | 中兴通讯股份有限公司 | Hash collision processing method and device and computer readable storage medium |
CN111625534A (en) * | 2020-04-09 | 2020-09-04 | 中国人民解放军战略支援部队信息工程大学 | Data structure for hash operation and hash table storage and query method based on structure |
CN111638925A (en) * | 2019-03-01 | 2020-09-08 | 华为技术有限公司 | Interface method table generation method, function pointer query method and device |
CN115221167A (en) * | 2022-07-13 | 2022-10-21 | 杭州安恒信息技术股份有限公司 | Static data storage and query method and device and electronic device |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP6103994B2 (en) * | 2013-03-13 | 2017-03-29 | インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation | Character string data processing method, program and system |
-
2022
- 2022-11-24 CN CN202211480873.8A patent/CN115576954B/en active Active
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1437357A (en) * | 2002-02-07 | 2003-08-20 | 华为技术有限公司 | Virtual channel mark/virtual route mark searching method of multipl hash function |
JP2013179421A (en) * | 2012-02-28 | 2013-09-09 | Nippon Telegr & Teleph Corp <Ntt> | Registration method of entry and processor |
CN103001878A (en) * | 2012-11-26 | 2013-03-27 | 中兴通讯股份有限公司 | Determination method and device for media access control (MAC) address Hash collision |
WO2018099107A1 (en) * | 2016-12-02 | 2018-06-07 | 深圳市中兴微电子技术有限公司 | Hash table management method and device, and computer storage medium |
CN107357843A (en) * | 2017-06-23 | 2017-11-17 | 东南大学 | Mass network data search method based on data flow architecture |
CN111352931A (en) * | 2018-12-21 | 2020-06-30 | 中兴通讯股份有限公司 | Hash collision processing method and device and computer readable storage medium |
CN111638925A (en) * | 2019-03-01 | 2020-09-08 | 华为技术有限公司 | Interface method table generation method, function pointer query method and device |
CN109885576A (en) * | 2019-03-06 | 2019-06-14 | 珠海金山网络游戏科技有限公司 | A kind of Hash table creation method and system calculate equipment and storage medium |
CN111625534A (en) * | 2020-04-09 | 2020-09-04 | 中国人民解放军战略支援部队信息工程大学 | Data structure for hash operation and hash table storage and query method based on structure |
CN115221167A (en) * | 2022-07-13 | 2022-10-21 | 杭州安恒信息技术股份有限公司 | Static data storage and query method and device and electronic device |
Also Published As
Publication number | Publication date |
---|---|
CN115576954A (en) | 2023-01-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109885576B (en) | Hash table creating method and system, computing device and storage medium | |
CN110134714B (en) | Distributed computing framework cache index method suitable for big data iterative computation | |
CN106407377B (en) | Search method and device based on artificial intelligence | |
CN113326420B (en) | Question retrieval method, device, electronic equipment and medium | |
CN115576954B (en) | Hash table determining method and device | |
CN111400301A (en) | Data query method, device and equipment | |
CN110209895B (en) | Vector retrieval method, device and equipment | |
CN112231398A (en) | Data storage method, device, equipment and storage medium | |
CN111858617A (en) | User searching method and device, computer readable storage medium and electronic equipment | |
CN114415971B (en) | Data processing method and device | |
CN107622048B (en) | Text mode recognition method and system | |
CN113554145B (en) | Method, electronic device and computer program product for determining output of neural network | |
CN113297204B (en) | Index generation method and device | |
CN114168589A (en) | Index construction method and device | |
CN113849550A (en) | Data processing method and device | |
US9292555B2 (en) | Information processing device | |
CN111639099A (en) | Full-text indexing method and system | |
CN111475492A (en) | Data processing method and device | |
CN115936091B (en) | Training method and device for deep learning model, electronic equipment and storage medium | |
CN113312521B (en) | Content retrieval method, device, electronic equipment and medium | |
CN114817315B (en) | Data processing method and system | |
CN104657516B (en) | A kind of keyword query method and device | |
CN116680367B (en) | Data matching method, data matching device and computer readable storage medium | |
CN114153845A (en) | Data storage and reading method, device, equipment and medium | |
CN116089539A (en) | Customer service system realization method, equipment and storage medium based on milvus database |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |