A data query method, device, apparatus and storage medium

By encoding and segmenting the data, only the target encoded data block of the attribute to be queried is loaded, which solves the problems of high disk I/O and low query efficiency in online analytical processing systems and achieves more efficient data querying.

CN114461733BActive Publication Date: 2025-11-11CHINA UNIONPAY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210077963.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-24
Publication Date
2025-11-11
Estimated Expiration
2042-01-24

AI Technical Summary

Technical Problem

When an online analytical processing system receives a random query request, existing query methods consume a lot of disk I/O, resulting in low query efficiency.

Method used

By encoding and segmenting the original data, encoded data blocks and encoded dictionary blocks are generated. Only the target encoded data block corresponding to the attribute to be queried is loaded, and the attribute value is obtained by de-encoding using the encoded dictionary, thus avoiding loading all data blocks.

Benefits of technology

It effectively saves disk I/O and memory consumption, and improves data query speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114461733B_ABST
    Figure CN114461733B_ABST
Patent Text Reader

Abstract

This application provides a data query method, apparatus, device, and storage medium, relating to the field of big data processing technology. The method includes: obtaining query conditions; determining a first target original data block from multiple first original data blocks corresponding to a first query attribute based on a first attribute value; and obtaining a first number of the first target original data block and first position information of the first attribute value within the first target original data block. Then, for each second query attribute, determining a second target encoded data block from multiple second encoded data blocks corresponding to the second query attribute based on the first number; and determining second position information based on the first position information. Based on the second target encoded data block corresponding to at least one second query attribute and the second position information, determining the second attribute value corresponding to each of the at least one second query attribute effectively saves disk I / O and reduces memory consumption, thereby improving the speed of data query.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of big data processing technology, and in particular to a data query method, apparatus, device and storage medium. Background Technology

[0002] Data processing can be broadly categorized into two types: Online Transaction Processing (OLTP) and Online Analytical Processing (OLAP). OLTP immediately transmits received user data to a computing center for processing and provides results within a very short time. OLTP systems typically use row-based storage, and common OLTP systems include e-commerce systems, banking transaction systems, and securities systems.

[0003] Online analytical processing (OLAP) analyzes and statistically processes current or historical user data to facilitate better decision-making. OLAP systems typically use columnar storage, and common examples include bank credit card risk analysis and prediction systems.

[0004] When an online analytical processing (OLAP) system receives a random query request, it needs to read all data in the relevant columns from the disk and then determine the query result from all the data in the relevant columns. However, this query method consumes a lot of disk I / O and has low query efficiency. Summary of the Invention

[0005] This application provides a data query method, apparatus, device, and storage medium to improve the accuracy of data queries.

[0006] On the one hand, embodiments of this application provide a data query method, which includes:

[0007] Obtain query conditions, the query conditions including a first attribute to be queried and a corresponding first attribute value, and at least one second attribute to be queried;

[0008] Based on the first attribute value, a first target original data block is determined from multiple first original data blocks corresponding to the first query attribute, and the first number of the first target original data block and the first position information of the first attribute value in the first target original data block are obtained.

[0009] For each second query attribute, based on the first number, a second target encoded data block is determined from multiple second encoded data blocks corresponding to the second query attribute, and based on the first position information, the corresponding second position information in the second target encoded data block is determined;

[0010] Based on the second target encoded data block corresponding to each of the at least one second query attribute and the corresponding second position information, the second attribute value corresponding to each of the at least one second query attribute is determined.

[0011] Optionally, before determining the first target original data block from multiple first original data blocks corresponding to the first query attribute based on the first attribute value, the method further includes:

[0012] Based on the first encoding dictionary, the multiple first encoded data blocks corresponding to the first query attribute are de-encoded to obtain the multiple first original data blocks.

[0013] Optionally, the first encoding dictionary includes multiple first encoding dictionary blocks;

[0014] The step of de-encoding multiple first-encoded data blocks corresponding to the first queried attribute based on the first encoding dictionary to obtain the multiple first original data blocks includes:

[0015] For each of the plurality of first encoded data blocks, the following steps are performed respectively:

[0016] Based on a first dictionary filtering array corresponding to a first encoded data block, at least one first target encoded dictionary block corresponding to the first encoded data block is determined from the plurality of first encoded dictionary blocks;

[0017] Using at least one first target encoding dictionary block, the first encoded data block is de-encoded to obtain the first original data block corresponding to the first encoded data block.

[0018] Optionally, before obtaining the query conditions, the method further includes:

[0019] The first original data is encoded using the first encoding dictionary to obtain the first encoded data;

[0020] The first encoded data is divided into the plurality of first encoded data blocks according to the preset logical block size.

[0021] Optionally, it also includes:

[0022] The first encoded dictionary is divided into the plurality of first encoded dictionary blocks according to the preset dictionary block size;

[0023] For each of the plurality of first encoded data blocks, the following steps are performed respectively:

[0024] Based on the encoding relationship between a first encoded data block and the plurality of first encoded dictionary blocks, a first dictionary filter array corresponding to the first encoded data block is determined. The array length of the first dictionary filter array is the number of the plurality of first encoded dictionary blocks. Each array cell in the first dictionary filter array corresponds to a first encoded dictionary block. The array cells corresponding to each first encoded dictionary block used when obtaining the first encoded data block are set to 1, and other data cells are set to 0.

[0025] Optionally, each second attribute to be queried corresponds to a second encoding dictionary;

[0026] The step of determining the second attribute value corresponding to each of the at least one second query attribute based on the second target encoded data block corresponding to each of the at least one second query attribute and the corresponding second position information includes:

[0027] For each of the at least one second attribute to be queried, perform the following steps:

[0028] Based on a second target encoded data block corresponding to a second query attribute and the corresponding second position information, the target encoded data corresponding to the second query attribute is obtained from the second target encoded data block;

[0029] Using the second encoding dictionary corresponding to the second query attribute, the target encoded data is de-encoded to obtain the second attribute value of the second query attribute.

[0030] Optionally, the second encoding dictionary includes multiple second encoding dictionary blocks;

[0031] The step of using the second encoding dictionary corresponding to the second query attribute to de-encode the target encoded data and obtain the second attribute value of the second query attribute includes:

[0032] Based on the second dictionary filtering array corresponding to the second target encoded data block, at least one second target encoded dictionary block corresponding to the second target encoded data block is determined from the plurality of second encoded dictionary blocks;

[0033] The target encoded data is de-encoded using at least one second target encoded dictionary block to obtain the second attribute value of the second query attribute.

[0034] Optionally, before obtaining the query conditions, the method further includes:

[0035] At least one second encoding dictionary is used to encode the corresponding second original data to obtain at least one second encoded data;

[0036] According to the preset logical block size, the at least one second encoded data is divided into multiple second encoded data blocks corresponding to each of the at least one second encoded data.

[0037] Optionally, it also includes:

[0038] For each of the at least one second encoded data, the following steps are performed:

[0039] According to the preset dictionary block size, the second encoded dictionary corresponding to a second encoded data is divided into the plurality of second encoded dictionary blocks;

[0040] For each of the multiple second encoded data blocks corresponding to the aforementioned second encoded data, the following steps are performed respectively:

[0041] Based on the encoding relationship between a second encoded data block and the plurality of second encoded dictionary blocks, a second dictionary filter array corresponding to the second encoded data block is determined. The array length of the second dictionary filter array is the number of the plurality of second encoded dictionary blocks. Each array unit in the second dictionary filter data corresponds to a second encoded dictionary block. The array units corresponding to each second encoded dictionary block used when obtaining the second encoded data block are set to 1, and other data units are set to 0.

[0042] On one hand, embodiments of this application provide a data query device, which includes:

[0043] The acquisition module is used to acquire query conditions, the query conditions including a first attribute to be queried and a corresponding first attribute value, and at least one second attribute to be queried;

[0044] The location determination module is used to determine a first target original data block from multiple first original data blocks corresponding to the first query attribute based on the first attribute value, and to obtain the first number of the first target original data block and the first location information of the first attribute value in the first target original data block.

[0045] The location determination module is further configured to, for each second query attribute, determine a second target encoded data block from a plurality of second encoded data blocks corresponding to the second query attribute based on the first number, and determine the corresponding second location information in the second target encoded data block based on the first location information;

[0046] The result acquisition module is used to determine the second attribute value corresponding to each of the at least one second query attribute based on the second target encoded data block corresponding to each of the at least one second query attribute and the corresponding second position information.

[0047] Optionally, it also includes a decoding module, which is specifically used for:

[0048] Before determining the first target original data block from the plurality of first original data blocks corresponding to the first query attribute based on the first attribute value, the plurality of first encoded data blocks corresponding to the first query attribute are de-encoded based on the first encoding dictionary to obtain the plurality of first original data blocks.

[0049] Optionally, the first encoding dictionary includes multiple first encoding dictionary blocks;

[0050] The decoding module is specifically used for:

[0051] For each of the plurality of first encoded data blocks, the following steps are performed respectively:

[0052] Based on a first dictionary filtering array corresponding to a first encoded data block, at least one first target encoded dictionary block corresponding to the first encoded data block is determined from the plurality of first encoded dictionary blocks;

[0053] Using at least one first target encoding dictionary block, the first encoded data block is de-encoded to obtain the first original data block corresponding to the first encoded data block.

[0054] Optionally, it also includes a storage module, which is specifically used for:

[0055] Before obtaining the query conditions, the first original data is encoded using the first encoding dictionary to obtain the first encoded data;

[0056] The first encoded data is divided into the plurality of first encoded data blocks according to the preset logical block size.

[0057] Optionally, the storage module is further configured to:

[0058] The first encoded dictionary is divided into the plurality of first encoded dictionary blocks according to the preset dictionary block size;

[0059] For each of the plurality of first encoded data blocks, the following steps are performed respectively:

[0060] Based on the encoding relationship between a first encoded data block and the plurality of first encoded dictionary blocks, a first dictionary filter array corresponding to the first encoded data block is determined. The array length of the first dictionary filter array is the number of the plurality of first encoded dictionary blocks. Each array cell in the first dictionary filter array corresponds to a first encoded dictionary block. The array cells corresponding to each first encoded dictionary block used when obtaining the first encoded data block are set to 1, and other data cells are set to 0.

[0061] Optionally, each second attribute to be queried corresponds to a second encoding dictionary;

[0062] The result acquisition module is specifically used for:

[0063] For each of the at least one second attribute to be queried, perform the following steps:

[0064] Based on a second target encoded data block corresponding to a second query attribute and the corresponding second position information, the target encoded data corresponding to the second query attribute is obtained from the second target encoded data block;

[0065] Using the second encoding dictionary corresponding to the second query attribute, the target encoded data is de-encoded to obtain the second attribute value of the second query attribute.

[0066] Optionally, the second encoding dictionary includes multiple second encoding dictionary blocks;

[0067] The result acquisition module is specifically used for:

[0068] Based on the second dictionary filtering array corresponding to the second target encoded data block, at least one second target encoded dictionary block corresponding to the second target encoded data block is determined from the plurality of second encoded dictionary blocks;

[0069] The target encoded data is de-encoded using at least one second target encoded dictionary block to obtain the second attribute value of the second query attribute.

[0070] Optionally, the storage module is specifically used for:

[0071] Before obtaining the query conditions, at least one second encoding dictionary is used to encode the corresponding second original data to obtain at least one second encoded data.

[0072] According to the preset logical block size, the at least one second encoded data is divided into multiple second encoded data blocks corresponding to each of the at least one second encoded data.

[0073] Optionally, the storage module is specifically used for:

[0074] For each of the at least one second encoded data, the following steps are performed:

[0075] According to the preset dictionary block size, the second encoded dictionary corresponding to a second encoded data is divided into the plurality of second encoded dictionary blocks;

[0076] For each of the multiple second encoded data blocks corresponding to the aforementioned second encoded data, the following steps are performed respectively:

[0077] Based on the encoding relationship between a second encoded data block and the plurality of second encoded dictionary blocks, a second dictionary filter array corresponding to the second encoded data block is determined. The array length of the second dictionary filter array is the number of the plurality of second encoded dictionary blocks. Each array unit in the second dictionary filter data corresponds to a second encoded dictionary block. The array units corresponding to each second encoded dictionary block used when obtaining the second encoded data block are set to 1, and other data units are set to 0.

[0078] On one hand, embodiments of this application provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the above-described data query method.

[0079] On one hand, embodiments of this application provide a computer-readable storage medium storing a computer program executable by a computer device, which, when run on the computer device, causes the computer device to perform the steps of the above-described data query method.

[0080] In this embodiment, by loading only the second target encoded data block corresponding to the second queried attribute each time, instead of loading all the second encoded data blocks corresponding to the second queried attribute, disk I / O can be effectively saved and memory consumption reduced, thereby improving the speed of data query. For each second queried attribute, the second attribute value corresponding to each second queried attribute is determined directly based on the second target encoded data block and the corresponding second position information, instead of obtaining the second attribute value corresponding to the second queried attribute by traversing the second target encoded data block, which can further improve the speed of data query. Attached Figure Description

[0081] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying 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.

[0082] Figure 1 A schematic diagram of a system architecture provided for an embodiment of this application;

[0083] Figure 2 This is a schematic diagram of the structure of a first encoding dictionary provided in an embodiment of this application;

[0084] Figure 3A flowchart illustrating a method for obtaining a first coded data block provided in an embodiment of this application;

[0085] Figure 4 This application provides a schematic diagram of the structure of multiple first encoding dictionary blocks in an embodiment.

[0086] Figure 5 A schematic diagram of a first encoded data block and a first dictionary filtering array provided in an embodiment of this application;

[0087] Figure 6 A schematic diagram of a first encoded data block and a first dictionary filtering array provided in an embodiment of this application;

[0088] Figure 7 This is a schematic diagram of a first raw data storage structure provided in an embodiment of this application;

[0089] Figure 8 This is a schematic diagram of a second original data storage structure provided in an embodiment of this application;

[0090] Figure 9 A flowchart illustrating a data query method provided in an embodiment of this application;

[0091] Figure 10 This application provides a schematic diagram of the structure of multiple first raw data blocks according to an embodiment of the present application.

[0092] Figure 11 A schematic diagram of a first encoding dictionary and multiple first encoding data blocks provided in an embodiment of this application;

[0093] Figure 12 A flowchart illustrating a decoding method provided in an embodiment of this application;

[0094] Figure 13 A flowchart illustrating a decoding method provided in an embodiment of this application;

[0095] Figure 14 A flowchart illustrating a decoding method provided in an embodiment of this application;

[0096] Figure 15 A flowchart illustrating a decoding method provided in an embodiment of this application;

[0097] Figure 16 A schematic diagram of a second encoding dictionary and multiple second encoding data blocks provided in an embodiment of this application;

[0098] Figure 17 A flowchart illustrating a decoding method provided in an embodiment of this application;

[0099] Figure 18A flowchart illustrating a decoding method provided in an embodiment of this application;

[0100] Figure 19 A flowchart illustrating a decoding method provided in an embodiment of this application;

[0101] Figure 20 A flowchart illustrating a decoding method provided in an embodiment of this application;

[0102] Figure 21 This is a schematic diagram of the structure of a data query device provided in an embodiment of this application;

[0103] Figure 22 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0104] To make the objectives, technical solutions, and beneficial effects of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0105] refer to Figure 1 This is a system architecture diagram applicable to the embodiments of this application. The system architecture includes at least a terminal device 101 and a data query system 102.

[0106] Terminal device 101 has a target application for data query installed. This application can be a pre-installed client, a web application, or a mini-program embedded in other applications. Terminal device 101 can be a smartphone, tablet, laptop, desktop computer, etc., but is not limited to these.

[0107] The data query system 102 serves as the backend server for the target application, providing services to it. The data query system 102 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0108] Terminal device 101 and data query system 102 can be connected directly or indirectly through wired or wireless communication, and this application does not impose any restrictions.

[0109] Terminal device 101 can respond to both user data storage operations and user data query operations.

[0110] When the terminal device 101 responds to the user's data storage operation, it sends the raw data to the data query system 102 for data storage. The raw data includes a first attribute and the first raw data corresponding to the first attribute, at least one second attribute and a second raw data corresponding to each of the at least one second attribute.

[0111] The data query system 102 determines the first encoding dictionary corresponding to the first original data based on the first original data, and encodes the first original data using the first encoding dictionary to obtain the first encoded data. Then, according to a preset logical block size, the first encoded data is divided into multiple first encoded data blocks. Each first encoded data block is assigned a number, 1, 2, 3…, according to the top-down arrangement of the first encoded data.

[0112] The data query system 102 divides the first encoded dictionary into multiple first encoded dictionary blocks according to a preset dictionary block size. For each of the multiple first encoded data blocks, the following steps are performed:

[0113] Based on the encoding relationship between a first encoded data block and multiple first encoded dictionary blocks, a first dictionary filter array corresponding to a first encoded data block is determined. The array length of the first dictionary filter array is the number of multiple first encoded dictionary blocks. Each array cell in the first dictionary filter array corresponds to a first encoded dictionary block. When obtaining a first encoded data block, the array cells corresponding to each first encoded dictionary block are set to 1, and the other array cells are set to 0.

[0114] The data query system 102 determines a corresponding second encoding dictionary for each piece of second raw data. Using at least one second encoding dictionary, the corresponding second raw data is encoded to obtain at least one piece of second encoded data. Then, according to a preset logical block size, each piece of second encoded data is divided into multiple second encoded data blocks. For each piece of second encoded data, a number is assigned to each second encoded data block according to the top-down arrangement of the second encoded data, namely 1, 2, 3…

[0115] The data query system 102 divides the second-encoded dictionary corresponding to a second-encoded data into multiple second-encoded dictionary blocks according to a preset dictionary block size. For at least one second-encoded data, the following steps are performed:

[0116] For each of the multiple second-coded data blocks corresponding to a single second-coded data, perform the following steps respectively:

[0117] Based on the encoding relationship between a second encoded data block and multiple second encoded dictionary blocks, a second dictionary filter array corresponding to a second encoded data block is determined. The array length of the second dictionary filter array is the number of multiple second encoded dictionary blocks. Each array cell in the second dictionary filter data corresponds to a second encoded dictionary block. When obtaining a second encoded data block, the array cells corresponding to each second encoded dictionary block are set to 1, and other data cells are set to 0.

[0118] Since the logical page size in a computer is 4KB, where 1024 lines equal 1KB, the default logical block size can be the logical page size, an integer multiple of the logical page size, or any other arbitrary value. Similarly, the default dictionary block size can be the logical page size, an integer multiple of the logical page size, or any other arbitrary value.

[0119] For example, the original data is shown in Table 1. The first attribute is name, and the second attribute is age. The first set of original data corresponding to the first attribute (name) is Table 2, and the second set of original data corresponding to the second attribute (age) is Table 3.

[0120] Table 1.

[0121] Name age Xiao Li 20 Xiao Zhang 21 Xiao Wang 35 Xiao Li 40 Xiao Zheng 21 Xiao Li 65 Xiao Zhao 20 Small money 35

[0122] Table 2.

[0123] Xiao Zhang Xiao Wang Xiao Li Xiao Zheng Xiao Li Xiao Zhao Small money

[0124] Table 3.

[0125] 20 21 35 40 21 65 2 3

[0126] The preset logic block size is set to 4 rows. The first original data in Table 2 is deduplicated to obtain the first encoding dictionary corresponding to the first original data, as shown below. Figure 2 As shown. The first encoded dictionary consists of multiple key-value pairs, each in the format {key:value}, specifically including {0: Xiao Zhang, 1: Xiao Li, 2: Xiao Wang, 3: Xiao Zheng, 4: Xiao Zhao, 5: Xiao Qian}.

[0127] like Figure 3 As shown, using Figure 2The first encoding dictionary shown encodes the first original data in Table 2 to obtain the first encoded data. Taking the original data "Xiao Li" in the first row of Table 2 as an example, the first encoding dictionary is consulted to determine that the encoded data corresponding to the original data "Xiao Li" is 1. The encoding method for the other original data in Table 2 is the same as that for the original data "Xiao Li", and will not be repeated here.

[0128] According to the preset logical block size, the first encoded data is divided into two first encoded data blocks, namely first encoded data block 1 and first encoded data block 2. The code corresponding to first encoded data block 1 is 1, and the code corresponding to first encoded data block 2 is 2.

[0129] Set the default dictionary block size to 2 lines, and... Figure 2 The first encoded dictionary in the code is divided into three first encoded dictionary blocks, namely first encoded dictionary block 1, first encoded dictionary block 2, and first encoded dictionary block 3, as follows: Figure 4 As shown.

[0130] like Figure 5 As shown, for the first encoded data block 1, the first dictionary filter array 1 corresponding to the first encoded data block 1 is determined. The array length of the first dictionary filter array 1 is 3. The first dictionary filter array 1 includes 3 array units. The first array unit corresponds to the first encoded dictionary block 1, the second array unit corresponds to the first encoded dictionary block 2, and the third array unit corresponds to the first encoded dictionary block 3.

[0131] Since the encoded data of the first row of the first encoded data block 1 is 1, encoded data 1 is stored in... Figure 4 In the first encoded dictionary block 1, there is an encoding relationship between the first encoded data block 1 and the first encoded dictionary block 1. Therefore, the first array unit in the first dictionary filter array 1 is set to 1. Similarly, the encoded data of the second row record in the first encoded data block 1 is 0, and the encoded data 0 is stored in Figure 4 In the first encoded dictionary block 1, there is an encoding relationship between the first encoded data block 1 and the first encoded dictionary block 1. Therefore, the first array unit in the first dictionary filter array 1 is set to 1. The encoded data recorded in the third row of the first encoded data block 1 is 2, and the encoded data 2 is stored in... Figure 4 In the first encoded dictionary block 2, there is an encoding relationship between the first encoded data block 1 and the first encoded dictionary block 2. Therefore, the second array unit in the first dictionary filter array 1 is set to 1. The encoded data recorded in the fourth row of the first encoded data block 1 is 1, and encoded data 1 is stored in... Figure 4 Therefore, there is an encoding relationship between the first encoded data block 1 and the first encoded dictionary block 1, so the first array unit in the first dictionary filter array 1 is set to 1.

[0132] Since the data in the first encoded dictionary block 3 is not present in the first encoded data block 1, there is no encoding relationship between the first encoded data block 1 and the first encoded dictionary block 3. Therefore, the third array unit in the first dictionary filter array 1 is set to 0.

[0133] like Figure 6 As shown, for the first encoded data block 2, the first dictionary filter array 2 corresponding to the first encoded data block 2 is determined. The array length of the first dictionary filter array 2 is 3. The first dictionary filter array 2 includes 3 array units. The first array unit corresponds to the first encoded dictionary block 1, the second array unit corresponds to the first encoded dictionary block 2, and the third array unit corresponds to the first encoded dictionary block 3.

[0134] Since the encoded data of the first row in the first encoded data block 2 is 3, encoded data 3 is stored in Figure 4 In the first encoded dictionary block 2, there is an encoding relationship between the first encoded data block 2 and the first encoded dictionary block 2. Therefore, the second array unit in the first dictionary filter array 2 is set to 1. Similarly, the encoded data recorded in the second row of the first encoded data block 2 is 1, and encoded data 1 is stored in... Figure 4 In the first encoded dictionary block 1, there is an encoding relationship between the first encoded data block 2 and the first encoded dictionary block 1. Therefore, the first array unit in the first dictionary filter array 2 is set to 1. The encoded data recorded in the third row of the first encoded data block 2 is 4, and the encoded data 4 is stored in... Figure 4 In the first encoded dictionary block 3, there is an encoding relationship between the first encoded data block 2 and the first encoded dictionary block 3. Therefore, the third array unit in the first dictionary filter array 2 is set to 1. The encoded data recorded in the fourth row of the first encoded data block 2 is 5, and the encoded data 5 is stored in... Figure 4 Therefore, there is an encoding relationship between the first encoded data block 2 and the first encoded dictionary block 3, so the third array unit in the first dictionary filter array 2 is set to 1.

[0135] Finally, as Figure 7 As shown, for the first original data in Table 2, the data query system 102 stores the first encoded dictionary block 1, the first encoded dictionary block 2, and the first encoded dictionary block 3, the first encoded data block 1 and the corresponding first dictionary filter array 1, the first encoded data block 2 and the corresponding first dictionary filter array 2.

[0136] like Figure 8As shown, the same operation is performed on the second original data in Table 3. The data query system 102 stores the second encoded dictionary block 1, the second encoded dictionary block 2 and the second encoded dictionary block 3, the second encoded data block 1 and the corresponding second dictionary filter array 1, the second encoded data block 2 and the corresponding second dictionary filter array 2.

[0137] In this embodiment, the data query system 102 does not directly store the first raw data and at least one second raw data. First, the first raw data is encoded to obtain first encoded data. Then, the first encoded data is divided into multiple first encoded data blocks. Since the storage space corresponding to each first encoded data block is relatively small, memory read / write speed can be effectively improved. Second, the first encoded dictionary is divided into multiple first encoded dictionary blocks. Based on the encoding relationship between each first encoded data block and the multiple first encoded dictionary blocks, a first dictionary filter array corresponding to each first encoded data block is determined, which facilitates improved query speed during subsequent data queries.

[0138] The same processing is applied to at least one second original data point, and the final beneficial effect is the same as that applied to the first original data point.

[0139] When terminal device 101 responds to a user's data query operation, it sends query conditions to data query system 102. Data query system 102 receives the query conditions, which include a first attribute to be queried and a corresponding first attribute value, as well as at least one second attribute to be queried. Based on the first attribute value, data query system 102 determines a first target original data block from multiple first original data blocks corresponding to the first attribute to be queried, and obtains the first number of the first target original data block and the first position information of the first attribute value within the first target original data block.

[0140] For each second query attribute, the data query system 102 determines the second target encoded data block from multiple second encoded data blocks corresponding to the second query attribute based on the first number, and determines the corresponding second position information in the second target encoded data block based on the first position information.

[0141] Finally, the data query system 102 determines the second attribute value corresponding to each of the at least one second query attribute based on the second target encoded data block corresponding to each of the at least one second query attribute and the corresponding second position information.

[0142] based on Figure 1 The system architecture diagram described above, and the flowchart of a data query method provided in this application embodiment, are as follows: Figure 9 As shown, the process of this method is executed by a computer device, which can be... Figure 1 The data query system 102 shown includes the following steps:

[0143] Step S901: Obtain the query conditions.

[0144] The query conditions include a first attribute to be queried and its corresponding value, as well as at least one second attribute to be queried. The first attribute value is the value corresponding to the first attribute to be queried.

[0145] For example, in Table 1, the first attribute to be queried is name, at least one second attribute to be queried is age, and the first attribute value corresponding to the first attribute to be queried is Xiao Li.

[0146] Step S902: Based on the first attribute value, determine the first target original data block from multiple first original data blocks corresponding to the first query attribute, and obtain the first number of the first target original data block and the first position information of the first attribute value in the first target original data block.

[0147] Specifically, based on multiple first encoded dictionary blocks, a first encoded data block is de-encoded to obtain a first original data block. Each first encoded data block corresponds to a number, and the first original data block obtained by de-encoding a first encoded data block also corresponds to the same number.

[0148] The first original data block corresponding to the first query attribute is traversed. If the first attribute value exists in the first original data block, then the first original data block is the first target original data block.

[0149] Based on the first attribute value, one first target original data block or multiple first target original data blocks can be determined from multiple first original data blocks corresponding to the first query attribute.

[0150] The first attribute value is the first location information within a first target original data block. This can be one or more values. The first location information is the row number of the first attribute value within the first target original data block.

[0151] For example, the first attribute to be queried is "name," and the value of the first attribute is "Xiao Li." For instance... Figure 10 As shown, the first attribute to be queried corresponds to two first raw data blocks, namely first raw data block 1 and first raw data block 2. First raw data block 1 includes four raw data items: Xiao Li, Xiao Zhang, Xiao Wang, and Xiao Li. First raw data block 2 includes four raw data items: Xiao Zheng, Xiao Li, Xiao Zhao, and Xiao Qian.

[0152] If both the first original data block 1 and the first original data block 2 contain the first attribute value "Xiao Li", then both the first original data block 1 and the first original data block 2 are the first target original data blocks.

[0153] When the first target original data block is the first original data block 1, the first number of the first target original data block is determined to be 1, and the first position information of the first attribute value "Xiao Li" in the first target original data block is 1 and 4.

[0154] When the first target original data block is the first original data block 2, the first number of the first target original data block is determined to be 2, and the first position information of the first attribute value "Xiao Li" in the first target original data block is 2.

[0155] Step S903: For each second query attribute, based on the first number, determine the second target encoded data block from the multiple second encoded data blocks corresponding to the second query attribute, and based on the first position information, determine the corresponding second position information in the second target encoded data block.

[0156] Specifically, from the multiple second encoded data blocks corresponding to the second query attribute, one second target encoded data block or multiple second target encoded data blocks can be determined.

[0157] The first position information in the first target encoded data block is the second position information in the second target encoded data block.

[0158] For example, if the second attribute to be queried is age, the stored data corresponding to the second attribute to be queried is as follows: Figure 8 As shown.

[0159] like Figure 10 As shown, when the first target raw data block is the first raw data block 1, the first number of the first target raw data block is determined to be 1, and the first position information of the first attribute value "Xiao Li" in the first target raw data block is 1 and 4. Because... Figure 8 The second encoded data block 1 is numbered 1, and the second encoded data block 2 is numbered 2. Therefore, the determined second target encoded data block is the second encoded data block 1, and the second position information is 1 and 4.

[0160] like Figure 10 As shown, when the first target raw data block is the first raw data block 2, the first number of the first target raw data block is determined to be 2, and the first position information of the first attribute value "Xiao Li" in the first target raw data block is 2. Because... Figure 8 The second encoded data block 1 is numbered 1, and the second encoded data block 2 is numbered 2. Therefore, the determined second target encoded data block is the second encoded data block 2, and the second position information is 2.

[0161] Step S904: Based on the second target encoded data block corresponding to each of the at least one second query attribute and the corresponding second position information, determine the second attribute value corresponding to each of the at least one second query attribute.

[0162] Determining the second attribute value corresponding to at least one second attribute to be queried can be achieved in the following two ways:

[0163] One possible implementation involves performing the following steps for each of at least one attribute to be queried:

[0164] Based on a second target encoded data block corresponding to a second query attribute and the corresponding second position information, a second encoding dictionary is used to determine the second attribute value corresponding to the second query attribute. The second encoding dictionary includes all second encoding dictionary blocks.

[0165] Another possible implementation involves performing the following steps for each of the at least one attribute to be queried:

[0166] Based on a second target encoded data block corresponding to a second query attribute and the corresponding second position information, at least one second target encoded dictionary block corresponding to the second target encoded data block is used to determine the second attribute value corresponding to a second query attribute.

[0167] For example, if the second attribute to be queried is age, the stored data corresponding to the second attribute to be queried is as follows: Figure 8 As shown.

[0168] The second target encoded data block is the second encoded data block 1. When the corresponding second position information is 1 and 4, the target encoded data 0 and 3 are obtained from the second encoded data block. Simultaneously, the entire second encoding dictionary (second encoded dictionary block 1, second encoded dictionary block 2, and second encoded dictionary block 3) is loaded into memory. By looking up the second encoding dictionary, the value corresponding to the target encoded data 0 is determined to be 20. Therefore, the corresponding second attribute value is obtained as 20. Using the same method, by looking up the second encoding dictionary, the value corresponding to the target encoded data 3 is determined to be 40. Therefore, the corresponding second attribute value is obtained as 40.

[0169] In this embodiment, by loading only the second target encoded data block corresponding to the second queried attribute each time, instead of loading all the second encoded data blocks corresponding to the second queried attribute, disk I / O can be effectively saved and memory consumption reduced, thereby improving the speed of data query. For each second queried attribute, the second attribute value corresponding to each second queried attribute is determined directly based on the second target encoded data block and the corresponding second position information, instead of obtaining the second attribute value corresponding to the second queried attribute by traversing the second target encoded data block, which can further improve the speed of data query.

[0170] Optionally, in the above step S902, the embodiments of the present application provide two implementation manners for obtaining multiple first original data blocks:

[0171] In a possible implementation manner, the first query attribute corresponds to multiple first encoded data blocks and a first encoding dictionary. Based on the first encoding dictionary, the multiple first encoded data blocks corresponding to the first query attribute are respectively decoded to obtain multiple first original data blocks.

[0172] For example, as Figure 11 shown, the first query attribute is name, the first query attribute corresponds to 2 first encoded data blocks and 1 first encoding dictionary, and the 2 first encoded data blocks are respectively the first encoded data block 1 and the first encoded data block 2. The first encoding dictionary specifically includes {0: Zhang, 1: Li, 2: Wang, 3: Zheng, 4: Zhao, 5: Qian}. The first encoded data block 1 includes 4 encoded data, which are 1, 0, 2, and 1 respectively, and the first encoded data block 2 includes 4 encoded data, which are 3, 1, 2, and 0 respectively.

[0173] As Figure 12 shown, based on the first encoding dictionary, the first encoded data block 1 is decoded to obtain the first original data block 1. Taking the encoded data "1" in the first row of the first encoded data block 1 as an example, by looking up the first encoding dictionary, it is determined that the original data corresponding to the encoded data "1" is "Li". The decoding methods of other encoded data in the first encoded data block 1 are the same as that of the encoded data "1", which will not be elaborated here.

[0174] As Figure 13 shown, based on the first encoding dictionary, the first encoded data block 2 is decoded to obtain the first original data block 2. Taking the encoded data "3" in the first row of the first encoded data block 2 as an example, by looking up the first encoding dictionary, it is determined that the original data corresponding to the encoded data "3" is "Zheng". The decoding methods of other encoded data in the first encoded data block 1 are the same as that of the encoded data "3", which will not be elaborated here.

[0175] In the embodiments of the present application, decoding each first encoded data block to obtain the first original data block can effectively avoid loading all the first encoded data blocks into the memory for decoding, avoid large memory storage overhead, save disk I / O at the same time, and improve the decoding efficiency.

[0176] In another possible implementation manner, the first query attribute corresponds to multiple first encoded data blocks and a first encoding dictionary, where the first encoding dictionary includes multiple first encoding dictionary blocks.

[0177] For the multiple first encoded data blocks, the following steps are respectively executed:

[0178] Based on the first dictionary filtering array corresponding to a first encoded data block, at least one first target encoded dictionary block corresponding to a first encoded data block is determined from multiple first encoded dictionary blocks. Then, using at least one first target encoded dictionary block, the first encoded data block is de-encoded to obtain the first original data block corresponding to the first encoded data block.

[0179] For example, such as Figure 7 As shown, the first attribute to be queried is name. The first attribute to be queried corresponds to 2 first-encoded data blocks and 3 first-encoded dictionary blocks. The 2 first-encoded data blocks are first-encoded data block 1 and first-encoded data block 2. The 3 first-encoded dictionary blocks are first-encoded dictionary block 1, first-encoded dictionary block 2 and first-encoded dictionary block 3. Specifically, first-encoded dictionary block 1 includes {0: Xiao Zhang, 1: Xiao Li}, first-encoded dictionary block 2 includes {2: Xiao Wang, 3: Xiao Zheng}, and first-encoded dictionary block 3 includes {4: Xiao Zhao, 5: Xiao Qian}.

[0180] The first encoded data block 1 corresponds to the first dictionary filter array 1, and the first encoded data block 2 corresponds to the first dictionary filter array 2. The first dictionary filter array 1 includes three array elements: the first element is 1, indicating that the first encoded dictionary block 1 is the first target encoded dictionary block; the second element is 1, indicating that the first encoded dictionary block 2 is the first target encoded dictionary block; and the third element is 0, indicating that the first encoded dictionary block 3 is not the first target encoded dictionary block. Therefore, the two first target encoded dictionary blocks corresponding to the first encoded data block 1 are first encoded dictionary block 1 and first encoded dictionary block 2, respectively.

[0181] The first dictionary filtering array 2 includes three array elements. The first array element is 1, indicating that the first encoded dictionary block 1 is the first target encoded dictionary block. The second array element is 1, indicating that the first encoded dictionary block 2 is the first target encoded dictionary block. The third array element is 1, indicating that the first encoded dictionary block 3 is the first target encoded dictionary block. Therefore, the three first target encoded dictionary blocks corresponding to the first encoded data block 2 are first encoded dictionary block 1, first encoded dictionary block 2, and first encoded dictionary block 3, respectively.

[0182] like Figure 14 As shown, based on the two first target encoding dictionary blocks corresponding to the first encoded data block 1, the first encoded data block 1 is de-encoded to obtain the first original data block 1. Taking the encoded data "1" in the first row of the first encoded data block 1 as an example, by searching the two first target encoding dictionary blocks (i.e., first encoding dictionary block 1 and first encoding dictionary block 2), the original data corresponding to the encoded data "1" is determined to be "Xiao Li". The de-encoding method of other encoded data in the first encoded data block 1 is the same as that of the encoded data "1", and will not be described again here.

[0183] As Figure 15 shown, based on the 3 first target coding dictionary blocks corresponding to the first coding data block 2, the first coding data block 2 is decoded to obtain the first original data block 2. Taking the coding data "3" recorded in the first row of the first coding data block 2 as an example, by looking up the 3 first target coding dictionary blocks (i.e., the first coding dictionary block 1, the first coding dictionary block 2, and the first coding dictionary block 3), it is determined that the original data corresponding to the coding data "3" is "Xiaozheng". The decoding methods for other coding data in the first coding data block 2 are the same as that of the coding data "3", which will not be elaborated here.

[0184] In the embodiment of the present application, at least one first target coding dictionary block corresponding to each first coding data block is determined, and based on the at least one first target coding dictionary block, the first coding data block is decoded to obtain the first original data block. Since not all the first coding dictionary blocks are loaded into the memory, but each time a first coding data block and the corresponding at least one first target coding dictionary block are loaded into the memory for decoding to obtain the first original data block, it can further reduce the large memory storage overhead, save disk I / O at the same time, and improve the decoding efficiency.

[0185] Optionally, in the above step S904, the embodiment of the present application provides two methods for determining the second attribute values corresponding to at least one second to-be-query attribute:

[0186] A possible implementation manner is to respectively perform the following steps for at least one second to-be-query attribute:

[0187] Based on the second target coding data block corresponding to one second to-be-query attribute and the corresponding second position information, the target coding data corresponding to one second to-be-query attribute is obtained from the second target coding data block. Then, the second coding dictionary corresponding to one second to-be-query attribute is used to decode the target coding data to obtain the second attribute value of one second to-be-query attribute.

[0188] For example, as Figure 16 shown, the second to-be-query attribute is age, and the second to-be-query attribute corresponds to 2 second target coding data blocks and 1 second coding dictionary. The 2 second target coding data blocks are respectively the second coding data block 1 and the second coding data block 2. The second coding dictionary consists of multiple key-value pairs, and the format of each key-value pair is {key: value}, specifically including {0: 20, 1: 21, 2: 35, 3: 40, 4: 65}.

[0189] When the second target coding data block is the second coding data block 1 in Figure 16 and the second position information is 1 and 4, from Figure 16Two target encoded data are obtained from the second encoded data block 1, namely target encoded data 1 and target encoded data 2, where target encoded data 1 is 0 and target encoded data 2 is 3. For example... Figure 17 As shown, by looking up the second encoding dictionary, the original data corresponding to target encoded data 1 is determined to be 20. Therefore, the second attribute value 1 is obtained as 20. By looking up the second encoding dictionary, the original data corresponding to target encoded data 2 is determined to be 40. Therefore, the second attribute value 2 is obtained as 40.

[0190] When the second target encoded data block is Figure 16 In the second encoded data block 2, when the second position information is 2, from Figure 16 The target encoded data obtained from the second encoded data block 2 is 4. For example... Figure 18 As shown, by looking up the second encoding dictionary, the original data corresponding to the target encoded data is determined to be 65. Therefore, the second attribute value is obtained as 65.

[0191] In this embodiment, instead of loading all the second encoded data blocks corresponding to the second queried attribute into memory, the second target encoded data block corresponding to the second queried attribute is loaded into memory each time. This effectively reduces memory storage overhead, saves disk I / O, and improves data query efficiency. Furthermore, the target encoded data is obtained from the second target encoded data block, and only the target encoded data is de-encoded to obtain the second attribute value. Therefore, data query efficiency can be further improved.

[0192] Another possible implementation is that the second encoded dictionary includes multiple second encoded dictionary blocks, and for at least one second attribute to be queried, the following steps are performed respectively:

[0193] Based on a second target encoded data block corresponding to a second query attribute and its corresponding second position information, target encoded data corresponding to the second query attribute is obtained from the second target encoded data block. Then, based on the second dictionary filtering array corresponding to the second target encoded data block, at least one second target encoded dictionary block is determined from multiple second encoded dictionary blocks. Finally, using at least one second target encoded dictionary block, the target encoded data is de-encoded to obtain the second attribute value of the second query attribute.

[0194] For example, such as Figure 8As shown, the second attribute to be queried is age. The second attribute to be queried corresponds to two second target encoded data blocks and three second encoded dictionary blocks. The two second target encoded data blocks are second encoded data block 1 and second encoded data block 2, respectively. The three second encoded dictionary blocks are second encoded dictionary block 1, second encoded dictionary block 2 and second encoded dictionary block 3, respectively. Specifically, second encoded dictionary block 1 includes {0:20, 1:21}, second encoded dictionary block 2 includes {2:35, 3:40} and second encoded dictionary block 3 includes {4:65}.

[0195] The second encoded data block 1 corresponds to the second dictionary filter array 1, and the second encoded data block 2 corresponds to the second dictionary filter array 2. The second dictionary filter array 1 includes three array elements: the first element is 1, indicating that the second encoded dictionary block 1 is the second target encoded dictionary block; the second element is 1, indicating that the second encoded dictionary block 2 is the second target encoded dictionary block; and the third element is 0, indicating that the second encoded dictionary block 3 is not the second target encoded dictionary block. Therefore, the two second target encoded dictionary blocks corresponding to the second encoded data block 1 are the second encoded dictionary block 1 and the second encoded dictionary block 2, respectively.

[0196] When the second target encoded data block is Figure 8 In the second encoded data block 1, when the second position information is 1 and 4, from Figure 8 Two target encoded data are obtained from the second encoded data block 1, namely target encoded data 1 and target encoded data 2, where target encoded data 1 is 0 and target encoded data 2 is 3. For example... Figure 19 As shown, by searching the second encoding dictionary block 1 and the second encoding dictionary block 2, the original data corresponding to the target encoded data 1 is determined to be 20. Therefore, the second attribute value 1 is obtained as 20. By searching the second encoding dictionary block 1 and the second encoding dictionary block 2, the original data corresponding to the target encoded data 2 is determined to be 40. Therefore, the second attribute value 2 is obtained as 40.

[0197] Figure 8 The second dictionary filter array 2 in the code includes three array elements. The first array element is 1, indicating that the second encoded dictionary block 1 is the second target encoded dictionary block. The second array element is 1, indicating that the second encoded dictionary block 2 is the second target encoded dictionary block. The third array element is 1, indicating that the second encoded dictionary block 3 is the second target encoded dictionary block. Therefore, the two second target encoded dictionary blocks corresponding to the second encoded data block 1 are the second encoded dictionary block 1, the second encoded dictionary block 2, and the second encoded dictionary block 3, respectively.

[0198] When the second target encoded data block is Figure 8 When the second encoded data block is 2, the second position information is 2, from Figure 8The target encoded data obtained from the second encoded data block 2 is 4. For example... Figure 20 As shown, by searching the second encoding dictionary block 1, the second encoding dictionary block 2 and the second encoding dictionary block 3, the original data corresponding to the target encoded data 4 is determined to be 65. Therefore, the second attribute value is obtained as 65.

[0199] In this embodiment, instead of loading all second encoded data blocks corresponding to the second queried attribute into memory, the second target encoded data block corresponding to the second queried attribute is loaded into memory each time. This effectively reduces memory storage overhead, saves disk I / O, and improves data query efficiency. Secondly, instead of loading all second encoded dictionary blocks into memory, at least one second target encoded dictionary block corresponding to the second target encoded data block is loaded into memory each time. Then, at least one second target encoded dictionary block is used to de-encode the target encoded data to obtain the second attribute value. This further reduces memory storage overhead, saves disk I / O, and improves data query efficiency.

[0200] Based on the same technical concept, embodiments of this application provide a data query device, such as... Figure 21 As shown, the data query device 2100 includes:

[0201] The acquisition module 2101 is used to acquire query conditions, the query conditions including a first attribute to be queried and a corresponding first attribute value, and at least one second attribute to be queried;

[0202] The location determination module 2102 is used to determine a first target original data block from multiple first original data blocks corresponding to the first query attribute based on the first attribute value, and to obtain the first number of the first target original data block and the first location information of the first attribute value in the first target original data block.

[0203] The location determination module 2102 is further configured to, for each second query attribute, determine a second target encoded data block from a plurality of second encoded data blocks corresponding to the second query attribute based on the first number, and determine the corresponding second location information in the second target encoded data block based on the first location information;

[0204] The result acquisition module 2103 is used to determine the second attribute value corresponding to each of the at least one second query attribute based on the second target encoded data block corresponding to each of the at least one second query attribute and the corresponding second position information.

[0205] Optionally, it also includes a decoding module 2104, which is specifically used for:

[0206] Before determining the first target original data block from the plurality of first original data blocks corresponding to the first query attribute based on the first attribute value, the plurality of first encoded data blocks corresponding to the first query attribute are de-encoded based on the first encoding dictionary to obtain the plurality of first original data blocks.

[0207] Optionally, the first encoding dictionary includes multiple first encoding dictionary blocks;

[0208] The inverse encoding module 2104 is specifically used for:

[0209] For each of the plurality of first encoded data blocks, the following steps are performed respectively:

[0210] Based on a first dictionary filtering array corresponding to a first encoded data block, at least one first target encoded dictionary block corresponding to the first encoded data block is determined from the plurality of first encoded dictionary blocks;

[0211] Using at least one first target encoding dictionary block, the first encoded data block is de-encoded to obtain the first original data block corresponding to the first encoded data block.

[0212] Optionally, it also includes a storage module 2105, which is specifically used for:

[0213] Before obtaining the query conditions, the first original data is encoded using the first encoding dictionary to obtain the first encoded data;

[0214] The first encoded data is divided into the plurality of first encoded data blocks according to the preset logical block size.

[0215] Optionally, the storage module 2105 is further configured to:

[0216] The first encoded dictionary is divided into the plurality of first encoded dictionary blocks according to the preset dictionary block size;

[0217] For each of the plurality of first encoded data blocks, the following steps are performed respectively:

[0218] Based on the encoding relationship between a first encoded data block and the plurality of first encoded dictionary blocks, a first dictionary filter array corresponding to the first encoded data block is determined. The array length of the first dictionary filter array is the number of the plurality of first encoded dictionary blocks. Each array cell in the first dictionary filter array corresponds to a first encoded dictionary block. The array cells corresponding to each first encoded dictionary block used when obtaining the first encoded data block are set to 1, and other data cells are set to 0.

[0219] Optionally, each second attribute to be queried corresponds to a second encoding dictionary;

[0220] The result acquisition module 2103 is specifically used for:

[0221] For each of the at least one second attribute to be queried, perform the following steps:

[0222] Based on a second target encoded data block corresponding to a second query attribute and the corresponding second position information, the target encoded data corresponding to the second query attribute is obtained from the second target encoded data block;

[0223] Using the second encoding dictionary corresponding to the second query attribute, the target encoded data is de-encoded to obtain the second attribute value of the second query attribute.

[0224] Optionally, the second encoding dictionary includes multiple second encoding dictionary blocks;

[0225] The result acquisition module 2103 is specifically used for:

[0226] Based on the second dictionary filtering array corresponding to the second target encoded data block, at least one second target encoded dictionary block corresponding to the second target encoded data block is determined from the plurality of second encoded dictionary blocks;

[0227] The target encoded data is de-encoded using at least one second target encoded dictionary block to obtain the second attribute value of the second query attribute.

[0228] Optionally, the storage module 2105 is specifically used for:

[0229] Before obtaining the query conditions, at least one second encoding dictionary is used to encode the corresponding second original data to obtain at least one second encoded data.

[0230] According to the preset logical block size, the at least one second encoded data is divided into multiple second encoded data blocks corresponding to each of the at least one second encoded data.

[0231] Optionally, the storage module 2105 is specifically used for:

[0232] For each of the at least one second encoded data, the following steps are performed:

[0233] According to the preset dictionary block size, the second encoded dictionary corresponding to a second encoded data is divided into the plurality of second encoded dictionary blocks;

[0234] For each of the multiple second encoded data blocks corresponding to the aforementioned second encoded data, the following steps are performed respectively:

[0235] Based on the encoding relationship between a second encoded data block and the plurality of second encoded dictionary blocks, a second dictionary filter array corresponding to the second encoded data block is determined. The array length of the second dictionary filter array is the number of the plurality of second encoded dictionary blocks. Each array unit in the second dictionary filter data corresponds to a second encoded dictionary block. The array units corresponding to each second encoded dictionary block used when obtaining the second encoded data block are set to 1, and other data units are set to 0.

[0236] Based on the same technical concept, embodiments of this application provide a computer device, which may be a terminal or a server, such as... Figure 22 As shown, it includes at least one processor 2201 and a memory 2202 connected to at least one processor. In this embodiment, the specific connection medium between the processor 2201 and the memory 2202 is not limited. Figure 22 Taking the connection between the processor 2201 and the memory 2202 via a bus as an example, the bus can be divided into address bus, data bus, control bus, etc.

[0237] In this embodiment of the application, the memory 2202 stores instructions that can be executed by at least one processor 2201. By executing the instructions stored in the memory 2202, at least one processor 2201 can perform the steps included in the above-described data query method.

[0238] The processor 2201 is the control center of the computer device, capable of connecting to various parts of the computer device via various interfaces and lines. It performs data queries by running or executing instructions stored in the memory 2202 and accessing data stored in the memory 2202. Optionally, the processor 2201 may include one or more processing units. The processor 2201 may integrate an application processor and a modem processor. The application processor primarily handles the operating system, user interface, and applications, while the modem processor primarily handles wireless communication. It is understood that the modem processor may not be integrated into the processor 2201. In some embodiments, the processor 2201 and the memory 2202 may be implemented on the same chip; in other embodiments, they may be implemented on separate chips.

[0239] Processor 2201 can be a general-purpose processor, such as a central processing unit (CPU), digital signal processor, application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.

[0240] Memory 2202, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory 2202 may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic storage, magnetic disk, optical disk, etc. Memory 2202 can be any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. In the embodiments of this application, memory 2202 can also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.

[0241] Based on the same inventive concept, embodiments of this application provide a computer-readable storage medium storing a computer program executable by a computer device, which, when run on the computer device, causes the computer device to perform the steps of the above-described data query method.

[0242] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0243] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0244] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0245] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0246] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A data query method, characterized in that, include: Obtain query conditions, the query conditions including a first attribute to be queried and a corresponding first attribute value, and at least one second attribute to be queried; Based on the first attribute value, a first target original data block is determined from multiple first original data blocks corresponding to the first query attribute, and a first number of the first target original data block and a first position information of the first attribute value in the first target original data block are obtained; wherein, the multiple first original data blocks are obtained by de-encoding multiple first encoded data in multiple first encoded data blocks based on a first encoding dictionary; the first position information is the row number of the first attribute value in the first target original data block; the multiple first encoded data blocks are obtained by encoding the first original data in the original data according to the first encoding dictionary and then dividing it according to a preset logical block size; For each second query attribute, based on the first number, a second target encoded data block is determined from multiple second encoded data blocks corresponding to the second query attribute, and based on the first position information, the corresponding second position information in the second target encoded data block is determined; the multiple second encoded data blocks are obtained by encoding the second original data in the original data according to the second encoding dictionary and then dividing it according to a preset logical block size; Based on the second target encoded data block corresponding to each of the at least one second query attribute and the corresponding second position information, the second attribute value corresponding to each of the at least one second query attribute is determined by the second encoded dictionary.

2. The method as described in claim 1, characterized in that, Before determining the first target original data block from multiple first original data blocks corresponding to the first queried attribute based on the first attribute value, the method further includes: Based on the first encoding dictionary, the multiple first encoded data blocks corresponding to the first query attribute are de-encoded to obtain the multiple first original data blocks.

3. The method as described in claim 2, characterized in that, The first encoding dictionary includes multiple first encoding dictionary blocks; The step of de-encoding multiple first-encoded data blocks corresponding to the first queried attribute based on the first encoding dictionary to obtain the multiple first original data blocks includes: For each of the plurality of first encoded data blocks, the following steps are performed respectively: Based on a first dictionary filtering array corresponding to a first encoded data block, at least one first target encoded dictionary block corresponding to the first encoded data block is determined from the plurality of first encoded dictionary blocks; Using at least one first target encoding dictionary block, the first encoded data block is de-encoded to obtain the first original data block corresponding to the first encoded data block.

4. The method as described in claim 2, characterized in that, Before obtaining the query conditions, the process also includes: The first original data is encoded using the first encoding dictionary to obtain the first encoded data; The first encoded data is divided into the plurality of first encoded data blocks according to the preset logical block size.

5. The method as described in claim 4, characterized in that, Also includes: The first encoding dictionary includes multiple first encoding dictionary blocks; The first encoded dictionary is divided into the plurality of first encoded dictionary blocks according to the preset dictionary block size; For each of the plurality of first encoded data blocks, the following steps are performed respectively: Based on the encoding relationship between a first encoded data block and the plurality of first encoded dictionary blocks, a first dictionary filter array corresponding to the first encoded data block is determined. The array length of the first dictionary filter array is the number of the plurality of first encoded dictionary blocks. Each array cell in the first dictionary filter array corresponds to a first encoded dictionary block. The array cells corresponding to each first encoded dictionary block used when obtaining the first encoded data block are set to 1, and other data cells are set to 0.

6. The method as described in claim 1, characterized in that, Each second attribute to be queried corresponds to a second encoding dictionary; The step of determining the second attribute value corresponding to each of the at least one second query attribute based on the second target encoded data block corresponding to each of the at least one second query attribute and the corresponding second position information includes: For each of the at least one second attribute to be queried, perform the following steps: Based on a second target encoded data block corresponding to a second query attribute and the corresponding second position information, the target encoded data corresponding to the second query attribute is obtained from the second target encoded data block; Using the second encoding dictionary corresponding to the second query attribute, the target encoded data is de-encoded to obtain the second attribute value of the second query attribute.

7. The method as described in claim 6, characterized in that, The second encoding dictionary includes multiple second encoding dictionary blocks; The step of using the second encoding dictionary corresponding to the second query attribute to de-encode the target encoded data and obtain the second attribute value of the second query attribute includes: Based on the second dictionary filtering array corresponding to the second target encoded data block, at least one second target encoded dictionary block corresponding to the second target encoded data block is determined from the plurality of second encoded dictionary blocks; The target encoded data is de-encoded using at least one second target encoded dictionary block to obtain the second attribute value of the second query attribute.

8. The method as described in claim 6, characterized in that, Before obtaining the query conditions, the process also includes: At least one second encoding dictionary is used to encode the corresponding second original data to obtain at least one second encoded data; According to the preset logical block size, the at least one second encoded data is divided into multiple second encoded data blocks corresponding to each of the at least one second encoded data.

9. The method as described in claim 8, characterized in that, Also includes: The second encoding dictionary includes multiple second encoding dictionary blocks; For each of the at least one second encoded data, the following steps are performed: According to the preset dictionary block size, the second encoded dictionary corresponding to a second encoded data is divided into the plurality of second encoded dictionary blocks; For each of the multiple second encoded data blocks corresponding to the aforementioned second encoded data, the following steps are performed respectively: Based on the encoding relationship between a second encoded data block and the plurality of second encoded dictionary blocks, a second dictionary filter array corresponding to the second encoded data block is determined. The array length of the second dictionary filter array is the number of the plurality of second encoded dictionary blocks. Each array cell in the second dictionary filter array corresponds to a second encoded dictionary block. The array cells corresponding to each second encoded dictionary block used when obtaining the second encoded data block are set to 1, and other data cells are set to 0.

10. A data query device, characterized in that, include: The acquisition module is used to acquire query conditions, the query conditions including a first attribute to be queried and a corresponding first attribute value, and at least one second attribute to be queried; The location determination module is used to determine a first target original data block from multiple first original data blocks corresponding to the first query attribute based on the first attribute value, and to obtain the first number of the first target original data block and the first position information of the first attribute value in the first target original data block; wherein, the multiple first original data blocks are obtained by de-encoding multiple first encoded data in multiple first encoded data blocks based on a first encoding dictionary; the first position information is the row number of the first attribute value in the first target original data block; the multiple first encoded data blocks are obtained by encoding the first original data in the original data according to the first encoding dictionary and then dividing it according to a preset logical block size; The location determination module is used to determine a second target encoded data block from multiple second encoded data blocks corresponding to each second query attribute based on the first number, and to determine the corresponding second location information in the second target encoded data block based on the first location information; the multiple second encoded data blocks are obtained by encoding the second original data in the original data according to the second encoding dictionary and then dividing it according to a preset logical block size; The result acquisition module is used to determine the second attribute value corresponding to each of the at least one second query attribute by means of the second target encoded data block corresponding to each of the at least one second query attribute and the corresponding second position information, through the second encoding dictionary.

11. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method according to any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that, It stores a computer program executable by a computer device, which, when run on the computer device, causes the computer device to perform the steps of the method according to any one of claims 1 to 9.

13. A computer program product, characterized in that, The computer program product stores instructions that, when read and executed by a computer, cause the computer to perform the method as described in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Data storage device, data query method and device, server and storage medium

    CN111611250A

  • Relational dictionaries

    US20190155930A1