Data processing method and device
By determining the index corresponding to the query request and using metadata information, the problem of low query efficiency in the storage system is solved, fast query and multi-table joint access are realized, and the user experience and data query efficiency are improved.
Patent Information
- Application Number
- CN202310226588.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-09
- Publication Date
- 2024-09-17
AI Technical Summary
When processing query requests, existing storage systems need to traverse all data in the database, resulting in low query efficiency and inability to quickly feedback query results, affecting user experience.
By receiving the query request, it determines the index corresponding to the request, queries the data associated with the index from the database, uses metadata information and multi-level indexes to quickly narrow the query scope, and uses multi-threading to query multiple tables in parallel to improve data query efficiency.
It realizes fast data query, narrows the query scope, improves data query efficiency, improves user experience, and is suitable for massive data query scenarios.
Smart Images

Figure CN118656367A
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of big data technology, and in particular, to a data processing method and device. Background Art
[0002] To meet the users' increasing demand for data storage, cloud storage services have gradually emerged. In cloud storage services, users can write data into the storage system built by the service provider through terminal devices. The storage system can store data in the form of a database. When users need to use data, they can send a query request to the storage system through the terminal device. After receiving the query request, the storage system reads the data required by the user from the database.
[0003] Currently, the storage system needs to traverse the data in the database according to the query request to obtain the data that meets the query request. It takes a long time to traverse the database, resulting in low data query efficiency. Summary of the invention
[0004] The embodiments of the present application provide a data processing method and device for improving the efficiency of querying data.
[0005] In the first aspect, an embodiment of the present application provides a data processing method, which can be executed by a data processing device. The data processing device can be implemented by one or more computing devices, or the data processing device can be implemented by a software or hardware module in a computing device. The embodiment of the present application does not limit the implementation form of the data processing device. The method includes: a data processing device receives a query request, the query request indicates at least one field to which the data to be queried belongs; according to metadata information, at least one index corresponding to the query request is determined, the metadata information indicates the relationship between the index and the data corresponding to multiple fields, and the multiple fields include the at least one field; from a database, N groups of data associated with the at least one index are queried, the database includes multiple indexes, and at least one group of data corresponding to the multiple fields associated with each index in the multiple indexes, the multiple indexes are arranged in order in the database, and N is a positive integer; and a query result is sent, and the query result indicates the N groups of data.
[0006] In the embodiment of the present application, the data processing device determines at least one index corresponding to the query request, and the at least one index is equivalent to clarifying the search scope, so the data corresponding to the at least one index can be directly determined from the database. In this way, there is no need to traverse all the data in the database one by one, which improves the efficiency of querying data. In addition, the data processing device can feedback the query results more quickly, which is conducive to improving the user experience.
[0007] In a possible implementation, the database includes a first table and a second table, the first table and the second table are used to store the multiple indexes, and at least one group of data corresponding to the multiple fields associated with each index in the multiple indexes, the amount of data in the first table is smaller than the amount of data in the second table; querying N groups of data associated with the at least one index from the database includes: from the first table, querying a group of data associated with each index in the at least one index, obtaining a total of K groups of data, K is a positive integer; from the second table, querying a group of data that is the same as each group of data in the K groups of data, obtaining a total of L groups of data, L is a non-negative integer, and the N groups of data include the K groups of data and the L groups of data.
[0008] In the above implementation, the data processing device may first query K groups of data corresponding to at least one index from a table with a small amount of data (such as the first table), and query the data identical to each group of data in the K groups of data from a table with a large amount of data (such as the second table) based on the K groups of data. On the one hand, the first table has a small amount of data, which makes it possible to quickly query the K groups of data, which is conducive to improving the efficiency of data query; on the other hand, after obtaining the K groups of data in the first table, the data processing device can quickly obtain L groups of data based on the K groups of data, thereby realizing joint access to multiple tables, which is also conducive to improving the efficiency of querying data.
[0009] In a possible implementation, the data processing device includes a first thread and a second thread, the first thread being used to query a group of data associated with each index in the at least one index from the first table; and query a group of data identical to each group of data in the K groups of data from the second table, including: sending the K groups of data to the second thread through the first thread; and querying a group of data identical to each group of data in the K groups of data from the second table through the second thread.
[0010] In the above implementation, the data processing device can use multiple threads to query data from multiple tables respectively. These multiple threads can share the processing load of the query data, which is conducive to load balancing of these multiple threads and improving the efficiency of data query.
[0011] In one possible implementation, before determining at least one index corresponding to the query request based on the metadata information, the method further includes: receiving the multiple indexes from the source device, and at least one set of data corresponding to the multiple fields associated with each of the multiple indexes; extracting the relationship between the multiple indexes and the at least one set of data corresponding to the multiple fields, obtaining the metadata information, and storing the metadata information.
[0012] In the above implementation, the data processing device can automatically identify the relationship between multiple indexes and at least one set of data corresponding to multiple fields to obtain metadata information, providing a way for a data processing device to determine metadata information.
[0013] In one possible embodiment, the data processing device includes at least one interface, one of which supports a communication protocol; receiving the multiple indexes, and at least one set of data corresponding to the multiple fields associated with each of the multiple indexes, including: determining a target interface that matches the communication protocol of a source device or a data storage device from the at least one interface; and receiving, through the target interface, the multiple indexes corresponding to the multiple fields, and at least one set of data corresponding to the multiple fields associated with each of the multiple indexes from the source device or the data storage device.
[0014] In a possible implementation, the query request includes a multi-level query request, each level of the query request in the multi-level query request indicates some fields in the at least one field; the metadata information indicates the relationship between each level of index in the multi-level index and the data corresponding to some fields in the multiple fields, and each level of the query request in the multi-level query request corresponds to a first-level index in the multi-level index; according to the metadata information, determining at least one index corresponding to the query request, including: determining a value range of the first-level index corresponding to each level of the query request in the multi-level query request according to the relationship between each level of index in the multi-level index and some fields in the multiple fields, and obtaining a total value range of the multi-level index, wherein the at least one index is the intersection of the value ranges of the multi-level index.
[0015] In the above implementation, scenarios in which multi-level query requests are made to query data can be supported. In other words, the above implementation can support more data query scenarios, making the above implementation more applicable.
[0016] In a possible implementation, the query request at each level also indicates a value range of the data corresponding to some fields in the at least one field; determining the value range of the first-level index corresponding to each level of the query request in the multi-level query request includes: determining the value range of the first-level index corresponding to each level of the query request based on the value range of the data corresponding to each field in some fields in the at least one field indicated by the query request at each level.
[0017] In the above embodiment, each level of query request also indicates the value range of the data corresponding to the corresponding field. The data processing device can directly determine the value range of the first-level index corresponding to the query request of this level based on the value range of the data indicated by the query request of each level, thereby providing a method for determining the value range of each level of index, and the method for determining the value range of each level of index is relatively simple.
[0018] In a second aspect, an embodiment of the present application provides a data processing device, which may be the data processing device in the first aspect, or may implement the same functions as the data processing device in the first aspect. The data processing device includes corresponding means or modules for executing the first aspect or any possible implementation method. For example, the data processing device includes a query request parsing module (sometimes also referred to as a query request parsing unit), and a data query module (sometimes also referred to as a data query unit). Optionally, the data processing device also includes a metadata storage module (also referred to as a metadata storage unit).
[0019] Exemplarily, a query request parsing module is used to receive a query request, the query request indicating at least one field to which the data to be queried belongs, and to determine at least one index corresponding to the query request based on metadata information, the metadata information indicating a relationship between the index and the data corresponding to multiple fields, the multiple fields including the at least one field; the data query module is used to query N groups of data associated with the at least one index from a database, the database including multiple indexes, and at least one group of data corresponding to the multiple fields associated with each index in the multiple indexes, the multiple indexes being arranged in order in the database, and N being a positive integer; the query request parsing module is also used to send a query result, the query result indicating the N groups of data.
[0020] Optionally, the data processing device further includes other components, such as an antenna, an input / output module, an interface, etc. These components may be hardware, software, or a combination of software and hardware.
[0021] In a third aspect, an embodiment of the present application provides a computing device, comprising: a processor and a memory; the memory is used to store one or more computer programs, the one or more computer programs include computer instructions, and when the processor executes the computer instructions, the method described in the first aspect and any one of any possible implementations is executed.
[0022] In a fourth aspect, an embodiment of the present application provides a computing device cluster, comprising at least one computing device, each computing device comprising a processor and a memory; the processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster performs a method as described in the first aspect and any one of any possible implementations.
[0023] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, which is used to store computer programs or instructions. When the computer-readable storage medium is executed, it implements the method described in the first aspect and any one of any possible implementations.
[0024] In a sixth aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when executed on a computer, implements the method described in the first aspect and any one of any possible implementations.
[0025] Regarding the beneficial effects of the second to sixth aspects, reference may be made to the beneficial effects discussed in the first aspect and will not be listed here again. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 A schematic diagram of a scenario applicable to the implementation of this application;
[0027] Figure 2 A schematic diagram of a table;
[0028] Figure 3 A schematic diagram of a data processing method provided in an embodiment of the present application;
[0029] Figure 4 A schematic diagram of target data provided in an embodiment of the present application;
[0030] Figure 5 A schematic diagram of a method for determining at least one index provided in an embodiment of the present application;
[0031] Figure 6 A schematic diagram of data included in a database provided in an embodiment of the present application;
[0032] Figure 7 A schematic diagram of a method for determining N groups of data provided in an embodiment of the present application;
[0033] Figure 8 A schematic diagram of a process of querying data in a combined table provided in an embodiment of the present application;
[0034] Fig. 9 A schematic diagram of the structure of a data processing device provided in an embodiment of the present application;
[0035] Fig.10 A schematic diagram of the structure of a computing device provided in an embodiment of the present application;
[0036] Fig.11 A schematic diagram of the structure of a computing device cluster provided in an embodiment of the present application. DETAILED DESCRIPTION
[0037] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.
[0038] Below, some terms involved in the embodiments of the present application are explained to facilitate understanding by those skilled in the art.
[0039] 1. Terminal equipment is a device with wireless transceiver function, which can be a fixed device, mobile device, handheld device, wearable device, vehicle-mounted device, or a wireless device built into the above device (for example, a communication module or chip system, etc.). The terminal equipment is used to connect people, objects, machines, etc., and can be widely used in various scenarios, such as but not limited to the following scenarios: cellular communication, device-to-device communication (D2D), vehicle to everything (V2X), machine-to-machine / machine-type communication (M2M / MTC), Internet of Things (IoT), virtual reality (VR), augmented reality (AR), industrial control, self-driving, remote medical, smart grid, smart furniture, smart office, smart wear, smart transportation, smart city, drone, robot and other scenarios. The terminal device may sometimes be referred to as user equipment (UE), terminal, access station, UE station, remote station, wireless communication device, or user device, etc.
[0040] 2. Computing device refers to a device with computing capabilities, such as a terminal device or a server. A server is generally a device that can be used to provide services to users. For example, a server can provide storage services and / or computing services to users.
[0041] In the embodiments of the present application, the number of nouns, unless otherwise specified, means "singular noun or plural noun", that is, "one or more". "At least one" means one or more, and "plural" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. For example, A / B means: A or B. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c means: a, b, c, a and b, a and c, b and c, or a and b and c, where a, b, c can be single or multiple.
[0042] Please refer to Figure 1 , is a schematic diagram of a scenario to which the present application embodiment is applicable. Figure 1 As shown, the scenario includes a source device, a first terminal device, a data processing device, and a data storage device. The data processing device and the data storage device can constitute a data storage system. The first terminal device can correspond to the first user, in other words, the first user can operate the first terminal device. The source device corresponds to the second user, in other words, the second user can operate the source device. The source device can be implemented by a computing device. The data storage device can be a data storage device with a centralized architecture or a data storage device with a distributed architecture, and the embodiments of the present application do not specifically limit this.
[0043] The data processing device can communicate with the first terminal device and the data storage device respectively. The communication is, for example, wired communication or wireless communication. The data processing device can also be called an engine, and the engine can include a structured query language (SQL) engine.
[0044] For example, the second user desires to write data (such as source data), and the source device may generate a write request according to the operation of the second user, and the write request is used to request to write the source data. The source device may send the write request to the data processing device. The data processing device may be used to process the write request, and the write request is used to request to write the source data. After receiving the write request, the data processing device may write the source data into the data processing device.
[0045] The first user desires to query the data to be queried. The first terminal device may generate a query request according to the operation of the first user, and the query request is used to request to query the data to be queried. The first terminal device may send the query request to the data processing device. The data processing device processes the query request. The query request is used to request to query the data to be queried. The data processing device queries data from the database in the data storage device according to the query request, and sends the query-obtained data to the first terminal device.
[0046] Optionally, the first terminal device may run an application, and the application generates a query request according to the operation of the first user, and sends the query request to the data processing device. The application is, for example, an application pre-installed in the first terminal device, a sub-application embedded in a third-party application set in the first terminal device, a small program or a webpage. After the data processing device obtains the data through query, the first terminal device may send the query data to the application.
[0047] exist Figure 1 In the example, the source device and the first terminal device are different devices. In fact, the source device and the first terminal device can be the same device, and this embodiment of the present application does not limit this.
[0048] In a possible implementation, the data processing device and the data storage device may be implemented by different devices, respectively. Exemplarily, the data processing device may be implemented by one or more computing devices, or may be implemented by a software module or a hardware module in one or more computing devices. The data processing device may be implemented by one or more storage devices, or may be implemented by a software module or a hardware module in one or more storage devices. A storage device refers to a device with storage capacity, including but not limited to a hard disk, a magnetic disk, or a solid state disk (SSD). The data processing device is implemented by a computing device cluster, and the data storage device is implemented by another computing device cluster. A computing device cluster, for example, includes one or more servers.
[0049] In another possible implementation, the data processing device and the data storage device may be implemented by the same computing device or computing device cluster. For example, the data processing device and the data storage device are both software modules in the same computing device.
[0050] Optionally, the scenario may further include a second terminal device. The second terminal device corresponds to the administrator, in other words, the administrator can operate the second terminal device. Exemplarily, the administrator can access the data processing device through the second terminal device to update the information in the data processing device.
[0051] Next Figure 1 The scenario shown in the figure is taken as an example, and the database in the data storage device includes Figure 2 Taking the table shown in the figure as an example, and the table is labeled as t1, the current process of querying data is introduced by example.
[0052] like Figure 2 As shown, the form includes multiple fields (such as Figure 2 The row index (rowkey), building code (building_code), house code (house_code), floor code (floor_code), name (name), age (age), job (job) and sex (sex) in the data, and data corresponding to each of the multiple fields. A data corresponding to each of the multiple fields can be regarded as a value of each of the fields.
[0053] The following query request is: select * from t1 where building_code = '123' and house_code = 11, and the data processing device is from Figure 2 The query data in the table shown is used as an example.
[0054] After receiving the query request from the first terminal device, the data processing device may traverse the Figure 2 Specifically, the data processing device may first traverse the second row of the table to see if the building_code is 123 and the house_code is 11; traverse the third row to see if the building_code is 123 and the house_code is 11; traverse the fourth row to see if the building_code is 123 and the house_code is 12. This process is repeated until the data processing device traverses each row of the table. Figure 2 The data that meets the query request is filtered out, and the query result is obtained. The query result is Figure 2 The two rows of data indicated by the dotted box (one row of data indicates that the row index is 123-11-1, the building code is 123, the house code is 11, and the floor code is 1; the other row of data indicates that the row index is 123-11-2, the building code is 123, the house code is 11, and the floor code is 2). After the data processing device obtains the query result, it can send the query result to the first terminal device. It can be seen that in the current method of querying data, the data processing device needs to traverse all the data in the data storage device, which makes the query efficiency of the data processing device low. Furthermore, if there is more data stored in the data processing device, the efficiency of querying data will be further reduced.
[0055] In view of this, an embodiment of the present application provides a data processing method. In this method, after receiving a query request, at least one index corresponding to the query request can be determined, which is equivalent to determining the data range corresponding to this query. Since the indexes in the database are arranged in order, the data associated with the at least one index can be quickly queried from the database. In this way, it is not necessary to traverse all the data in the data storage device, and the scope of the query data is narrowed without affecting the accuracy of the query result, which is conducive to improving the efficiency of data query.
[0056] The following describes the method provided by the embodiments of the present application in conjunction with the accompanying drawings. In the accompanying drawings corresponding to the various embodiments of the present application, all steps indicated by dotted lines are optional steps. The data processing device involved in the various embodiments of the present application is, for example, Figure 1 The data processing device and the data storage device involved are, for example, Figure 1 The data storage device involved, the source device is for example Figure 1 The source device involved, the first terminal device is for example Figure 1 The first terminal device and the second terminal device involved are, for example, Figure 1 The second terminal device involved.
[0057] Please refer to Figure 3 , is a flow chart of a data processing method provided in an embodiment of the present application. The method comprises the following steps.
[0058] S301: A first terminal device sends a query request to a data processing apparatus. Correspondingly, the data processing apparatus receives the query request from the first terminal device.
[0059] The query request is used to indicate at least one field to which the data to be queried belongs. In other words, the query request is used to request to query the data corresponding to the at least one field, or it can be understood that the query request is used to request to query the data corresponding to the at least one field. Optionally, the query request may include a query statement, and the query statement is used to indicate the at least one field. The language used by the query statement is SQL. In this case, the query statement may also be referred to as an SQL statement.
[0060] For example, the query request includes a query statement, and the query statement is: building_code and house_code. The query request is equivalent to indicating the two fields of building_code and house_code. It can be further understood that the query request is used to query the data corresponding to the two fields.
[0061] Optionally, the query request may further indicate a value range of data corresponding to each field in some or all of the at least one field. In the case where the query request includes a query statement, the query statement may indicate the at least one field, and may further indicate a value range of data corresponding to each field in some or all of the at least one field.
[0062] For example, the query request includes a query statement, which is: building_code=123and house_code=11. The query statement is equivalent to indicating the two fields of building_code and house_code, and also indicating the value ranges of the data corresponding to the two fields. The value range of the data corresponding to the building_code field is equal to 123, and the value range of the data corresponding to the house_code field is equal to 11.
[0063] The query request may be a primary query request or a multi-level query request, which are described below.
[0064] A1. The query request is a first-level query request.
[0065] The first-level query request indicates at least one field. Optionally, the first-level query request may also indicate a value range of data corresponding to each field in some or all of the at least one field.
[0066] A2. The query request is a multi-level query request.
[0067] The multi-level query request is equivalent to jointly (or jointly) indicating at least one field. For example, each query request at each level in the multi-level query request indicates a partial field in at least one field. Optionally, each query request at each level in the multi-level query request may also indicate a value range of data corresponding to each field in a partial field in at least one field.
[0068] Optionally, each level of the multi-level query request may include a query statement. In this case, the query statement in each level of the multi-level query request may indicate a portion of at least one field, and may also indicate a value range of data corresponding to each field in the portion of the at least one field.
[0069] S302: The data processing device determines at least one index corresponding to the query request according to the metadata information.
[0070] The metadata information indicates the relationship between the index and the data corresponding to the multiple fields. In other words, the index is related to the data corresponding to the multiple fields. The information about the relationship between the index and the data corresponding to the multiple fields can also be called index information. The metadata information can be further understood as indicating the rules for generating indexes for the data corresponding to the multiple fields. In other words, if the data processing device determines a group of data corresponding to the multiple fields, then the index corresponding to the group of data can be determined based on the group of data and the metadata information. The index can be understood as indicating at least one group of data corresponding to the multiple fields. For example, the metadata information can indicate that the index is obtained by connecting the data corresponding to the multiple fields in sequence through separators. Alternatively, the metadata information can indicate that the index is obtained by arranging the data corresponding to the multiple fields in sequence.
[0071] Since the index in the embodiment of the present application is related to the data corresponding to multiple fields, the index in the embodiment of the present application can also be called a combined index. According to the different forms of at least one set of data indicated by the index, the index can be divided into a row index or a column index. A row index means that each set of data in at least one set of data indicated by the index is in the form of a row. A column index means that each set of data in at least one set of data indicated by the index is in the form of a column.
[0072] The index may be a primary index or a multi-level index. If the index is a multi-level index, the metadata information may indicate information of the multi-level index. The information of each level index in the information of the multi-level index is used to indicate the relationship between the data corresponding to each level index and some fields of the multiple fields. Optionally, in the case where the query request includes a multi-level query request, each level query request in the multi-level query request may correspond to the information of the primary index in the multi-level index.
[0073] For example, a multi-level index includes a first-level index and a second-level index, and the first-level index indicates that data corresponding to multiple fields are sequentially connected by separators. Alternatively, the metadata information may indicate that the index is obtained by sequentially arranging data corresponding to multiple fields.
[0074] In addition to indicating the relationship between the index and the data corresponding to the multiple fields, the metadata information may also indicate one or more of the identification of the data source, the level of the index, the type of the data source, the amount of data in the table, and the identification of the table.
[0075] The identifier of the data source is used to indicate the source of the data, such as the address of the source device that can write the data. The data volume of the table refers to the amount of data included in the table. The type of the data source is used to indicate the type of the source device. The identifier of the table indicates the identifier of the table that contains the data.
[0076] For example, please refer to Table 1 below, which is an example of metadata information provided in an embodiment of the present application.
[0077] Table 1
[0078]
[0079] As shown in Table 1 above, the metadata information indicates that the identifier of the data source is 12, the type of the data source is A, the identifier of the table is 2341, the first-level index information indicates that the first-level index is formed by connecting the data corresponding to the three fields of building_code, house_code and floor_code with a separator, and the second-level index information indicates that the second-level index is formed by connecting the data corresponding to the four fields of name, age, job and sex with a separator.
[0080] Before the data processing device executes S302, the data processing device may obtain and pre-store metadata information. The following describes the method in which the data processing device obtains metadata information.
[0081] Method 1: The data processing device obtains metadata information according to the input of the administrator.
[0082] Exemplarily, for example, the source device sends a write request to the data processing device, and the write request is used to request the writing of multiple indexes, and at least one set of data corresponding to multiple fields associated with each of the multiple indexes. In order to simplify the description, the embodiment of the present application refers to these multiple indexes, and at least one set of data corresponding to multiple fields associated with each of the multiple indexes as target data. Alternatively, the data processing device has written the target data into the database. In either case, the administrator can access the target data through the second terminal device. In this way, the administrator can determine the relationship between the index and the data corresponding to the multiple fields based on the target data to obtain metadata information. The administrator can enter the metadata information in the second terminal device, and the second terminal device sends the metadata information to the data processing device. In this way, it is equivalent to that the data processing device obtains the metadata information. In the embodiment of the present application, the data processing device obtains the metadata information of the target data as an example for introduction.
[0083] In a possible implementation, the data processing device may include at least one interface, each of which supports a communication protocol. When receiving a write request from a source device, the data processing device may determine a target interface that matches the communication protocol of the source device, and receive the write request from the source device through the target interface, which is equivalent to receiving the target data. At least one interface may be used to support at least one of the Java Database Connectivity (JDBC) protocol, the Hypertext Transfer Protocol (HTTP) and the Hypertext Transfer Protocol Secure (HTTPS). In this implementation, the data processing device may select a corresponding interface according to the actual situation of the source device, so that the data processing device can communicate smoothly with different devices.
[0084] Method 2: The data processing device may extract the relationship between multiple indexes and at least one set of data corresponding to multiple fields associated with each of the multiple indexes to obtain metadata information.
[0085] Exemplarily, the data processing device may analyze the relationship between the multiple indexes and at least one set of data corresponding to the multiple fields associated with each of the multiple indexes according to the target data, thereby obtaining metadata information. For example, the data processing device may include a trained model, and the data processing device may input the target data into the model, and output information about the relationship between the multiple indexes and at least one set of data corresponding to the multiple fields associated with each of the multiple indexes through the model.
[0086] The data processing device may receive the target data from the source device, or may read the target data from a database in the data storage device. The manner in which the data processing device reads the target data from the data storage device may refer to the content of the data processing device obtaining the write request from the source device, which will not be described in detail here.
[0087] Optionally, the data processing device may also write the target data into a database.
[0088] The order in which the data processing device in the embodiment of the present application obtains metadata information and writes the target data into the database can be arbitrary, and the embodiment of the present application does not limit this. For example, the data processing device may write the target data into the database after obtaining the metadata information; or the data processing device may simultaneously obtain the metadata information and write the target data into the database; or the data processing device may write the target data into the database and then obtain the metadata information of the target data.
[0089] Please refer to Figure 4 , is a schematic diagram of target data provided in an embodiment of the present application. Figure 4 The target data is shown in the form of a table. Figure 4 As shown, the target data includes multiple fields and data corresponding to the multiple fields. Figure 4 The row key, building code, house code, and floor code in the table are: Figure 4 The first to sixth sets of data are shown.
[0090] The first group of data indicates that the row index is 123-11-1, the building code is 123, the house code is 11, and the floor code is 1; the second group of data indicates that the row index is 123-11-2, the building code is 123, the house code is 11, and the floor code is 2; the third group of data indicates that the row index is 123-12-1, the building code is 123, the house code is 12, and the floor code is 1; the fourth group of data indicates that the row index is 123-12-2, the building code is 123, the house code is 12, and the floor code is 2; the fifth group of data indicates that the row index is 124-11-1, the building code is 124, the house code is 11, and the floor code is 1; the sixth group of data indicates that the row index is 125-12-1, the building code is 125, the house code is 12, and the floor code is 1.
[0091] For example, the data processing device acquires data that can be analyzed such as Figure 4 The multiple fields and the first set of data in the table shown in FIG. 1 are used to determine that the row index in the first set of data is actually formed by the data corresponding to the three fields building_code, house_code and floor_code being connected in sequence using a separator. Accordingly, the data processing device can obtain metadata information indicating that the row index is formed by the data corresponding to the three fields building_code, house_code and floor_code being connected in sequence using a separator.
[0092] The content of the query request is different, so the way in which the data processing device determines at least one index corresponding to the query request is also different, which are explained below respectively.
[0093] Case 1: the query request is a first-level query request, and the query request indicates at least one field.
[0094] The data processing device may determine the index corresponding to the at least one field according to the metadata information and the at least one field, that is, obtain at least one index, which is also the index corresponding to the query request.
[0095] Case 2: the query request is a first-level query request, and the query request indicates at least one field and a value range of data corresponding to each field in the at least one field.
[0096] The data processing device may determine the value range of the index corresponding to each field in the at least one field according to the metadata information and the value range of the data corresponding to each field in the at least one field. The data processing device may use the intersection of the value ranges of the index corresponding to each field in the at least one field as the at least one index.
[0097] For example, a database including Figure 4 The data shown is obtained by sequentially connecting the data corresponding to multiple fields with an index, taking at least one field including building_code and house_code as an example. The query request indicates building_code=123and house_code=11, and the at least one field indicated by the query request includes building_code and house_code. The data processing device can determine the value range of the index corresponding to each field in the at least one field. Specifically, the value range of the index corresponding to building_code=123 should be the index that begins with 123, and the value range of the index corresponding to house_code=11 should include indexes from 11 to 12 (excluding 12). Therefore, it can be determined that at least one index should be an index that includes 123 and 11, that is, the at least one index is Figure 4 123-11-1 and 123-11-2 shown in.
[0098] Case 3: the query request is a multi-level query request, and the query request indicates at least one field.
[0099] The data processing device may determine the index corresponding to each level of query request according to the metadata information and a part of the at least one field indicated by each level of query request in the multi-level query request. The data processing device may determine the intersection of the indexes corresponding to each level of query request in the multi-level query request as at least one index. The data processing device may determine the multi-level query request from the query request respectively according to the metadata information.
[0100] Case 4: the query request is a multi-level query request, and the query request indicates at least one field and a value range of each field in the at least one field.
[0101] The data processing device may determine the value range of the first-level index corresponding to each level of the query request according to the value range corresponding to a part of the fields in at least one field indicated by each level of the query request in the multi-level query request, and may cumulatively obtain the value range of the multi-level index. The data processing device may determine the intersection of the value ranges of the multi-level index as at least one index.
[0102] Of course, if the query request directly includes an index, the data processing device can directly use the index to query the data corresponding to the index.
[0103] Please refer to Figure 5 , which is a schematic diagram of a method for determining at least one index provided in an embodiment of the present application.
[0104] S501: The data processing device determines the n-th level index.
[0105] The n-th level index is one of the multi-level indexes, n is a positive integer, and the maximum value of n is the number of the multi-level indexes. Exemplarily, the data processing device determines the n-th level index according to the metadata information.
[0106] S502: The data processing device determines the i-th field in the n-th level index.
[0107] The i-th field is one of the partial fields of the multiple fields related to the n-th level index. i is a positive integer.
[0108] S503: The data processing device determines whether there is a value range of data corresponding to the ith field in the jth-level query request corresponding to the nth-level index.
[0109] If the value range of the data corresponding to the i-th field exists in the j-th query request corresponding to the n-th index, the data processing device executes S504, that is, according to the value range of the data corresponding to the i-th field, the value range of the index corresponding to the i-th field is determined. If the value range of the data corresponding to the i-th field does not exist in the j-th query request corresponding to the n-th index, the data processing device can execute S505, that is, determine whether all fields corresponding to the n-th index have been traversed.
[0110] If the data processing device determines that all fields corresponding to the n-th level index have not been traversed, the value of i can be increased (in Figure 5 If the data processing device determines that all fields corresponding to the n-th level index have been traversed, then S506 may be executed, that is, determining whether the multi-level index has been traversed.
[0111] If it is determined that the multi-level index has not been traversed, the value of n will be increased (in Figure 5If it is determined that the multi-level index is completely traversed, the data processing device may execute S507, that is, determine at least one index according to the value range corresponding to each level index in the multi-level index.
[0112] For example, see Figure 6 , is a schematic diagram of data included in a database provided in an embodiment of the present application. Figure 6 As shown, in Figure 6 The table is exemplified in the form of data included in the database. Figure 6 As shown, the database includes multiple fields and data corresponding to the multiple fields. Figure 6 The row key 1 (rowkey1), building code (building_code), house code (house_code) and floor code (floor_code), name (name), category (class), row key 2 (rowkey2), business 1 (business1), business 2 (business2) and business 3 (business3) in the table. Row key 1 can be regarded as the first-level index, and row key 2 can be regarded as the second-level index. The data corresponding to multiple fields include: Figure 6 The first to sixth sets of data are shown.
[0113] The first group of data indicates that row index 1 is 123-11-1, building code is 123, house code is 11, floor code is 1, row index 2 is 60-135-120, business 1 is 60, business 2 is 135, and business 3 is 120; the second group of data indicates that row index 1 is 123-11-2, building code is 123, house code is 11, floor code is 2, row index 2 is 75-123-134, business 1 is 75, business 2 is 123, and business 3 is 134; the third group of data indicates that row index 1 is 123-12-1, building code is 123, house code is 12, floor code is 1, row index 2 is 80-132-137, business 1 is 80, business 2 is 132, and business 3 is 137; the fourth group of data indicates that row index 1 is 123-12-1, building code is 123, house code is 12, floor code is 1, row index 2 is 80-132-137, business 1 is 80, business 2 is 132, and business 3 is 137. It indicates that row index 1 is 123-12-2, building code is 123, house code is 12, floor code is 2, row index 2 is 90-156-134, business 1 is 90, business 2 is 156, and business 3 is 134; the fifth group of data indicates that row index 1 is 124-11-1, building code is 124, house code is 11, and floor code is 1, row index 2 is 100-158-123, business 1 is 100, business 2 is 158, and business 3 is 123; the sixth group of data indicates that row index 1 is 125-12-1, building code is 125, house code is 12, floor code is 1, row index 2 is 110-132-124, business 1 is 110, business 2 is 132, and business 3 is 124.
[0114] The data included in the database is Figure 6 The data shown, the index is obtained by sequentially connecting the data corresponding to multiple fields, taking the query request including multi-level query, and taking the multi-level query request indicating class<3and businmess1<80 as an example. Among them, the first-level query request can be class<3, and the second-level query request can be businmess1<80.
[0115] The data processing device can determine the value range of the index corresponding to the first-level query request. Specifically, the value range of the index corresponding to class<3 is the index corresponding to the row index 1 with a value less than 5 corresponding to class, and the value range of the index corresponding to businmess1<80 is the index corresponding to businmess1 in the row index 2 with a value less than 80. The data processing device can determine at least one index as the index corresponding to class in the row index 1 with a value less than 5, and the index corresponding to businmess1 in the row index 2 with a value less than 80, specifically including the following: Figure 6 123-11-1 and 60-135-120 in row index 1, and 60-135-120 and 75-123-134 in row index 2.
[0116] S303: The data processing device searches for N groups of data corresponding to at least one index, where N is a positive integer.
[0117] After the data processing device determines at least one index, N sets of data corresponding to the at least one index can be queried from the database. When the number of tables included in the database is different, the data processing device determines N sets of data in different ways, which are described below.
[0118] 1. The number of tables included in the database is 1.
[0119] The data processing device can directly determine a group of data corresponding to each index in the at least one index from the table, and obtain N groups of data in total.
[0120] 2. The number of tables included in the database is greater than 1.
[0121] In a possible implementation, the data processing device may determine a group of data corresponding to each index in the at least one index from a plurality of tables included in the database, and obtain N groups of data in total.
[0122] In another possible implementation, the data processing device may determine a table with the smallest amount of data from multiple tables (the first table is used as an example in the embodiment of the present application), determine a group of data corresponding to each index in the at least one index, and obtain a total of K groups of data, where K is a positive integer. Based on the K groups of data, the data processing device queries L groups of data that are the same as each group of data in the K groups of data from other tables (tables in the multiple tables except the first table), thereby obtaining N groups of data, that is, the N groups of data include K groups of data and L groups of data. L is a non-negative integer. Tables in the multiple tables except the first table, for example, include the second table.
[0123] In this embodiment, the data processing device can query data from a table with a larger amount of data based on the query results of the table with a smaller amount of data, which is equivalent to querying multiple tables together. In this way, the data processing device can query data in a table with a larger amount of data with the help of the query results from the table with a smaller amount of data, thereby improving the efficiency of querying data.
[0124] Optionally, the data processing device may include multiple threads, each of which is used to query data from one of the multiple tables, or it can be described that each of the multiple threads corresponds to one of the multiple tables. In this way, the data processing device can query data through multiple threads to improve the efficiency of querying data.
[0125] Before the data processing device queries L groups of data identical to the K groups of data from tables other than the first table among the multiple tables, the thread corresponding to the first table (such as the first thread) can send the K groups of data to other threads, so that the other threads can query the data identical to the K groups of data from other tables.
[0126] The following is an example of a plurality of tables including a first table and a second table, a data processing device including a first thread and a second thread, the first thread being used to query data from the first table, and the second thread being used to query data from the second table, and the amount of data in the first table being less than the amount of data in the second table, to introduce a process of the data processing device determining N groups of data from the first table and the second table. Figure 7 , which is a schematic diagram of a method for determining N groups of data provided in an embodiment of the present application.
[0127] S701: A first thread determines, from a first table, K groups of data corresponding to at least one index.
[0128] S702: The first thread sends K groups of data to the second thread. Correspondingly, the second thread receives the K groups of data from the first thread.
[0129] S703: The second thread determines from the second table a group of data that is identical to each group of data in the K groups of data, to obtain L groups of data.
[0130] In this way, the data processing device can obtain K groups of data from the first thread and L groups of data from the second thread, thus obtaining N groups of data.
[0131] For example, taking the first table as Figure 4 The table shown, with the second table as Figure 6 The table shown, and at least one index includes 123-11-1 and 123-11-2. Please refer to Figure 8 , which is a schematic diagram of a process of querying data by combining tables provided in an embodiment of the present application. The data processing device may determine that the amount of data in the first table is smaller, so the data processing device may query the first table through the first thread for K groups of data that meet at least one index, including the first group of data and the second group of data in the first table. The first thread may send the K groups of data to the second thread. The data processing device may query the second table through the second thread for L groups of data that are the same as the K groups of data, and the L groups of data include the first group of data and the second group of data in the second table.
[0132] Assume that the first table includes 10,000 rows of data and the second table includes 100 million rows of data. According to the solution of the embodiment of the present application, after obtaining the first set of data and the second set of data in the first table, the data processing device can directly scan the first set of data and the second set of data in the second table, which is equivalent to the data processing device only scanning two rows of data. In this way, the data that the data processing device needs to scan can be reduced, thereby improving the efficiency of the data processing device in querying data from the second table, and thus improving the overall efficiency of querying data.
[0133] S304: The data processing device sends the query result to the first terminal device. Correspondingly, the first terminal device receives the query request from the data processing device.
[0134] After the data processing device obtains N groups of data, it may send a query request to the first terminal device, where the query request is used to indicate the N groups of data.
[0135] In an embodiment of the present application, the data processing device can determine at least one index corresponding to the query request according to the query request, which is equivalent to the data processing device being able to perceive the relationship between the query request and the index. In this way, the data processing device can subsequently directly query the data according to the at least one index, without having to traverse all the data in the database to determine the data that meets the query request, which reduces the search range of the data processing device querying the data, and is conducive to improving the efficiency of the data processing device querying the data, which also improves the efficiency of the data processing device querying the data, and is conducive to faster feedback of the queried data to the user, thereby improving the user experience. In addition, in an embodiment of the present application, the data processing device can also query the data by combining multiple tables in the database, rather than performing an independent query process on each table, which is also conducive to improving the efficiency of querying the data. The method in the embodiment of the present application can be applied to the scenario of massive data querying data. In this scenario, the method applied to the embodiment of the present application can greatly narrow the scope of the search data, reduce the processing amount of the data processing device, and greatly improve the efficiency of data query.
[0136] The present application embodiment provides a data processing device. The data processing device can be used to implement the functions of any of the data processing devices described above, and accordingly, can also execute the steps performed by the data processing device described above. Fig. 9 , which is a structural diagram of a data processing device provided in an embodiment of the present application.
[0137] like Fig. 9 As shown, the data processing device 900 includes a query request parsing module 901 and a data query module 902. Optionally, the data processing device 900 also includes a metadata storage module 903.
[0138] Among them, the query request parsing module 901, the data query module 902 and the metadata storage module 903 can all be implemented by software, or can be implemented by hardware. Exemplarily, the query request parsing module 901 is taken as an example to introduce the implementation of the query request parsing module 901. Similarly, the implementation of the data query module 902 and the metadata storage module 903 can refer to the implementation of the query request parsing module 901.
[0139] As an example of a software functional unit, the query request parsing module 901 may include code running on a computing instance. Among them, the computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Further, the above-mentioned computing instance may be one or more. For example, the query request parsing module 901 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region (region) or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including a data center or multiple data centers with close geographical locations. Among them, usually a region may include multiple AZs.
[0140] Similarly, multiple hosts / virtual machines / containers used to run the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Usually, a VPC is set up in a region. For cross-region communication between two VPCs in the same region and between VPCs in different regions, a communication gateway needs to be set up in each VPC to achieve interconnection between VPCs through the communication gateway.
[0141] As an example of a hardware functional unit, the query request parsing module 901 may include at least one computing device, such as a server, etc. Alternatively, the query request parsing module 901 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0142] The multiple computing devices included in the query request parsing module 901 can be distributed in the same region or in different regions. The multiple computing devices included in the query request parsing module 901 can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the query request parsing module 901 can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.
[0143] Exemplarily, the query request parsing module 901 may be used to execute steps S301, S302, and S304, and the data query module 902 may be used to execute step S303.
[0144] Optionally, the metadata storage module 903 is used to obtain and store metadata information. The specific content of each step and the content of the metadata information can be referred to above and will not be listed here.
[0145] This application embodiment provides a computing device. Fig.10 , is a schematic diagram of a computing device 1000 provided in an embodiment of the present application. Fig.10 As shown, the computing device 1000 includes a processor 1001 and a memory 1002. The processor 1001 and the memory 1002 may be coupled or integrated, or the processor 1001 and the memory 1002 may be relatively independently configured. Optionally, the computing device 1000 also includes a communication interface 1003. The communication interface 1003 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 1000 and other devices or a communication network.
[0146] The processor 1001, the memory 1002 and the communication interface 1003 can communicate with each other via the bus 1004. The computing device 1000 can be a server or a terminal device. It should be understood that the embodiment of the present application does not limit the number of processors 1001 and memories 1002 in the computing device 1000.
[0147] The bus 1004 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.10 The bus 1004 may include a path for transmitting information between various components of the computing device 1000 (eg, the processor 1001, the memory 1002, and the communication interface 1003).
[0148] The processor 1001 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0149] The memory 1002 may include a volatile memory, such as a random access memory (RAM). The memory 1002 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).
[0150] The memory 1002 stores executable program codes, and the processor 1001 executes the executable program codes to respectively implement the aforementioned Fig. 9 The functions of the query request parsing module 901, the data query module 902 and the metadata storage module 903 in the memory 1002 are implemented to realize any of the data processing methods described above. That is, the memory 1002 stores instructions for executing any of the data processing methods. The functions of the query request parsing module 901, the data query module 902 and the metadata storage module 903 can be referred to in the above Fig. 9 The content of the discussion.
[0151] Alternatively, the memory 1002 stores executable codes, and the processor 1001 executes the executable codes to respectively implement the functions of the aforementioned computing devices, thereby implementing any of the aforementioned data processing methods. That is, the memory 1002 stores instructions for executing any of the aforementioned data processing methods.
[0152] The embodiment of the present application also provides a computing device cluster. The computing device cluster includes at least one computing device. Each computing device in the at least one computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop, a laptop, or a smart phone.
[0153] Please refer to Fig.11 , is a schematic diagram of the structure of a computing device cluster provided in an embodiment of the present application. Fig.11 As shown, the computing device cluster includes at least one computing device 1100. Each computing device 1100 in the computing device cluster may include a processor 1101 and a memory 1102. Optionally, each computing device 1100 in the computing device cluster further includes a communication interface 1103. The processor 1101, the memory 1102, and the communication interface 1103 may be connected via a bus 1104. The implementation of the processor 1101 may refer to the above Fig.10 The contents of the processor 1001 in the embodiment of the present invention and the implementation of the memory 1102 can be referred to in the previous text. Fig.10 The contents of the memory 1002 in the communication interface 1103 can be referred to in the previous text. Fig.10 The contents of the communication interface 1003 and the implementation of the bus 1104 can also be referred to in the previous text. Fig.10 The contents of bus 1004.
[0154] In a possible implementation, the memory 1102 in each computing device 1100 in the computing device cluster may store the same instructions for executing any of the above data processing methods.
[0155] In another possible implementation, the memory 1102 of at least one computing device 1100 in the computing device cluster may also store partial instructions for executing any of the above data processing methods. In other words, the combination of at least one computing device 1100 may jointly execute instructions for executing any of the above data processing methods.
[0156] Optionally, the memory 1102 in different computing devices 1100 in the computing device cluster may store different instructions, respectively used to execute Fig. 9 That is, the instructions stored in the memory 1102 in different computing devices 1100 can implement Fig. 9 The functions of one or more of the query request parsing module 901, the data query module 902 and the metadata storage module 903 in the embodiment of the present invention can be referred to in the previous text. Fig. 9 The content of the discussion.
[0157] In some possible implementations, at least one computing device 1100 in the computing device cluster may be connected via a network. The network may be a wide area network or a local area network, etc. Specifically, the network is connected via a communication interface 1103 in each computing device 1100. In this type of possible implementation, at least one computing device 1100 in the computing device cluster may jointly execute any of the data processing methods described above.
[0158] The embodiment of the present application provides a chip system, which includes: a processor and an interface. The processor is used to call and run instructions from the interface, and when the processor executes the instructions, any of the above-mentioned data processing methods is implemented.
[0159] The embodiment of the present application provides a computer-readable storage medium, which is used to store computer programs or instructions, and when it is executed, implements any of the above-mentioned data processing methods. Among them, the computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid-state hard disk), etc.
[0160] The present application embodiment provides a computer program product including instructions, which, when executed on a computer, implements any of the above-mentioned data processing methods. The computer program product may be a software or program product including instructions that can be executed on a computing device or stored in any available medium.
[0161] The method steps in the embodiments of the present application can be implemented by hardware, or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, and the software modules can be stored in a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an erasable programmable read-only memory, an electrically erasable programmable read-only memory, a register, a hard disk, a mobile hard disk, a CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC. In addition, the ASIC can be located in a base station or a terminal. Of course, the processor and the storage medium can also be present in a base station or a terminal as discrete components.
[0162] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instruction is loaded and executed on a computer, the process or function described in the embodiment of the present application is executed in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user device or other programmable device. The computer program or instruction may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer program or instruction may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired or wireless means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server, data center, etc. that integrates one or more available media. The available medium may be a magnetic medium, for example, a floppy disk, a hard disk, a tape; it may also be an optical medium, for example, a digital video disc; it may also be a semiconductor medium, for example, a solid-state hard disk. The computer-readable storage medium may be a volatile or nonvolatile storage medium, or may include both volatile and nonvolatile types of storage media.
[0163] In the various embodiments of the present application, unless otherwise specified or provided for in any logical conflict, the terms and / or descriptions between the different embodiments are consistent and may be referenced to each other, and the technical features in the different embodiments may be combined to form new embodiments according to their inherent logical relationships.
[0164] It is understood that the various numbers involved in the embodiments of the present application are only for the convenience of description and are not used to limit the scope of the embodiments of the present application. The size of the sequence number of the above-mentioned processes does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic.
Claims
1. A data processing method, characterized in that: Applied to a data processing device, the method comprises: receiving a query request, wherein the query request indicates at least one field to which the data to be queried belongs; Determining, according to metadata information, at least one index corresponding to the query request, the metadata information indicating a relationship between the index and data corresponding to a plurality of fields, the plurality of fields including the at least one field; Querying N groups of data associated with the at least one index from a database, wherein the database includes multiple indexes and at least one group of data corresponding to the multiple fields associated with each of the multiple indexes, wherein the multiple indexes are arranged in order in the database, and N is a positive integer; A query result is sent, where the query result indicates the N groups of data.
2. The method according to claim 1, characterized in that The database includes a first table and a second table, the first table and the second table are used to store the multiple indexes and at least one set of data corresponding to the multiple fields associated with each index in the multiple indexes, and the amount of data in the first table is smaller than the amount of data in the second table; Querying N sets of data associated with the at least one index from a database, including: Querying a set of data associated with each index in the at least one index from the first table, obtaining K sets of data in total, where K is a positive integer; From the second table, a group of data identical to each group of data in the K groups of data is searched to obtain L groups of data in total, where L is a non-negative integer, and the N groups of data include the K groups of data and the L groups of data.
3. The method according to claim 2, characterized in that The data processing device includes a first thread and a second thread, the first thread being used to query a set of data associated with each index of the at least one index from the first table; Querying a group of data that is the same as each group of data in the K groups of data from the second table, including: Sending the K groups of data to the second thread through the first thread; A group of data identical to each group of data in the K groups of data is queried from the second table through the second thread.
4. The method according to any one of claims 1 to 3, characterized in that: Before determining at least one index corresponding to the query request according to the metadata information, the method further includes: receiving the multiple indexes and at least one set of data corresponding to the multiple fields associated with each of the multiple indexes; The relationship between the multiple indexes and at least one set of data corresponding to the multiple fields is extracted to obtain the metadata information, and the metadata information is stored.
5. The method according to any one of claims 1 to 4, characterized in that: The query request includes a multi-level query request, each level of the query request in the multi-level query request indicates a part of the at least one field; the metadata information indicates a relationship between each level of index in the multi-level index and data corresponding to the part of the multiple fields, each level of the query request in the multi-level query request corresponds to a level one index in the multi-level index; Determining at least one index corresponding to the query request according to the metadata information includes: According to the relationship between each level of index in the multi-level index and some of the multiple fields, the value range of the first-level index corresponding to each level of query request in the multi-level query request is determined, and the value range of the multi-level index is obtained in total, wherein the at least one index is the intersection of the value ranges of the multi-level index.
6. The method according to claim 5, characterized in that The query request at each level further indicates a value range of data corresponding to some fields in the at least one field; Determining a value range of a primary index corresponding to each level of query request in the multi-level query request includes: The value range of the primary index corresponding to the each-level query request is determined according to the value range of the data corresponding to each field in some fields of the at least one field indicated by the each-level query request.
7. A data processing device, characterized in that: include: a query request parsing module, configured to receive a query request, the query request indicating at least one field to which the data to be queried belongs, and determine at least one index corresponding to the query request according to metadata information, the metadata information indicating a relationship between the index and data corresponding to a plurality of fields, the plurality of fields including the at least one field; A data query module, configured to query N groups of data associated with the at least one index from a database, wherein the database includes a plurality of indexes and at least one group of data corresponding to the plurality of fields associated with each of the plurality of indexes, wherein the plurality of indexes are arranged in order in the database, and N is a positive integer; The query request parsing module is further used to send a query result, where the query result indicates the N groups of data.
8. The device according to claim 7, characterized in that The database includes a first table and a second table, the first table and the second table are used to store the multiple indexes and at least one set of data corresponding to the multiple fields associated with each index in the multiple indexes, and the amount of data in the first table is less than the amount of data in the second table; the data query module is specifically used to: Querying a set of data associated with each index in the at least one index from the first table, obtaining K sets of data in total, where K is a positive integer; From the second table, a group of data identical to each group of data in the K groups of data is searched to obtain L groups of data in total, where L is a non-negative integer, and the N groups of data include the K groups of data and the L groups of data.
9. The device according to claim 8, characterized in that The data query module is specifically used for: By means of the first thread, querying a set of data associated with each index of the at least one index from the first table to obtain the K sets of data, and sending the K sets of data to the second thread; A group of data identical to each group of data in the K groups of data is queried from the second table through the second thread.
10. The device according to any one of claims 7 to 9, characterized in that: The device further comprises a metadata storage module, wherein the metadata storage module is used for: receiving the multiple indexes and at least one set of data corresponding to the multiple fields associated with each of the multiple indexes; The relationship between the multiple indexes and at least one set of data corresponding to the multiple fields is extracted to obtain the metadata information, and the metadata information is stored.
11. The device according to any one of claims 7 to 10, characterized in that: The query request includes a multi-level query request, each level of the query request in the multi-level query request indicates a part of the at least one field; the metadata information indicates a relationship between each level of index in the multi-level index and data corresponding to the part of the multiple fields, each level of the query request in the multi-level query request corresponds to a level one index in the multi-level index; the query request parsing module is specifically used to: According to the relationship between each level of index in the multi-level index and some of the multiple fields, the value range of the first-level index corresponding to each level of query request in the multi-level query request is determined, and the value range of the multi-level index is obtained in total, wherein the at least one index is the intersection of the value ranges of the multi-level index.
12. The device according to claim 11, characterized in that The query request at each level further indicates a value range of data corresponding to some fields in the at least one field; the query request parsing module is specifically used to: The value range of the primary index corresponding to the each-level query request is determined according to the value range of the data corresponding to each field in some fields of the at least one field indicated by the each-level query request.
13. A computing device, characterized in that: include: Processor and memory; The memory is used to store one or more computer programs, and the one or more computer programs include computer execution instructions. When the computing device is running, the processor executes the one or more computer programs stored in the memory, so that the computing device performs the method according to any one of claims 1 to 6.
14. A computing device, characterized in that include: Processor and memory; The memory is used to store one or more computer programs, wherein the one or more computer programs include computer instructions. When the processor executes the computer instructions, the method according to any one of claims 1 to 6 is executed.
15. A computing device cluster, characterized in that: comprising at least one computing device, each computing device comprising a processor and a memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method according to any one of claims 1 to 6.
16. A computer-readable storage medium, characterized in that: The storage medium stores a computer program or instruction. When the computer program or instruction is executed by the communication device, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Distributed database processing method and device
CN105512200A
Database query method and related device
CN114764406A
Data processing method and device, electronic equipment and storage medium
CN115422205A
Cited By
Data processing method and apparatus
EP4668127A1
Data processing method and apparatus
WO2024183365A1
