An efficient data query method, system, device and medium based on mapping
By mapping the query fields, including data type classification and bit allocation, a query performance evaluation model is constructed, which solves the problem of decreased query efficiency caused by the increase in data volume and achieves efficient querying.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 广州探域科技有限公司
- Filing Date
- 2023-09-27
- Publication Date
- 2026-05-01
AI Technical Summary
As data volume increases, query condition complexity increases, database query efficiency decreases, index creation load increases, and query performance is affected.
By mapping the target query fields, including data type classification, mapping rules, and bit allocation, a query performance evaluation model is constructed to select the optimal query mapping value, thereby reducing data storage and computational load.
It improves query efficiency, reduces database index load, and solves the impact of a surge in data volume on query efficiency, thus having high application value.
Smart Images

Figure CN117312382B_ABST
Abstract
Description
A mapping-based efficient data query method, system, device, and medium Technical Field
[0001] This invention relates to the field of computer technology, and specifically to an efficient data query method, system, device, and medium based on mapping. Background Technology
[0002] With the continuous development of computer technology, users can store data through data tables, facilitating subsequent data retrieval based on these tables. For the query function of an information system, there are usually query conditions. In the database field, a solution to improve query efficiency is to create indexes, and the query system sets up database tables that correspond one-to-one with the query conditions.
[0003] However, in an information management system, query efficiency is negatively correlated with the amount of data. As the amount of data increases, query efficiency will decrease. When the query conditions are set to be more complex, the number of query fields will increase, the number of indexes that need to be created will also increase, the amount of data will surge, and the space load occupied in the database will increase, which will seriously affect the query efficiency.
[0004] Therefore, there is an urgent need for an efficient data query method based on mapping to solve the problem of query efficiency being affected by the increase in data volume. Summary of the Invention
[0005] To address the shortcomings of existing technologies, this invention proposes an efficient data query method, system, device, and medium based on mapping.
[0006] The first aspect of this invention discloses an efficient data query method based on mapping, comprising:
[0007] S1: In response to the query pre-calculation request, obtain the target query field of the query request;
[0008] S2: Parse the data type of the target query field and classify the data type based on the integer value of the number of digits;
[0009] S3: Based on the data type classification, determine the mapping rule for each target query field and the mapping bit allocation for each target query field. Perform mapping calculation on the target query field according to the mapping rule and the mapping bit allocation to obtain the query mapping value corresponding to the target query field and store it in the database.
[0010] S4: Construct a query performance evaluation model, calculate the performance evaluation value of the query mapping value based on the query performance evaluation model, and filter the optimal target query mapping value corresponding to the target query field using the performance evaluation value;
[0011] S5: In response to the query request, determine the target query mapping value based on the target query field, call the target query mapping value to perform the query operation, and return the query result.
[0012] In an optional embodiment, parsing the data type of the target query field and classifying the data type based on integer values includes:
[0013] S21: Determine the data type of the target query field according to the query requirements. The data type includes string, numeric, and date.
[0014] S22: Divide the data types according to the number of bits in the data storage, and convert the data type of the target query field into an integer type for classification. The classification includes small integer type, short integer type, integer type and long integer type.
[0015] In an optional embodiment, the mapping rules for determining each target query field based on the data type classification include:
[0016] S31: Classify the data storage range according to the preset rules based on the number of bits of the database query field;
[0017] S32: Based on the rule classification interval, match the rule classification interval corresponding to the data storage bits of the target query field to determine the mapping rule of the query subfield in the target query field. The mapping rule includes hash algorithm, enumeration method and relative value method.
[0018] In an optional embodiment, determining the mapping bit allocation for each target query field based on the data type classification includes:
[0019] S33: Determine the query subfield of the target query field and the mapping bit length of the target query field;
[0020] S34: Allocate the mapping bits of the query subfield according to the query subfield and the mapping bits.
[0021] In an optional embodiment, the mapping calculation is performed on the target query field according to the mapping rule and the mapping bit allocation, wherein the formula for the mapping calculation is:
[0022] ;
[0023] Where D represents the query mapping value, and a, b, and c represent the query subfields in the target query field. This indicates the mapping rule corresponding to the query subfield, and 'i' represents the number of subfields corresponding to the query. This indicates the number of bits allocated to the mapped subfield, j represents the number of mapped bits, and << represents a left shift operation. Representation or operation.
[0024] In an optional embodiment, the query performance evaluation model includes:
[0025] The query accuracy module evaluates query accuracy based on the hash collision probability and / or mapping bit allocation of different hash algorithms. The formula for calculating the query accuracy is as follows:
[0026] ;
[0027] ;
[0028] ;
[0029] in, This indicates the query accuracy of the mapped values. This represents the impact factor of the query mapping value calculated by the hash algorithm on accuracy. This represents the impact factor of the query mapping values calculated by the enumeration method and the relative value method on accuracy. This represents the probability of hash collisions in a hash algorithm. Indicates the type of hash algorithm used in the mapping calculation. This indicates the number of bits allocated for the mapping calculation under business requirements. This indicates the number of bits allocated that have been used in the mapping calculation process;
[0030] The query efficiency module evaluates query efficiency based on the computational cost of the pre-calculated mapping process. The formula for calculating query efficiency is as follows:
[0031] ;
[0032] in, This indicates the query efficiency corresponding to the query mapping value. If the query efficiency is less than or equal to zero, the query efficiency improvement rate is recorded as zero. If the query efficiency is greater than zero, the query efficiency is recorded in the query result and saved in the data.
[0033] In an optional embodiment, the query performance evaluation model further includes:
[0034] The comprehensive evaluation module evaluates the performance of the query mapping value based on the evaluation results of the query accuracy module and the query efficiency module to obtain the target query mapping value. The calculation formula for the comprehensive evaluation is as follows:
[0035] ;
[0036] in, This represents the overall evaluation value of the query mapping value. This indicates the query accuracy of the mapped values. Indicates the query efficiency corresponding to the query mapping value. The weighting coefficients representing query accuracy. Weighting coefficients representing query efficiency. The value range of α is within [0,1] according to business requirements, where α>β and α+β=1.
[0037] A second aspect of this invention discloses a high-efficiency data query system based on mapping, the system comprising:
[0038] The acquisition module is used to obtain the target query field of the query request in response to the query pre-calculation request;
[0039] The preprocessing module is used to parse the data type of the target query field and classify the data type based on the integer value of the number of digits.
[0040] The pre-calculation module is used to determine the mapping rules for each target query field and the mapping bit allocation for each target query field according to the data type classification, perform mapping calculations on the target query fields according to the mapping rules and the mapping bit allocation, obtain the query mapping value corresponding to the target query field and store it in the database;
[0041] The performance evaluation module is used to construct a query performance evaluation model, calculate the performance evaluation value of the query mapping value based on the query performance evaluation model, and filter the optimal target query mapping value corresponding to the target query field through the performance evaluation value.
[0042] The query module is used to respond to a query request, determine the target query mapping value based on the target query field, call the target query mapping value to perform a query operation, and return the query result.
[0043] A third aspect of this invention discloses a high-efficiency data query device based on mapping, comprising:
[0044] At least one processor, and,
[0045] A memory communicatively connected to the at least one processor; wherein,
[0046] The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform a mapping-based efficient data query method as disclosed in any of the first aspects of the present invention.
[0047] A fourth aspect of the present invention discloses a computer-readable storage medium storing computer-executable instructions for causing a computer to perform a mapping-based efficient data query method as described in any of the claims of the first aspect of the present invention.
[0048] Compared with the prior art, the present invention has the following advantages:
[0049] (1) This invention reduces the data load of database indexing by mapping the target query field to a mapping value with a smaller data storage volume, and the computational load of the query mapping value in the query calculation process is also reduced, which can effectively improve query efficiency.
[0050] (2) The present invention, through the query performance evaluation module, comprehensively evaluates the performance of the query mapping value based on the query accuracy and query efficiency, further solves the problem that the surge in data volume has a serious impact on query efficiency, and has high application value. Attached Figure Description
[0051] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0052] Figure 1 is a flowchart of the efficient data query method based on mapping according to the present invention;
[0053] Figure 2 is a schematic diagram of the high-efficiency data query system based on mapping according to the present invention. Detailed Implementation
[0054] To make the objectives, technical solutions, and advantages of this application clearer, the application is described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application. All other embodiments obtained by those skilled in the art based on the embodiments provided in this application without inventive effort are within the scope of protection of this application.
[0055] Obviously, the accompanying drawings described below are merely some examples or embodiments of this application. Those skilled in the art can apply this application to other similar scenarios based on these drawings without any inventive effort. Furthermore, it is understood that although the efforts made in this development process may be complex and lengthy, for those skilled in the art related to the content disclosed in this application, any changes to design, manufacturing, or production based on the technical content disclosed in this application are merely conventional technical means and should not be construed as insufficient disclosure of the content of this application.
[0056] In this application, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment that is mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0057] Unless otherwise defined, the technical or scientific terms used in this application shall have the ordinary meaning understood by one of ordinary skill in the art to which this application pertains. The terms “a,” “an,” “an,” “the,” and similar words used in this application do not indicate quantity limitation and may indicate singular or plural. The terms “comprising,” “including,” “having,” and any variations thereof used in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units not listed, or may include other steps or units inherent to these processes, methods, products, or devices. The terms “connected,” “linked,” “coupled,” and similar words used in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. “Multiple” used in this application refers to two or more. “And / or” describes the relationship between related objects, indicating that three relationships may exist; for example, “A and / or B” can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following objects are in an "or" relationship. The terms "first," "second," and "third" used in this application are merely to distinguish similar objects and do not represent a specific ordering of the objects.
[0058] Example 1
[0059] Referring to Figure 1, an embodiment of the present invention discloses an efficient data query method based on mapping, comprising:
[0060] S1: In response to the query pre-calculation request, obtain the target query field of the query request;
[0061] It should be noted that for the query function of an information system, there are usually query conditions. These conditions generally correspond one-to-one with the fields in the database table, and we call these fields the fields involved in the query. For example, in a user management interface, users can be filtered by name, age, and gender. The corresponding user table will have fields for name, age, and gender. Therefore, name, age, and gender are the fields involved in the query.
[0062] To further clarify, in step 1 of this embodiment, several fields for querying should be selected based on the actual business background and requirements. The data type of the fields can be arbitrary in theory, such as string type, numeric type, date type, etc.
[0063] S2: Parse the data type of the target query field and classify the data type based on the integer value of the number of digits;
[0064] In an optional embodiment, parsing the data type of the target query field and classifying the data type based on integer values includes:
[0065] S21: Determine the data type of the target query field according to the query requirements. The data type includes string, numeric, and date.
[0066] S22: Divide the data types according to the number of bits in the data storage, and convert the data type of the target query field into an integer type for classification. The classification includes small integer type, short integer type, integer type and long integer type.
[0067] It should be noted that, in order to maximize query efficiency and reduce storage space, the mapping type in this embodiment is fixed as integer type, which can be divided into: 8-bit small integer, 16-bit short integer, 32-bit integer and 64-bit long integer according to the number of bits of physical storage.
[0068] To further explain, in order to improve query efficiency in computer systems, choosing an integer type query field can improve computational efficiency. Similarly, an integer type query field can also reduce storage space. The storage bit range for integer types is [8, 64], and storage is the data itself, without the need to store additional information.
[0069] For example, the data type "Hello World" is a string. Assuming ASCII encoding is used, each character occupies 8 bits, and the minimum physical storage is 88 bits. If it is mapped to a numeric type, it will only occupy a maximum of 64 bits, saving 27% of storage space.
[0070] S3: Based on the data type classification, determine the mapping rule for each target query field and the mapping bit allocation for each target query field. Perform mapping calculation on the target query field according to the mapping rule and the mapping bit allocation to obtain the query mapping value corresponding to the target query field and store it in the database.
[0071] In an optional embodiment, the mapping rules for determining each target query field based on the data type classification include:
[0072] S31: Classify the data storage range according to the preset rules based on the number of bits of the database query field;
[0073] S32: Based on the rule classification interval, match the rule classification interval corresponding to the data storage bits of the target query field to determine the mapping rule of the query subfield in the target query field. The mapping rule includes hash algorithm, enumeration method and relative value method.
[0074] It should be noted that the mapping rules include hash algorithms, enumeration methods, and relative value methods. The mapping rule is defined as follows: map a field 'a' of arbitrary data type and physically stored as n bits to a field 'b' of m bits. The formula is expressed as: b = mapping(a), where bits represent the number of bits physically occupied, n = bits(b), m = bits(a), and m... <n 。
[0075] It should be further explained that, as those skilled in the art will know in this embodiment, the hash algorithm can be any one or more of MD5, SHA-1, SHA-256, SHA-512, RipeMD-160, and MurmurHash. The choice of hash algorithm depends on the large cardinality of the subfields of the target query field, i.e., they cannot be exhaustively enumerated. For example, order ID is generally mapped using a hash algorithm. In practical applications, it can be expressed as follows: Suppose there is a string field a, n=bits(a)=256, and it is mapped to field b, m=bits(b)=32, then b=hash(a)%(2^32).
[0076] It should be further explained that when the cardinality of the subfields of the target query field is small, that is, when the stored values are enumerable, the enumeration method can be used. For example, the order status is illustrated in Table 1 below:
[0077]
[0078] Table 1
[0079] The order status is a string of type a, with a total of 3 enumeration values, mapped to field b. Then bits(b) = 2, b = the defined enumeration value. The formula for calculating the number of bits physically stored in the mapped field is as follows: 2^n >= enums(b). Solving for n, we get n >= √enums(b) (n must be an integer).
[0080] n = bits(b): represents the number of bits physically stored in b;
[0081] Enums(b): Represents the number of values that field b can enumerate.
[0082] It should be further explained that the relative value method in this embodiment can be considered a special case of enumeration. When the data type of the selected field can participate in arithmetic operations and there are relatively many enumeration values, the relative value method can be used to complete the automatic mapping. For example, if the target query field is a date type, and the selected relative value is 2023-01-01, then 2023-01-02->1, 2023-01-03->2, 2023-01-04->3. The formula for the relative value method is b=a-relative value.
[0083] In an optional embodiment, determining the mapping bit allocation for each target query field based on the data type classification includes:
[0084] S33: Determine the query subfield of the target query field and the mapping bit length of the target query field;
[0085] S34: Allocate the mapping bits of the query subfield according to the query subfield and the mapping bits.
[0086] Specifically, the mapping field is divided, and the mapping bit width is allocated to the query field. For example, if the query subfields of the target query field are identified as a, b, and c, and the mapping field has a bit width n=64, then the mapping bit width allocated to the query subfields a, b, and c is... , and Then the above parameters satisfy ;
[0087] This is how the mapping bits of the target subfields are allocated during the target query field mapping process.
[0088] In an optional embodiment, the mapping calculation is performed on the target query field according to the mapping rule and the mapping bit allocation, wherein the formula for the mapping calculation is:
[0089] ;
[0090] Where D represents the query mapping value, and a, b, and c represent the query subfields in the target query field. This indicates the mapping rule corresponding to the query subfield, and 'i' represents the number of subfields corresponding to the query. This indicates the number of bits allocated to the mapped subfield, j represents the number of mapped bits, and << represents a left shift operation. Representation or operation.
[0091] S4: Construct a query performance evaluation model, calculate the performance evaluation value of the query mapping value based on the query performance evaluation model, and filter the optimal target query mapping value corresponding to the target query field using the performance evaluation value;
[0092] S5: In response to the query request, determine the target query mapping value based on the target query field, call the target query mapping value to perform the query operation, and return the query result.
[0093] In an optional embodiment, the query performance evaluation model includes:
[0094] The query accuracy module evaluates query accuracy based on the hash collision probability and / or mapping bit allocation of different hash algorithms. The formula for calculating the query accuracy is as follows:
[0095] ;
[0096] ;
[0097] ;
[0098] in, This indicates the query accuracy of the mapped values. This represents the impact factor of the query mapping value calculated by the hash algorithm on accuracy. This represents the impact factor of the query mapping values calculated by the enumeration method and the relative value method on accuracy. This represents the probability of hash collisions in a hash algorithm. Indicates the type of hash algorithm used in the mapping calculation. This indicates the number of bits allocated for the mapping calculation under business requirements. This indicates the number of bits allocated that have been used in the mapping calculation process;
[0099] The query efficiency module evaluates query efficiency based on the computational cost of the pre-calculated mapping process. The formula for calculating query efficiency is as follows:
[0100] ;
[0101] in, This indicates the query efficiency corresponding to the query mapping value. If the query efficiency is less than or equal to zero, the query efficiency improvement rate is recorded as zero. If the query efficiency is greater than zero, the query efficiency is recorded in the query result and saved in the data.
[0102] In an optional embodiment, the query performance evaluation model further includes:
[0103] The comprehensive evaluation module evaluates the performance of the query mapping value based on the evaluation results of the query accuracy module and the query efficiency module to obtain the target query mapping value. The calculation formula for the comprehensive evaluation is as follows:
[0104] ;
[0105] in, This represents the overall evaluation value of the query mapping value. This indicates the query accuracy of the mapped values. Indicates the query efficiency corresponding to the query mapping value. The weighting coefficients representing query accuracy. Weighting coefficients representing query efficiency. The value range of α is within [0,1] according to business requirements, where α>β and α+β=1.
[0106] This invention reduces the data load on the database index by mapping the target query field to a smaller data storage value. The computational load during query processing is also reduced by mapping the query value, effectively improving query efficiency. Furthermore, the invention includes a query performance evaluation module that comprehensively evaluates the performance of the query mapping value based on query accuracy and efficiency, further addressing the problem of drastic data volume spikes severely impacting query efficiency. This invention has significant application value.
[0107] As shown in Figure 2, a second aspect of the present invention discloses a high-efficiency data query system based on mapping, the system comprising:
[0108] The acquisition module is used to obtain the target query field of the query request in response to the query pre-calculation request;
[0109] The preprocessing module is used to parse the data type of the target query field and classify the data type based on the integer value of the number of digits.
[0110] The pre-calculation module is used to determine the mapping rules for each target query field and the mapping bit allocation for each target query field according to the data type classification, perform mapping calculations on the target query fields according to the mapping rules and the mapping bit allocation, obtain the query mapping value corresponding to the target query field and store it in the database;
[0111] The performance evaluation module is used to construct a query performance evaluation model, calculate the performance evaluation value of the query mapping value based on the query performance evaluation model, and filter the optimal target query mapping value corresponding to the target query field through the performance evaluation value.
[0112] The query module is used to respond to a query request, determine the target query mapping value based on the target query field, call the target query mapping value to perform a query operation, and return the query result.
[0113] In an optional embodiment, the performance evaluation module includes:
[0114] The query accuracy module evaluates query accuracy based on the hash collision probability and / or mapping bit allocation of different hash algorithms. The formula for calculating the query accuracy is as follows:
[0115] ;
[0116] ;
[0117] ;
[0118] in, This indicates the query accuracy of the mapped values. This represents the impact factor of the query mapping value calculated by the hash algorithm on accuracy. This represents the impact factor of the query mapping values calculated by the enumeration method and the relative value method on accuracy. This represents the probability of hash collisions in a hash algorithm. Indicates the type of hash algorithm used in the mapping calculation. This indicates the number of bits allocated for the mapping calculation under business requirements. This indicates the number of bits allocated that have been used in the mapping calculation process;
[0119] The query efficiency module evaluates query efficiency based on the computational cost of the pre-calculated mapping process. The formula for calculating query efficiency is as follows:
[0120] ;
[0121] in, This indicates the query efficiency corresponding to the query mapping value. If the query efficiency is less than or equal to zero, the query efficiency improvement rate is recorded as zero. If the query efficiency is greater than zero, the query efficiency is recorded in the query result and saved in the data.
[0122] In an optional embodiment, the performance evaluation module further includes:
[0123] The comprehensive evaluation module evaluates the performance of the query mapping value based on the evaluation results of the query accuracy module and the query efficiency module to obtain the target query mapping value. The calculation formula for the comprehensive evaluation is as follows:
[0124] ;
[0125] in, This represents the overall evaluation value of the query mapping value. This indicates the query accuracy of the mapped values. Indicates the query efficiency corresponding to the query mapping value. The weighting coefficients representing query accuracy. Weighting coefficients representing query efficiency. The value range of α is within [0,1] according to business requirements, where α>β and α+β=1.
[0126] A third aspect of this invention discloses a high-efficiency data query device based on mapping, comprising:
[0127] At least one processor, and,
[0128] A memory communicatively connected to the at least one processor; wherein,
[0129] The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform a mapping-based efficient data query method as disclosed in any of the first aspects of the present invention.
[0130] The computer device can be a terminal, and includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements an efficient data query method based on mapping. The display screen can be an LCD screen or an e-ink display screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.
[0131] A fourth aspect of the present invention discloses a computer-readable storage medium storing computer-executable instructions for causing a computer to perform a mapping-based efficient data query method as described in any of the claims of the first aspect of the present invention.
[0132] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes described in the embodiments of the efficient data query method based on mapping. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0133] Alternatively, if the above-mentioned modules of the present invention are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present invention, or the parts that contribute to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, terminal, or network device, etc.) to execute all or part of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, RAM, ROM, magnetic disks, or optical disks.
[0134] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A high-efficiency data query method based on mapping, characterized in that, The method includes: S1: In response to a query pre-computation request, obtaining the target query field of the query request; S2: Parsing the data type of the target query field and classifying the data type based on integer values; S3: Determining the mapping rule and the mapping bit allocation for each target query field according to the data type classification, performing mapping calculation on the target query field according to the mapping rule and the mapping bit allocation, obtaining the query mapping value corresponding to the target query field and storing it in the database; S4: Constructing a query performance evaluation model, calculating the performance evaluation value of the query mapping value according to the query performance evaluation model, and filtering the optimal target query mapping value corresponding to the target query field through the performance evaluation value; S5: In response to a query request, determining the target query mapping value according to the target query field, calling the target query mapping value to perform a query operation, and returning the query result; The query performance evaluation model includes: a query accuracy module, which evaluates the query accuracy based on the hash collision probability and / or mapping bit allocation of different hash algorithms, and the calculation formula for the query accuracy is: ; ; ;in, This indicates the query accuracy of the mapped values. This represents the impact factor of the query mapping value calculated by the hash algorithm on accuracy. This represents the impact factor of the query mapping values calculated by the enumeration method and the relative value method on accuracy. This represents the probability of hash collisions in a hash algorithm. Indicates the type of hash algorithm used in the mapping calculation. This indicates the number of bits allocated for the mapping calculation under business requirements. This indicates the number of bits allocated in the mapping calculation process; the query efficiency module evaluates query efficiency based on the computational load of the pre-calculated mapping calculation process, and the formula for calculating the query efficiency is: ;in, This indicates the query efficiency corresponding to the query mapping value. If the query efficiency is less than or equal to zero, the query efficiency improvement rate is recorded as zero. If the query efficiency is greater than zero, the query efficiency is recorded in the query result and saved in the data.
2. The efficient data query method based on mapping according to claim 1, characterized in that, The step of parsing the data type of the target query field and classifying the data type based on the number of integer values includes: S21: determining the data type of the target query field according to the query requirements, the data type including string, number, and date; S22: classifying the data type according to the number of bits in data storage, converting the data type of the target query field into an integer type for classification, the classification including small integer type, short integer type, integer type, and long integer type.
3. The efficient data query method based on mapping according to claim 1, characterized in that, The step of determining the mapping rules for each target query field based on the data type classification includes: S31: Presetting a rule classification interval based on the data storage bits of the database query field; S32: Matching the rule classification interval corresponding to the data storage bits of the target query field based on the rule classification interval to determine the mapping rules for the query subfields in the target query field, wherein the mapping rules include hash algorithm, enumeration method and relative value method.
4. The efficient data query method based on mapping according to claim 3, characterized in that, The step of determining the mapping bit allocation corresponding to each target query field according to the data type classification includes: S33: determining the query subfield of the target query field and the mapping bit of the target query field; S34: allocating the mapping bit of the query subfield according to the query subfield and the mapping bit.
5. The efficient data query method based on mapping according to claim 4, characterized in that, The mapping calculation is performed on the target query field according to the mapping rules and the mapping bit allocation, wherein the formula for the mapping calculation is: Where D represents the query mapping value, and a, b, and c represent the query subfields in the target query field. This indicates the mapping rule corresponding to the query subfield, and 'i' represents the number of subfields corresponding to the query. This indicates the number of bits allocated to the mapped subfield, j represents the number of mapped bits, and << indicates a left shift operation. Representation or operation.
6. The efficient data query method based on mapping according to claim 1, characterized in that, The query performance evaluation model further includes a comprehensive evaluation module, which evaluates the performance of the query mapping value based on the evaluation results of the query accuracy module and the query efficiency module to obtain the target query mapping value. The calculation formula for the comprehensive evaluation is as follows: ;in, This represents the overall evaluation value of the query mapping value. This indicates the query accuracy of the mapped values. Indicates the query efficiency corresponding to the query mapping value. The weighting coefficients representing query accuracy. Weighting coefficients representing query efficiency. The value range of α is within [0,1] according to business requirements, where α>β and α+β= 1.
7. A high-efficiency data query system based on mapping, characterized in that, The system includes: a data acquisition module, used to acquire the target query field of the query request in response to a query pre-calculation request; a preprocessing module, used to parse the data type of the target query field and classify the data type based on integer values; a pre-calculation module, used to determine the mapping rule and the mapping bit allocation corresponding to each target query field according to the data type classification, perform mapping calculation on the target query field according to the mapping rule and the mapping bit allocation, obtain the query mapping value corresponding to the target query field and store it in the database; a performance evaluation module, used to construct a query performance evaluation model, calculate the performance evaluation value of the query mapping value according to the query performance evaluation model, and filter the optimal target query mapping value corresponding to the target query field through the performance evaluation value; and a query module, used to determine the target query mapping value according to the target query field in response to a query request, call the target query mapping value to perform a query operation, and return the query result; the query performance evaluation model includes: a query accuracy module, which evaluates the query accuracy based on the hash collision probability and / or mapping bit allocation of different hash algorithms, and the calculation formula for the query accuracy is: ; ; ;in, This indicates the query accuracy of the mapped values. This represents the impact factor of the query mapping value calculated by the hash algorithm on accuracy. This represents the impact factor of the query mapping values calculated by the enumeration method and the relative value method on accuracy. This represents the probability of hash collisions in a hash algorithm. Indicates the type of hash algorithm used in the mapping calculation. This indicates the number of bits allocated for the mapping calculation under business requirements. This indicates the number of bits allocated in the mapping calculation process; the query efficiency module evaluates query efficiency based on the computational load of the pre-calculated mapping calculation process, and the formula for calculating the query efficiency is: ;in, This indicates the query efficiency corresponding to the query mapping value. If the query efficiency is less than or equal to zero, the query efficiency improvement rate is recorded as zero. If the query efficiency is greater than zero, the query efficiency is recorded in the query result and saved in the data.
8. A high-efficiency data query device based on mapping, characterized in that, include: At least one processor, and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the mapping-based efficient data query method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions for causing a computer to perform the mapping-based efficient data query method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Data processing method, device and equipment based on HBase data table and storage medium
CN115577055A
Data query method and device, storage medium and electronic equipment
CN116775689A