A multi-dimensional data query method and device

By generating and sorting query tables and pointer jump mechanisms, the time-consuming problem in multidimensional data queries is solved, and efficient data access and query are achieved.

CN112783888BActive Publication Date: 2025-08-01HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN201911084216.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-11-07
Publication Date
2025-08-01
Estimated Expiration
2039-11-07

AI Technical Summary

Technical Problem

In the existing multidimensional data query methods, R-Tree index results in large data scans and long-term data scanning, and the spatial filling curve technology calculation is complex and time-consuming, making it difficult to efficiently conduct multidimensional data query.

Method used

By pre-generated and sorted first and second query tables, use pointers to jump between tables to quickly obtain data within the data range and avoid accessing too much out-of-range data.

Benefits of technology

Fast and continuous multi-dimensional data query is realized, reducing query time, saving data access times and computing complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112783888B_ABST
    Figure CN112783888B_ABST
Patent Text Reader

Abstract

A multi-dimensional data query method and device, relating to the field of computers, can solve the problem of long query time in multi-dimensional data query. The multi-dimensional data query method includes: obtaining a query request including a first dimension, a second dimension, a first dimension query range, and a second dimension query range; in a pre-obtained first query table and second query table, accessing the first query table in sequence according to the first dimension query range; when obtaining first data in the first query table, determining the first data in the second query table according to the pointer of the first data in the first query table, and accessing the second query table in sequence according to the second dimension query range; when obtaining second data in the second query table, determining the second data in the first query table according to the pointer of the second data in the second query table, and accessing the first query table in sequence according to the first dimension query range.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technologies, and in particular, to a multi-dimensional data query method and apparatus. Background Art

[0002] For data organized in a multi-dimensional manner, users need to use a multi-dimensional data query method to query data.

[0003] Currently, users can achieve multi-dimensional data query through a multi-dimensional index. Taking the R-Tree index as an example, the R-Tree index uses a minimum bounding box (MBR) to partition and summarize data. The MBR at the upper level includes several MBRs at the lower level, thus forming a tree structure. The method for using the R-Tree index to perform a multi-dimensional data query is as follows: starting from the root node of the R-Tree, query the MBRs in the child nodes that intersect with the query range, and perform this operation sequentially until the leaf nodes; if the leaf node is completely contained within the query range, obtain all the data of the leaf node; if the leaf node partially intersects with the query range, obtain the data of the leaf node and then perform filtering. That is to say, when performing a multi-dimensional data query through the R-Tree index, the device needs to scan the data outside the query range in order to obtain all the data within the query range. This will lead to a large amount of data scanning and a long query time.

[0004] In addition, users can also combine the space filling curve technology to achieve multi-dimensional data query. Taking the Hilbert curve as an example, the method for combining the Hilbert curve to perform a multi-dimensional data query is as follows: obtain the Hilbert curve of the data in the database using a certain encoding method; according to the data query range input by the user, use a recursive algorithm to locate the data query range on the Hilbert curve; and read the data from the memory according to the located data query range. When performing a multi-dimensional data query by combining the space filling curve technology, the amount of data scanning is reduced, but the process of determining the curve is relatively complex and time-consuming. In addition, a large amount of calculation will be introduced when using the recursive algorithm to locate the data query range on the Hilbert curve, which will also lead to a long query time. Summary of the Invention

[0005] This application provides a multi-dimensional data query method and apparatus, which solves the problem of long query time for users in multi-dimensional data query and improves the efficiency of multi-dimensional data query.

[0006] To achieve the above object, this application provides the following technical solutions:

[0007] In a first aspect, the present application provides a multi-dimensional data query method. The multi-dimensional data query device obtains a query request including a first dimension, a second dimension, a first dimension query range, and a second dimension query range. Then, the multi-dimensional data query device sequentially accesses the first query table according to the first dimension query range in the first query table and the second query table obtained in advance. When the multi-dimensional data query device obtains the first data in the first query table, the multi-dimensional data query device determines the first data in the second query table according to the pointer of the first data in the first query table, and sequentially accesses the second query table according to the second dimension query range. Wherein, the first data in the first query table is: the data at the boundary of the first dimension query range when the value of the second dimension in the first query table is the first value. The first value is the minimum or maximum value of the second dimension query range.

[0008] Further, when the multi-dimensional data query device sequentially accesses the second query table according to the second dimension query range, and when the multi-dimensional data query device obtains the second data in the second query table, the multi-dimensional data query device determines the second data in the first query table according to the pointer of the second data in the second query table, and sequentially accesses the first query table according to the first dimension query range. Wherein, the second data in the second query table is: the data at the boundary of the second dimension query range when the value of the first dimension in the second query table is the second value. The second value is the value of the first dimension of the first data.

[0009] In the multi-dimensional data query method provided by the present application, when performing multi-dimensional data query, the multi-dimensional data query device jumps back and forth between the first query table and the second query table to obtain data according to the first dimension query range and the second dimension query range. Therefore, the multi-dimensional data query device can not only continuously and quickly obtain data, but also does not have to access too much data outside the query range. Therefore, the multi-dimensional data query method provided by the present application can save the time consumed by multi-dimensional data query.

[0010] Combined with the first aspect, in a possible design, the data of the first query table and the second query table obtained in advance by the multi-dimensional data query device is continuous in the first dimension and the second dimension. Specifically, the data in the first query table is first sorted sequentially according to the second dimension, and then sorted sequentially according to the first dimension. The data in the second query table is first sorted sequentially according to the first dimension, and then sorted sequentially according to the second dimension. For each data in the first query table, the pointer of this data points to this data in the second query table. For each data in the second query table, the pointer of this data points to this data in the first query table.

[0011] By pre-sorting the data in different dimensions successively to generate a first query table and a second query table, and connecting the same piece of data between different query tables via pointers, the multi-dimensional data query device can quickly jump between different query tables and continuously obtain data within the first query range and the second query range.

[0012] Combined with the first aspect, in another possible design manner, the multi-dimensional data query device can pre-generate the first query table and the second query table according to the following Method 1 to Method 3:

[0013] Method 1: The multi-dimensional data query device first sorts the data in the database successively according to the second dimension, and then successively according to the first dimension to obtain the first query table; then, the multi-dimensional data query device copies the first query table, and sorts the data in the copied first query table successively according to the first dimension and then successively according to the second dimension to obtain the second query table.

[0014] Method 2: The multi-dimensional data query device first sorts the data in the database successively according to the first dimension, and then successively according to the second dimension to obtain the second query table; then, the multi-dimensional data query device copies the second query table, and sorts the data in the copied second query table successively according to the second dimension and then successively according to the first dimension to obtain the first query table.

[0015] Method 3: The multi-dimensional data query device first copies the data in the database; then the multi-dimensional data query device sorts the data in the database successively according to the second dimension and then successively according to the first dimension to obtain the first query table; the multi-dimensional data query device sorts the copied data successively according to the first dimension and then successively according to the second dimension to obtain the second query table.

[0016] The above-mentioned copying of the first query table may refer to copying all the data in the first query table, or may refer to only copying the data of the first dimension and the second dimension in the first query table, and the present application does not make a limitation on this. The principles of the above-mentioned copying of the second query table and the copying of the data in the database are similar to that of copying the first query table, and all the data can be copied, or only the data of the first dimension and the second dimension can be copied.

[0017] Combined with the first aspect, in another possible design manner, the multi-dimensional data query device determines that the priority of the first dimension is the first priority and the priority of the second dimension is the second priority according to the first dimension query range and the second dimension query range. Then, the multi-dimensional data query device determines to obtain data starting from the first query table according to the first priority. Among them, the first priority is higher than the second priority.

[0018] In combination with the first aspect, in another possible design, the multi-dimensional data query device determines that the priority of the first dimension is the first priority and the priority of the second dimension is the second priority according to the first dimension query range and the second dimension query range, specifically including: the multi-dimensional data query device determines that the number of values of the first dimension in the first dimension query range is greater than the number of values of the second dimension in the second dimension query range; further, the multi-dimensional data query device determines that the priority of the first dimension is the first priority and the priority of the second dimension is the second priority.

[0019] Since the number of values of the first dimension in the first dimension query range is greater than the number of values of the second dimension in the second dimension query range, the priority of the first dimension is high, and the first dimension is the dimension sorted last in the first query table. Therefore, the number of times the multi-dimensional data query device needs to jump between the first query table and the second query table when first obtaining data from the first query table is less than the number of times the multi-dimensional data query device needs to jump between the first query table and the second query table when first obtaining data from the second query table. That is to say, the multi-dimensional data query device first obtaining data from the first query table further saves the time-consuming of data query.

[0020] In a second aspect, the present application provides a multi-dimensional data query device. The multi-dimensional data query device includes an acquisition unit, a query unit, and a determination unit.

[0021] The above-mentioned acquisition unit is used to pre-acquire a first query table and a second query table, and to acquire a query request, where the query request includes a first dimension, a second dimension, a first dimension query range, and a second dimension query range. The above-mentioned query unit is used to sequentially access the first query table pre-acquired by the above-mentioned acquisition unit according to the first dimension query range acquired by the above-mentioned acquisition unit. The above-mentioned acquisition unit is further used to acquire first data within the first query table. The above-mentioned determination unit is used to, when the above-mentioned acquisition unit acquires first data within the first query table, determine the first data in the second query table pre-acquired by the above-mentioned acquisition unit according to the pointer of the first data in the first query table; wherein, the first data in the first query table is: the data at the boundary of the first dimension query range when the value of the second dimension in the first query table is a first value, and the first value is the minimum or maximum value of the second dimension query range. The above-mentioned query unit is further used to, when the above-mentioned determination unit determines the first data in the second query table, sequentially access the second query table according to the second dimension query range acquired by the above-mentioned acquisition unit. The above-mentioned acquisition unit is further used to acquire second data within the second query table. The above-mentioned determination unit is further used to, when the above-mentioned acquisition unit acquires second data within the second query table, determine the second data in the first query table according to the pointer of the second data in the second query table; wherein, the second data in the second query table is: the data at the boundary of the second dimension query range when the value of the first dimension in the second query table is a second value, and the second value is the value of the first dimension of the first data.

[0022] Combined with the second aspect, in a possible design, the first query table and the second query table pre-acquired by the multi-dimensional data query device are continuous in data in the first dimension and the second dimension. Specifically, the data in the first query table is first sorted in sequence according to the second dimension, and then sorted in sequence according to the first dimension. The data in the second query table is first sorted in sequence according to the first dimension, and then sorted in sequence according to the second dimension. For each data in the first query table, the pointer of this data points to this data in the second query table. For each data in the second query table, the pointer of this data points to this data in the first query table.

[0023] Combined with the second aspect, in another possible design, the multi-dimensional data query device further includes a generation unit.

[0024] The above-mentioned generation unit is used to first sort the data in the database in sequence according to the second dimension, and then sort it in sequence according to the first dimension to obtain the first query table. Then, copy the first query table, and first sort the data in the copied first query table in sequence according to the first dimension, and then sort it in sequence according to the second dimension to obtain the second query table;

[0025] Alternatively, the above generating unit is configured to first sort the data in the database in sequence according to the first dimension, and then sort the data in sequence according to the second dimension to obtain a second query table. Then, the second query table is copied, and the data in the copied second query table is first sorted in sequence according to the second dimension, and then sorted in sequence according to the first dimension to obtain a first query table;

[0026] Alternatively, the above generating unit is configured to copy the data in the database; then, the data in the database is first sorted in sequence according to the second dimension, and then sorted in sequence according to the first dimension to obtain a first query table. Then, the copied data is first sorted in sequence according to the first dimension, and then sorted in sequence according to the second dimension to obtain a second query table.

[0027] Combined with the second aspect, in another possible design, the above determining unit is further configured to determine, according to the first dimension query range and the second dimension query range obtained by the obtaining unit, that the priority of the first dimension is the first priority and the priority of the second dimension is the second priority. After that, the above determining unit determines to obtain data starting from the first query table according to the first priority. Wherein, the first priority is higher than the second priority.

[0028] Combined with the second aspect, in another possible design, the above determining unit is specifically configured to determine that the number of values of the first dimension in the first dimension query range is greater than the number of values of the second dimension in the second dimension query range; and, the above determining unit determines that the priority of the first dimension is the first priority and the priority of the second dimension is the second priority.

[0029] In a third aspect, the present application provides a multi-dimensional data query device, which includes: a memory and one or more processors; the above memory and the processor are coupled; the memory is used to store the first query table and the second query table, and the memory is further used to store computer program code, and the computer program code includes computer instructions. When the computer instructions are executed by the multi-dimensional data query device, the multi-dimensional data query device executes the multi-dimensional data query method as described in the first aspect and any of its possible design manners.

[0030] In a fourth aspect, the present application provides a chip system, which applies the multi-dimensional data query device; the chip system includes one or more interface circuits and one or more processors; the interface circuits and the processors are interconnected through lines; the interface circuits are used to receive signals from the memory of the multi-dimensional data query device and send the signals to the processors, and the signals include computer instructions stored in the memory; when the processors execute the computer instructions, the multi-dimensional data query device executes the multi-dimensional data query method as described in the first aspect and any of its possible design manners.

[0031] Fifth aspect, the present application provides a computer-readable storage medium, which includes computer instructions. When the computer instructions run on a multi-dimensional data query device, the multi-dimensional data query device is enabled to implement the multi-dimensional data query method as described in the first aspect and any possible design manner thereof.

[0032] Sixth aspect, the present application provides a computer program product. When the computer program product runs on a computer, the computer is enabled to execute the multi-dimensional data query method as described in the first aspect and any possible design manner thereof.

[0033] For the specific descriptions of the second to sixth aspects and their various implementation manners in the present application, reference can be made to the detailed descriptions in the first aspect and its various implementation manners; and, for the beneficial effects of the second to sixth aspects and their various implementation manners, reference can be made to the beneficial effect analysis in the first aspect and its various implementation manners, which will not be elaborated here.

[0034] In the present application, the name of the above multi-dimensional data query device does not constitute a limitation to the device or functional module itself. In actual implementation, these devices or functional modules may appear under other names. As long as the functions of each device or functional module are similar to those of the present application and fall within the scope of the claims of the present application and equivalent technologies.

[0035] These aspects or other aspects of the present application will be more clearly understood in the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 It is a schematic diagram of the hardware structure of the multi-dimensional data query device provided by an embodiment of the present application;

[0037] Figure 2 It is a schematic flow chart of the multi-dimensional data query method provided by an embodiment of the present application Figure 1 ;

[0038] Figure 3 It is a schematic flow chart provided by an embodiment of the present application Figure 1 ;

[0039] Figure 4 It is a schematic flow chart provided by an embodiment of the present application Figure 2 ;

[0040] Figure 5 It is a schematic flow chart provided by an embodiment of the present application Figure 3 ;

[0041] Figure 6 It is a schematic flow chart of the multi-dimensional data query method provided by an embodiment of the present application Figure 2 ;

[0042] Figure 7Flow schematic of multi-dimensional data query provided by an embodiment of this application Figure 1 ;

[0043] Figure 8 Flow schematic of multi-dimensional data query provided by an embodiment of this application Figure 2 ;

[0044] Figure 9 Flow schematic of the multi-dimensional data query method provided by an embodiment of this application Figure 3 ;

[0045] Figure 10 Structural schematic diagram of the multi-dimensional data query device provided by an embodiment of this application;

[0046] Figure 11 Structural schematic diagram of a chip system provided by an embodiment of this application;

[0047] Figure 12 Structural schematic diagram of the computer program product provided by an embodiment of this application. Detailed implementation manners

[0048] In the embodiments of this application, words such as "exemplary" or "for example" are used to represent examples, illustrations or explanations. Any embodiment or design solution described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Rather, the use of words such as "exemplary" or "for example" is intended to present relevant concepts in a specific manner.

[0049] To facilitate a clear description of the technical solutions of the embodiments of this application, in the embodiments of this application, words such as "first" and "second" are used to distinguish identical items or similar items with basically the same functions and roles. Those skilled in the art can understand that the words such as "first" and "second" do not limit the quantity and execution order, and the words such as "first" and "second" do not necessarily limit being different.

[0050] Dimension refers to a specific angle at which people observe data, or a category of attributes of data. For example, when a user monitors the working status of multiple servers, data on the working status of different servers at different times can be recorded. Among them, time is a dimension, the number identifying different servers is another dimension, and the working status of the servers is yet another dimension. When data is stored in a multi-dimensional manner, in order to be able to observe data from multiple angles and multiple aspects simultaneously, so as to facilitate users to deeply understand the information and connotations contained in the data, multi-dimensional data query technology emerges as the times require.

[0051] An embodiment of the present application provides a multi-dimensional data query method and apparatus. The multi-dimensional data query apparatus pre-sorts the stored data according to different dimensions to obtain multiple query tables. The multi-dimensional data query apparatus also configures pointers for the data in each query table, and the pointers are used to point to the data in other query tables. In this way, when querying data, the multi-dimensional data query apparatus can jump between multiple query tables through the pointers, and thus can continuously obtain all the data within the query range. The multi-dimensional data query method provided by the embodiment of the present application can maintain the segmented continuity of data storage, so that data can be quickly obtained, saving the time consumed for querying data.

[0052] The multi-dimensional data query apparatus in the embodiment of the present application may be a device such as a computer, a mobile phone, a laptop computer, a server, etc., or any other device capable of implementing the embodiment of the present application, and the present application does not make any limitation thereto.

[0053] Reference Figure 1 , Figure 1 shows a hardware structure of the multi-dimensional data query apparatus 10 in the embodiment of the present application. As Figure 1 shown, the multi-dimensional data query apparatus 10 includes a processor 11, a memory 12, a communication interface 13, and a bus 14. The processor 11, the memory 12, and the communication interface 13 can be connected through the bus 14.

[0054] The processor 11 is the control center of the multi-dimensional data query apparatus 10, and may be a general-purpose central processing unit (CPU), or other general-purpose processors, etc. Among them, the general-purpose processor may be a microprocessor or any conventional processor, etc.

[0055] As an example, the processor 11 may include one or more CPUs, such as Figure 1 the CPU 0 and CPU1 shown in

[0056] The memory 12 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a disk storage medium, or other magnetic storage devices, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.

[0057] In one possible implementation, the memory 12 can exist independently of the processor 11. The memory 12 can be connected to the processor 11 through the bus 14 and is used to store data, instructions, or program codes. When the processor 11 calls and executes the instructions or program codes stored in the memory 12, the multi-dimensional data query method provided by the embodiments of the present application can be implemented.

[0058] In another possible implementation, the memory 12 can also be integrated with the processor 11.

[0059] The communication interface 13 is used for the multi-dimensional data query device 10 to connect with other devices (such as clients, servers, etc.) through a communication network. The communication network can be an Ethernet, a radio access network (RAN), a wireless local area network (WLAN), etc. The communication interface 13 can include a receiving unit for receiving data and a sending unit for sending data.

[0060] The bus 14 can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience of representation, Figure 1 only a thick line is used to represent it in the figure, but it does not mean that there is only one bus or one type of bus.

[0061] It should be noted that, Figure 1 the structure shown in the figure does not constitute a limitation on the multi-dimensional data query device. Except for Figure 1 the components shown, the multi-dimensional data query device 10 can include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.

[0062] The multi-dimensional data query method provided by the embodiments of the present invention will be described below with reference to the accompanying drawings.

[0063] It should be noted that the data in the database described in the embodiments of the present application is a combination of numerical values in multiple dimensions. This data can be the data corresponding to the combination of numerical values of all dimensions in the database, or the data corresponding to the combination of the numerical value of the first dimension and the numerical value of the second dimension.

[0064] The multi-dimensional data query method provided by the embodiments of the present application includes a query table construction process and a data query process. The multi-dimensional data query method provided by the embodiments of the present application can be applied to scenarios with m query dimensions, where m is an integer greater than or equal to 2. For the sake of convenience of description, the embodiments of the present application will be described by taking the example of obtaining query tables (the first query table and the second query table) for querying two dimensions (the first dimension and the second dimension).

[0065] First, the process of constructing the query table will be described below.

[0066] Figure 2 The figure shows a schematic flow chart of constructing a query table in a multi-dimensional data query method provided by an embodiment of the present application.

[0067] As Figure 2 shown, the process of constructing the query table includes the following steps S201 - S206:

[0068] S201. The multi-dimensional data query device determines the first dimension and the second dimension.

[0069] In practical applications, the multi-dimensional data query device can determine the first dimension and the second dimension according to the construction query table request currently input by the user, or can determine the first dimension and the second dimension according to the historical query record.

[0070] Exemplarily, the monitoring database of the server includes three dimensions: month, server number, and server status information. Here, the server status information can be the information about newly added / deleted / modified virtual machines in the server. For this database, the multi-dimensional data query device can determine that the first dimension is time and the second dimension is the server number according to the construction query table request currently input by the user; or, the multi-dimensional data query device can determine that the first dimension is time and the second dimension is the server number according to the historical query record.

[0071] S202. The multi-dimensional data query device checks whether there are vacancies in the database in the first dimension and the second dimension.

[0072] As can be seen from the above description, the data in the database is a combination of numerical values in multiple dimensions. When a combination of a certain numerical value within the value range of the numerical values in the first dimension and a certain numerical value within the value range of the numerical values in the second dimension does not appear in the database, the multi-dimensional data query device determines that there are vacancies in the database in the first dimension and the second dimension. The embodiments of the present application refer to the data including the numerical value within the value range of the first dimension and the numerical value within the value range of the second dimension as vacancy data.

[0073] The multi-dimensional data query device traverses each value of the first dimension and the second dimension in the database, and compares them with the value ranges of the values of the first dimension and the second dimension to determine whether there are gaps in the database in the first dimension and the second dimension.

[0074] Exemplarily, as Figure 3 shown, the multi-dimensional data query device determines that the first dimension is the month, the second dimension is the server number, the value range of the values of the first dimension is from January to March, and the value range of the values of the second dimension is from 1 to 3.

[0075] As Figure 3 shown, after the multi-dimensional data query device traverses each value of the first dimension and the second dimension, it determines that there are two combinations (2, 1) and (3, 2) of the values of the first dimension and the values of the second dimension missing in the database. Therefore, the multi-dimensional data query device determines that there are gaps in the database.

[0076] In practical applications, due to some reasons, such as: data transmission failures, memory write failures, etc., there may be some gaps in the data stored in the database. When there are too many gaps in the database, it will cause the multi-dimensional data query device to be unable to continuously read data. Therefore, before performing multi-dimensional data query, the multi-dimensional data query device needs to first check whether there are gaps in the database.

[0077] If the database has no gaps, it means that the data in the database is dense. That is to say, in this database, any combination of any value within the value range of the values of the first dimension and any value within the value range of the values of the second dimension exists. Therefore, when the multi-dimensional data query device queries data, it can continuously obtain data. At this time, the multi-dimensional data query device executes S204.

[0078] If the database has multiple gaps, the multi-dimensional data query device further determines the number of gaps. The multi-dimensional data query device can traverse each value of the first dimension and the second dimension in the database to determine the number of gaps. If the number of gaps in the database is less than or equal to the first threshold, the multi-dimensional data query device can perform the following step S203 to ensure data continuity. If the number of gaps in the database is greater than the first threshold, it means that the data in the database is sparse. At this time, the multi-dimensional data query device can query data using existing methods. In actual use, the first threshold can be set according to actual usage requirements, and this application does not limit this.

[0079] S203. The multi-dimensional data query device fills the gaps in the database with preset data.

[0080] Filling the vacant positions in the database with preset data can ensure the continuity of the data. In this way, the multi-dimensional data query device can read the data continuously.

[0081] The preset data is the data corresponding to the combination of a certain value within the value range of the first-dimensional value and a certain value within the value range of the second-dimensional value.

[0082] Exemplarily, in combination with Figure 3 , referring to Figure 4 . Figure 3 There are two vacancies in the database in . Therefore, the multi-dimensional data query device supplements two preset data (2, 1) and (3, 2) in the database, thus ensuring the continuity of the data in the database.

[0083] S204. The multi-dimensional data query device generates a first query table and a second query table.

[0084] Specifically, the multi-dimensional data query device can generate the first query table and the second query table in one of the following methods 1 to 3:

[0085] Method 1: The multi-dimensional data query device first sorts the data in the database in sequence according to the values of the second dimension. Then, for the data with the same value of the second dimension, the multi-dimensional data query device sorts the data in sequence according to the values of the first dimension to obtain the first query table. The multi-dimensional data query device copies the first query table, and then sorts the data in the copied first query table in sequence according to the values of the first dimension. Then, for the data with the same value of the first dimension, the multi-dimensional data query device sorts the data in sequence according to the values of the second dimension, and thus obtains the second query table. Among them, copying the first query table can be copying all the data in the first query table, or copying the data of the first dimension and the second dimension in the first query table.

[0086] Method 2: The multi-dimensional data query device can also first sort the data in the database in sequence according to the values of the first dimension. Then, for the data with the same value of the first dimension, the multi-dimensional data query sorts the data in sequence according to the values of the second dimension to obtain the second query table. The multi-dimensional data query device copies the second query table, and then sorts the data in the copied second query table in sequence according to the values of the second dimension. Then, for the data with the same value of the second dimension, the multi-dimensional data query sorts the data in sequence according to the values of the first dimension, and thus obtains the first query table. Among them, copying the second query table can be copying all the data in the second query table, or copying the data of the first dimension and the second dimension in the second query table.

[0087] Method 3: The multi-dimensional data query device can also first copy the data in the database. Then, the data in the database is sorted in ascending order according to the values of the second dimension. Then, for the data with the same value in the second dimension, the multi-dimensional data query sorts the data in ascending order according to the values of the first dimension to obtain the first query table. The multi-dimensional data query device then sorts the copied data in ascending order according to the values of the first dimension. Then, for the data with the same value in the first dimension, the multi-dimensional data query sorts the data in ascending order according to the values of the second dimension to obtain the second query table. Among them, copying the data in the database can be copying all the data in the database or copying the data of the first dimension and the second dimension in the database.

[0088] In the above description, if there is no vacancy in the data in the database, the multi-dimensional data query device generates the first query table and the second query table according to the database. If there is a vacancy in the data in the database, the multi-dimensional data query device generates the first query table and the second query table according to the database filled with preset data at the vacancy position.

[0089] It can be understood that the sorting method of the values can be sorting in ascending order or sorting in descending order, and the embodiments of the present application do not limit this.

[0090] Exemplarily, refer to Table 1 and Table 2. Among them, the first dimension is the month, and the second dimension is the server number.

[0091] As shown in Table 1, the multi-dimensional data query device sorts the data in Table 1 in ascending order according to the values of the second dimension. Then, for the data with the same value in the second dimension, the multi-dimensional data query device sorts the data in ascending order according to the values of the first dimension to obtain the first query table.

[0092] As shown in Table 2, the multi-dimensional data query device sorts the data in Table 2 in ascending order according to the values of the first dimension. Then, for the data with the same value in the first dimension, the multi-dimensional data query device sorts the data in ascending order according to the values of the second dimension to obtain the second query table.

[0093] Table 1

[0094]

[0095] Table 2

[0096]

[0097] S205: The multi-dimensional data query device creates pointers for the first query table and the second query table.

[0098] Specifically, the multi-dimensional data query device creates pointers for each piece of data in the first query table and the second query table.

[0099] When the database contains n pieces of data, the pointers created by the multi-dimensional data query device for the first query table include n pointers. Similarly, the pointers created by the multi-dimensional data query device for the second query table also include n pointers.

[0100] Taking data A among the n pieces of data as an example, the multi-dimensional data query device creates a first pointer for data A in the first query table. This first pointer is used to point from data A in the first query table to data A in the second query table. The multi-dimensional data query device creates a second pointer for data A in the second query table. This second pointer is used to point from data A in the second query table to data A in the first query table.

[0101] As can be seen from the above description, in one implementation, the data in the first query table and the second query table can be the data corresponding to the combination including the values of all dimensions in the database. At this time, the data in the first query table and the second query table are exactly the same. Therefore, the data A described above is any piece of data corresponding to the combination including the values of all dimensions in the first query table and the second query table.

[0102] In another implementation, the data in the first query table can be the data corresponding to the combination including the values of all dimensions in the database, and the data in the second query table can be the data corresponding to the combination including only the values of the first dimension and the second dimension. At this time, in the first query table and the second query table, the data of the first dimension and the second dimension are exactly the same. Therefore, the data A described above is any piece of data corresponding to the combination including the values of the first dimension and the second dimension in the first query table and the second query table.

[0103] In another implementation, the data in the second query table can be the data corresponding to the combination including the values of all dimensions in the database, and the data in the first query table can be the data corresponding to the combination including only the values of the first dimension and the second dimension. At this time, in the first query table and the second query table, the data of the first dimension and the second dimension are exactly the same. Therefore, the data A described above is any piece of data corresponding to the combination including the values of the first dimension and the second dimension in the first query table and the second query table.

[0104] The following description in the embodiments of the present application is illustrated by taking the data in the first query table and the second query table as being exactly the same as an example.

[0105] Exemplarily, refer to Figure 5 . Figure 5 shows an example of the interconnection between the first query table and the second query table through pointers. As Figure 5As shown, between the sorted first query table and the second query table, the data 7 in the first query table points to the data 7 in the second query table through the pointer 51. The data 7 in the second query table points to the data 7 in the first query table through the pointer 52.

[0106] In the multi-dimensional data query method provided by the embodiment of the present application, the dimension for obtaining the query table can specifically be m dimensions, where m is a positive integer greater than or equal to 2. Specifically, when the dimension is m, the multi-dimensional data query device obtains m query tables, and the last sorted dimensions in any two of the m query tables are different. If the number of data in the database is n, then the number of pointers between the m query tables is where represents the combination number of every two query tables among the m query tables.

[0107] Exemplarily, if the query dimensions are the first dimension and the second dimension, that is, m = 2, and the number of data in the database is 4, that is, n = 4, the multi-dimensional data device obtains two query tables, and the number of pointers included in these two query tables is:

[0108] S206 (optional), the multi-dimensional data query device updates the first query table and the second query table.

[0109] In practical applications, users will perform operations such as adding / deleting / modifying the data in the database. In response to this operation, the multi-dimensional data query device needs to update the first query table and the second query table.

[0110] Optionally, when adding / deleting / modifying the data in the database, the multi-dimensional data query device updates the data in the first query table and the second query table in real time. Or, when the preset first duration ends, the multi-dimensional data query device updates the data in the first query table and the second query table. Or, when the number of data to be updated reaches the second threshold, the multi-dimensional data query device updates the data in the first query table and the second query table.

[0111] When the preset first duration ends, the multi-dimensional data query device updates the data in the first query table and the second query table, and re-sorts the updated data in the first query table and the second query table. Among them, the preset first duration is set in advance according to actual usage requirements, and the present application does not make any limitations in this regard.

[0112] When the number of data to be updated reaches the second threshold, the multi-dimensional data query device updates the data in the first query table and the second query table, and re-sorts the updated data in the first query table and the second query table. Among them, the second threshold can be set in advance according to actual usage requirements, and the present application does not make any limitations in this regard.

[0113] It should be noted that the strategies for updating the first query table and the second query table described above are only for illustrative purposes. Any other strategies that can achieve the data update in the first query table and the second query table are within the protection scope of the embodiments of the present application.

[0114] The query tables used in the multi-dimensional data query method provided by the embodiments of the present application are obtained through S201 - S205, and S206 can be executed or not.

[0115] Furthermore, the multi-dimensional data query device executes a data query process according to the first query table and the second query table constructed above. The following describes this data query process.

[0116] As Figure 6 shown, the data query process provided by the embodiments of the present application includes S601 - S603.

[0117] S601. The multi-dimensional data query device obtains a query request.

[0118] In one implementation, if the multi-dimensional data query device is a user-operable terminal, when the user has a need to query data of the first dimension and the second dimension, the user will input a query request in the multi-dimensional data query device, and the query request includes the first dimension, the second dimension, the first dimension query range, and the second dimension query range. Correspondingly, the multi-dimensional data query device will receive this query request.

[0119] In another implementation, if the multi-dimensional data query device is a server, the server communicates with the user-operable terminal. After the terminal receives the query request input by the user, the terminal sends the query request to the multi-dimensional data query device. In this way, the multi-dimensional data query device will receive this query request.

[0120] Exemplarily, the user inputs "status information of servers numbered 2 - 3 from January to March" in the query input box of the multi-dimensional data query device and clicks the query button. In this way, the multi-dimensional query device can obtain a query request for requesting to query the status information of servers numbered 2 - 3 from January to March. Here, the status information of the server can be information about newly added / deleted / modified virtual machines in the server. The first dimension in this query request can be the month, and the first dimension query range is 1 - 3; the second dimension can be the server number, and the second dimension query range is 2 - 3.

[0121] S602 (optional). The multi-dimensional data query device determines the priority of the first dimension and the priority of the second dimension according to the first dimension query range and the second dimension query range.

[0122] Optionally, the multi-dimensional data query device determines the priorities of the first dimension and the second dimension according to the number of values of the first dimension in the first dimension query range and the number of values of the second dimension in the second dimension query range.

[0123] When the number of values of the first dimension in the first dimension query range is greater than the number of values of the second dimension in the second dimension query range, the multi-dimensional data query device determines that the priority of the first dimension is the first priority and the priority of the second dimension is the second priority. When the number of values of the second dimension in the second dimension query range is greater than the number of values of the first dimension in the first dimension query range, the multi-dimensional data query device determines that the priority of the second dimension is the first priority and the priority of the first dimension is the second priority. Herein, the first priority is higher than the second priority.

[0124] Exemplarily, the query request is used to request to query the status information of the servers numbered 2 - 3 from January to March. The first dimension is the month and the second dimension is the server number. In the first dimension query range, the values of the first dimension are 1, 2, and 3. Therefore, the number of values of the first dimension in the first dimension query range is 3. In the second dimension query range, the values of the second dimension are 2 and 3. Therefore, the number of values of the second dimension in the second dimension query range is 2. Since the number of values of the first dimension in the first dimension query range, which is 3, is greater than the number of values of the second dimension in the second dimension query range, which is 2, the multi-dimensional data query device determines that the priority of the first dimension is the first priority and the priority of the second dimension is the second priority.

[0125] For ease of description, the following content of the embodiments of the present application mainly takes the priority of the first dimension as the first priority and the priority of the second dimension as the second priority as an example for illustration. Herein, the first priority is higher than the second priority.

[0126] As can be seen from the above description, S602 is an optional step. In the case where S602 is executed, the multi-dimensional data query device can determine the query table for starting to query data according to the priority of the dimension sorted last in the query table. For example, the dimension sorted last in the first query table is the first dimension, and the dimension sorted last in the second query table is the second dimension. The priority of the first dimension is the first priority and the priority of the second dimension is the second priority. Since the first priority is higher than the second priority, the multi-dimensional data query device determines to obtain data from the first query table first.

[0127] S603. The multi-dimensional data query device obtains the data within the query range according to the first query table and the second query table.

[0128] The first query table and the second query table can be query tables with updated data or query tables without updated data.

[0129] The content described below in the embodiments of this application is described on the basis that the multi-dimensional data query device has executed S602. Therefore, the multi-dimensional data query device first starts to obtain data from the first query table.

[0130] Specifically, the multi-dimensional data query device performs a first operation.

[0131] This first operation includes: The multi-dimensional data query device queries data from the first query table according to the first dimension query range and the second dimension query range. When the multi-dimensional data query device queries the first data (abbreviated as data B) that satisfies the first dimension query range and the second dimension query range, the multi-dimensional data query device obtains data B. After that, the multi-dimensional data query device queries the next data of data B. If the next data also satisfies the first dimension query range and the second dimension query range, the multi-dimensional data query device obtains the next data. Until the multi-dimensional data query device obtains data C (corresponding to the first data in this application), it is determined that data C is the data in the first query table where the first dimension value is the boundary value of the first dimension query range when the second dimension value is the second dimension value of data B. At this time, the multi-dimensional data query device determines data C in the second query table according to the pointer of data C, and obtains data in the second query table according to the second dimension query range. That is to say, when data C is obtained, the multi-dimensional data query device jumps from the first query table to the second query table and obtains data in the second query table according to the second dimension query range.

[0132] It is easy to understand that after the first operation is completed, in the second query table, if the multi-dimensional data query device determines that the previous data and the next data of data C both exceed the first dimension query range and the second dimension query range, or determines that the previous data and the next data of data C are all data that have been obtained, then the multi-dimensional data query device determines that all data within the first query range and the second query range have been obtained. At this time, the process of the multi-dimensional data device obtaining data terminates. Otherwise, the multi-dimensional data query device performs a second operation.

[0133] This second operation includes: Obtaining data in the second query table according to the second dimension query range. When the multi-dimensional data query device obtains data D (corresponding to the second data in this application), it is determined that data D is the data in the second query table where the second dimension value is the boundary value of the second dimension query range when the first dimension value is the first dimension value of data C. At this time, the multi-dimensional data query device determines data D in the first query table according to the pointer of data D, and obtains data in the second query table according to the first dimension query range. That is to say, when data D is obtained, the multi-dimensional data query device jumps from the second query table to the first query table and obtains data in the first query table according to the first dimension query range.

[0134] It can be understood that after the second operation is completed, in the first query table, if the multi-dimensional data query device determines that both the previous data and the next data of data D exceed the first-dimensional query range and the second-dimensional query range, or determines that the previous data and the next data of data D are both data that have been acquired, then the multi-dimensional data query device determines that all data within the first query range and the second query range have been acquired. At this time, the process of the multi-dimensional data device acquiring data terminates. Otherwise, the multi-dimensional data query device repeats the first operation and the second operation until all data within the first-dimensional query range and the second-dimensional query range are acquired.

[0135] Exemplarily, refer to Figure 7 . Figure 7 It shows the process of the multi-dimensional data query device querying data presented in tabular form.

[0136] As Figure 7 shown, the first dimension is the month, and the first-dimensional query range is 1 - 3. The second dimension is the server number, and the second-dimensional query range is 2 - 3. The priority of the first dimension is the first priority, and the priority of the second dimension is the second priority. The black box 73 is the presentation of the first-dimensional query range and the second-dimensional query range on the two-dimensional coordinate axis.

[0137] Specifically, according to the priority of the first dimension, as well as the first-dimensional query range and the second-dimensional query range, the multi-dimensional data query device first queries data one by one along the positive direction of the first dimension from the first query table (Table 1). When the multi-dimensional data query device queries data 2 and determines that data 2 is data B, the multi-dimensional data query device acquires data 2 and continues to acquire data one by one along the positive direction of the first dimension. When the multi-dimensional data query device acquires data 8 and determines that data 8 is data C, the multi-dimensional data query device determines data 8 in the second query table (Table 2) according to the pointer 71 of data 8 in the first query table.

[0138] Further, the multi-dimensional data query device starts from data 8 in the second query table and continues to acquire data within the second-dimensional query range along the positive direction of the second dimension. When the multi-dimensional data query device acquires data 9 and determines that data 9 is the fourth data, the multi-dimensional data query device determines data 9 in the first query table according to the pointer 72 of data 9 in the second query table.

[0139] The multi-dimensional data query device starts from data 9 in the first query table and continues to acquire data within the first-dimensional query range along the negative direction of the first dimension.

[0140] Subsequently, the multi-dimensional data query device repeats the above steps until all data within the first-dimensional query range and the second-dimensional query range are acquired.

[0141] It should be noted that if S602 is not executed, the multi-dimensional data query device can start obtaining data from the first query table first (the specific process can refer to the above description), or start obtaining data from the second query table first. The process of starting to obtain data from the second query table first is similar to the process of starting to obtain data from the first query table first, and will not be elaborated here in detail.

[0142] In the case of executing S602, the number of times the multi-dimensional data query device needs to jump between the first query table and the second query table when obtaining data from the first query table first is less than the number of times the multi-dimensional data query device needs to jump between the first query table and the second query table when obtaining data from the second query table first. Among them, the priority of the first dimension sorted last in the first query table is the first priority, and the priority of the second dimension sorted last in the second query table is the second priority, and the first priority is higher than the second priority. Therefore, the multi-dimensional data query device obtaining data from the first query table first is more time-saving for data query.

[0143] For a clearer understanding of the method provided by the embodiments of the present application, refer to Figure 8 , Figure 8 which shows the process of the multi-dimensional data query device querying data presented in the form of a sequence list.

[0144] As Figure 8 shown, the first dimension is Dimension 1 and the second dimension is Dimension 2. The A1 sequence list is sorted by the second dimension first and then by the first dimension. The A2 sequence list is sorted by the first dimension first and then by the second dimension. The A1 sequence list is the first query table and the A2 sequence list is the second query table.

[0145] Figure 8 The black box 83 in Figure 8 is the presentation of the first dimension query range and the second dimension query range on the two-dimensional coordinate axis. Since

[0146] Specifically, according to the first - dimension query range and the second - dimension query range, the multi - dimensional data query device first queries data one by one along the positive direction of the first dimension from the first query table (A1 sequence table). When the multi - dimensional data query device queries data P2,2, it determines P2,2 as data B. The multi - dimensional data query device obtains data B and continues to obtain data one by one along the positive direction of the first dimension. When the multi - dimensional data query device obtains P2,5, it determines P2,5 as data C. The multi - dimensional data query device determines the data P2,5 in the second query table (A2 sequence table) according to the pointer 81 of the data P2,5 in the first query table.

[0147] Further, the multi - dimensional data query device starts from the data P2,5 in the second query table and continues to obtain data along the positive direction of the second dimension within the second - dimension query range. When the multi - dimensional data query device obtains P5,5, it determines P5,5 as data D. The multi - dimensional data query device determines the data P5,5 in the first query table according to the pointer 82 of the data P5,5 in the second query table.

[0148] Subsequently, the multi - dimensional data query device starts from the data P5,5 in the first query table and continues to obtain data along the negative direction of the first dimension within the first - dimension query range.

[0149] Repeat the above steps. When the next data of the obtained data exceeds the first - dimension query range and the second - dimension query range, or when the next data of the obtained data is the data that has been obtained, the multi - dimensional data query device determines the obtained data in another query table different from the current query table according to the pointer of the obtained data, until all the data within the first - dimension query range and the second - dimension query range are obtained.

[0150] In addition, from the description of step S204 for generating the query table, when obtaining the first query table and the second query table, the multi - dimensional data query device can copy all the data in the database, or only copy the data of the first dimension and the second dimension. The data acquisition process in this scenario will be described below: Taking the case where the first query table is obtained by sorting the first dimension and the second dimension based on all the data in the database, and the second query table is obtained by copying the data of the first dimension and the second dimension and then sorting the first dimension and the second dimension as an example. At this time, the first query table contains all the data, and the second query table only contains the data of the first dimension and the second dimension.

[0151] Combined Figure 2 with Figure 9 Figure 9 It shows that when the second query table only contains the data of the first dimension and the second dimension, step S603 above further includes S603a: ​

[0152] The multi-dimensional data query device obtains data E in the second query table. The multi-dimensional data query device determines data E in the first query table according to the pointer of data E in the second query table, and obtains the complete data of data E.

[0153] Among them, data E is any data obtained by the multi-dimensional data query device in the second query table according to the first dimension query range and the second dimension query range.

[0154] Specifically, when the multi-dimensional data query device obtains data E in the second query table, the multi-dimensional data query device determines data E in the first query table according to the pointer of data E in the second query table, and obtains the complete data of data E from the first query table.

[0155] To more clearly understand the method provided by the embodiments of the present application, the following is a simple illustration with a query dimension of 3.

[0156] When the multi-dimensional data query device receives a query request with a query dimension of 3 input by the user, the query request includes a first dimension, a second dimension, a third dimension, a first dimension query range, a second dimension query range, and a third dimension query range. Here, the multi-dimensional data query device pre-obtains a first query table, a second query table, and a third query table according to S201 - S205, and determines the priority of the first dimension, the priority of the second dimension, and the priority of the third dimension according to S602, which will not be elaborated here.

[0157] After the multi-dimensional data query device obtains the first query table, the second query table, and the third query table, the multi-dimensional data query device performs a first operation. Among them, the last sorted dimension of the first query table is the first dimension, the priority of the first dimension is the first priority, the last sorted dimension of the second query table is the second dimension, the priority of the second dimension is the second priority, the last sorted dimension of the third query table is the third dimension, the priority of the third dimension is the third priority, where the first priority is higher than the second priority, and the second priority is higher than the third priority.

[0158] Specifically, the first operation includes: the multi-dimensional data query device queries data from the first query table along the first dimension direction according to the first dimension query range, the second dimension query range, and the third dimension query range; when the multi-dimensional data query device queries the first data (abbreviated as data B) that satisfies the first dimension query range, the second dimension query range, and the third dimension query range, the multi-dimensional data query device obtains data B. After that, the multi-dimensional data query device queries the next data of data B. If the next data also satisfies the first dimension query range, the second dimension query range, and the third dimension query range, the multi-dimensional data query device obtains the next data. Until the multi-dimensional data query device obtains data C (corresponding to the first data in this application), it is determined that data C is the data in the first query table where the second dimension value is the second dimension value of data B, and the third dimension value is the third dimension value of data B, and the first dimension value is the boundary value of the first dimension query range. At this time, the multi-dimensional data query device determines data C in the second query table according to the pointer of data C, and obtains data along the second dimension direction in the second query table according to the second dimension query range. That is to say, when data C is obtained, the multi-dimensional data query device jumps from the first query table to the second query table and obtains data in the second query table according to the second dimension query range;

[0159] Further, the multi-dimensional data query device performs a second operation, which includes: obtaining data in the second query table according to the second dimension query range. When the multi-dimensional data query device obtains data D (corresponding to the second data in this application), it is determined that data D is the data in the second query table where the first dimension value is the first dimension value of data C, and the third dimension value is the third dimension value of data C, and the second dimension value is the boundary value of the second dimension query range. At this time, the multi-dimensional data query device determines data D in the first query table according to the pointer of data D, and obtains data in the second query table according to the first dimension query range. That is to say, when data D is obtained, the multi-dimensional data query device jumps from the second query table to the first query table and obtains data in the first query table according to the first dimension query range.

[0160] The multi-dimensional data query device repeatedly executes the first operation and the second operation until data E is obtained, and the multi-dimensional data query device determines data E in the third query table according to the pointer of data E. Data E is the last data within the first dimension query range and the second dimension query range when the third dimension value is value 1. Value 1 is the maximum or minimum value within the third dimension query range. When the third dimension is sorted in ascending order, this third value is the minimum value within the third dimension query range; when the third dimension is sorted in descending order, this third value is the maximum value within the third dimension query range;

[0161] Further, after the multi-dimensional data query device obtains data F in the third query table, according to the pointer of data F, the multi-dimensional data query device determines data F in the first query table. Herein, data F is the next data of data E in the third query table within the query range of the third dimension. Thus far, the multi-dimensional data query device repeatedly executes the first operation and the second operation until all data within the query ranges of the first dimension, the second dimension, and the third dimension are obtained.

[0162] It should be noted that the multi-dimensional data query method provided in the embodiments of the present application can also be applied to the query process of one-dimensional data. Specifically, the query request input by the user includes the first dimension and the query range of the first dimension. The multi-dimensional data query device obtains the query table finally sorted by the first dimension, and queries data from the query table according to the query range of the first dimension. Compared with the prior art, the multi-dimensional data query method provided in the present application avoids random access during data query through sorting, saving the time consumed for data query.

[0163] The database involved in the embodiments of the present application can be an in-memory database, a database of an external storage device, or a database stored in the non-volatile storage medium of the multi-dimensional data query device. The embodiments of the present application do not make any limitations in this regard.

[0164] In summary, the multi-dimensional data query method provided in the embodiments of the present application pre-constructs multiple query tables. The data in each query table is sorted according to different dimensions, and each query table is configured with a pointer, which is used to point to the data in other query tables. Further, when performing multi-dimensional data query, the multi-dimensional data query device realizes jumping between multiple query tables through the pointer, so as to continuously obtain all data within the query range. When querying data through the multi-dimensional data query method provided in the embodiments of the present application, the segmented continuity of data storage can be maintained, so that data can be quickly obtained, solving the problem of long time consumption caused by the need to perform a large amount of calculations to locate the query range on the space filling curve in the prior art. In addition, when querying data through the multi-dimensional data query method provided in the embodiments of the present application, it is not necessary to access data outside too many query ranges, and it is not necessary to perform random access, so the time consumed for multi-dimensional data query is further saved.

[0165] The above mainly introduces the solution provided by the embodiments of the present application from the perspective of methods. To implement the above functions, it includes the corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed in this article, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the way of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.

[0166] The embodiments of the present application can divide the function modules of the multi-dimensional data query device according to the above method examples. For example, each function module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of a software function module. It should be noted that the division of modules in the embodiments of the present application is illustrative, only a logical function division, and there can be other division methods in actual implementation.

[0167] As Figure 10 shown, it is a schematic structural diagram of a multi-dimensional data query device provided by the embodiments of the present application. The multi-dimensional data query device is used to construct a multi-dimensional data query table and perform multi-dimensional data queries, for example, for executing Figure 2 , Figure 6 or Figure 9 the methods shown. The multi-dimensional data query device may include an acquisition unit 101, a query unit 102, and a determination unit 103.

[0168] An acquisition unit 101 is configured to pre-acquire a first query table and a second query table, and to acquire a query request, where the query request includes a first dimension, a second dimension, a first dimension query range, and a second dimension query range. A query unit 102 is configured to sequentially access the first query table pre-acquired by the acquisition unit 101 according to the first dimension query range acquired by the acquisition unit 101. The acquisition unit 101 is further configured to acquire first data in the first query table. A determination unit 103 is configured to, when the acquisition unit 101 acquires the first data in the first query table, determine the first data in the second query table pre-acquired by the acquisition unit 101 according to the pointer of the first data in the first query table; where the first data in the first query table is the data at the boundary of the first dimension query range when the value of the second dimension in the first query table is a first value, and the first value is the minimum value or the maximum value of the second dimension query range. The query unit 102 is further configured to, when the determination unit 103 determines the first data in the second query table, sequentially access the second query table according to the second dimension query range acquired by the acquisition unit 101. The acquisition unit 101 is further configured to acquire second data in the second query table. The determination unit 103 is further configured to, when the acquisition unit 101 acquires the second data in the second query table, determine the second data in the first query table according to the pointer of the second data in the second query table; where the second data in the second query table is the data at the boundary of the second dimension query range when the value of the first dimension in the second query table is a second value, and the second value is the value of the first dimension of the first data.

[0169] For example, in combination with Figure 6 , the acquisition unit 101 may be configured to execute S601, the determination unit 103 may be configured to execute S602, and the query unit 102 is configured to execute S603.

[0170] Optionally, the data of the first query table and the second query table pre-acquired by the multi-dimensional data query device is continuous in the first dimension and the second dimension. The data in the first query table is first sorted sequentially according to the second dimension and then sorted sequentially according to the first dimension, and the data in the second query table is first sorted sequentially according to the first dimension and then sorted sequentially according to the second dimension. For each data in the first query table, the pointer of this data points to this data in the second query table, and for each data in the second query table, the pointer of this data points to this data in the first query table.

[0171] Optionally, the multi-dimensional data query device further includes a generation unit 100. The generation unit 100 is configured to first sort the data in the database in sequence according to the second dimension, and then sort the data in sequence according to the first dimension to obtain a first query table; copy the first query table, and first sort the data in the copied first query table in sequence according to the first dimension, and then sort the data in sequence according to the second dimension to obtain a second query table. Alternatively, the generation unit 100 is configured to first sort the data in the database in sequence according to the first dimension, and then sort the data in sequence according to the second dimension to obtain a second query table; copy the second query table, and first sort the data in the copied second query table in sequence according to the second dimension, and then sort the data in sequence according to the first dimension to obtain a first query table. Alternatively, the generation unit 100 is configured to copy the data in the database; first sort the data in sequence according to the second dimension, and then sort the data in sequence according to the first dimension to obtain a first query table; first sort the copied data in sequence according to the first dimension, and then sort the data in sequence according to the second dimension to obtain a second query table.

[0172] For example, in combination with Figure 2 , the generation unit 100 may be configured to execute S204.

[0173] Optionally, the determination unit 103 is further configured to determine, according to the first dimension query range and the second dimension query range obtained by the acquisition unit 101, that the priority of the first dimension is the first priority, the priority of the second dimension is the second priority, and the first priority is higher than the second priority; and, according to the first priority, determine to obtain data starting from the first query table.

[0174] Optionally, the determination unit 103 is specifically configured to determine that the number of values of the first dimension in the first dimension query range is greater than the number of values of the second dimension in the second dimension query range; and determine that the priority of the first dimension is the first priority and the priority of the second dimension is the second priority.

[0175] Of course, the multi-dimensional data query device provided in the embodiments of the present application includes but is not limited to the above units. For example, the multi-dimensional data query device may further include a storage unit 104. The storage unit 104 may be configured to store the program code of the multi-dimensional data query device, and may also be configured to store the data obtained by the multi-dimensional data query device during operation, such as the first query table and the second query table, etc.

[0176] As an example, in combination with Figure 1 , the functions implemented by the acquisition unit 101, the query unit 102, and the determination unit 103 in the multi-dimensional data query device are the same as those of the Figure 1 processor 11, and the function implemented by the storage unit 104 is the same as that of the Figure 1 memory 12.

[0177] The embodiments of the present application further provide a chip system, such asFigure 11 As shown, the chip system includes at least one processor 111 and at least one interface circuit 112. The processor 111 and the interface circuit 112 can be interconnected by lines. For example, the interface circuit 112 can be used to receive signals from other devices (such as the memory of a multi-dimensional data query device). For another example, the interface circuit 112 can be used to send signals to other devices (such as the processor 111). Exemplarily, the interface circuit 112 can read instructions stored in the memory and send the instructions to the processor 111. When the instructions are executed by the processor 111, the multi-dimensional data query device can be made to execute each step in the above embodiments. Of course, the chip system can also include other discrete devices, and the embodiments of the present application do not make specific limitations in this regard.

[0178] Another embodiment of the present application also provides a computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions run on a multi-dimensional data query device, the multi-dimensional data query device executes each step executed by the multi-dimensional data query device in the method flow shown in the above method embodiment.

[0179] In some embodiments, the disclosed method can be implemented as computer program instructions encoded in a computer-readable storage medium in a machine-readable format or encoded in other non-transitory media or articles.

[0180] Figure 12 Schematically shows a conceptual partial view of a computer program product provided by an embodiment of the present application. The computer program product includes a computer program for executing a computer process on a computing device.

[0181] In one embodiment, the computer program product is provided using a signal-bearing medium 120. The signal-bearing medium 120 can include one or more program instructions, which when run by one or more processors can provide the functions or partial functions described above for Figure 2 、 Figure 6 or Figure 9 described. Thus, for example, one or more features of S601 to S603 in Figure 6 can be borne by one or more instructions associated with the signal-bearing medium 120. In addition, Figure 12 the program instructions in also describe example instructions.

[0182] In some examples, the signal-bearing medium 120 can include a computer-readable medium 121, such as but not limited to, a hard disk drive, a compact disc (CD), a digital video disc (DVD), a digital tape, a memory, a read-only memory (ROM), or a random access memory (RAM), etc.

[0183] In some embodiments, the signal-bearing medium 120 may include a computer-readable recording medium 122 such as, but not limited to, a memory, a read / write (R / W) CD, an R / W DVD, and the like.

[0184] In some embodiments, the signal-bearing medium 120 may include a communication medium 123 such as, but not limited to, digital and / or analog communication media (e.g., fiber optic cables, waveguides, wired communication links, wireless communication links, and the like).

[0185] The signal-bearing medium 120 may be conveyed by a wireless form of the communication medium 123 (e.g., a wireless communication medium compliant with the IEEE 802.11 standard or other transmission protocols). One or more program instructions may be, for example, computer-executable instructions or logic-implemented instructions.

[0186] In some examples, such as for Figure 2 、 Figure 6 or Figure 9 the multi-dimensional data query device described may be configured to provide various operations, functions, or actions in response to one or more program instructions via the computer-readable medium 121, the computer-readable recording medium 122, and / or the communication medium 123.

[0187] It should be understood that the arrangements described herein are for illustrative purposes only. Thus, those skilled in the art will understand that other arrangements and other elements (e.g., machines, interfaces, functions, orders, and groups of functions, etc.) can be used instead, and some elements may be omitted altogether depending on the desired results. Additionally, many of the elements described can be implemented as discrete or distributed components, or as functional entities combined with other components in any suitable combination and location.

[0188] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using a software program, 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 instructions. When the computer execution instructions are loaded and executed on a computer, the processes or functions according to the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center in a wired manner (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wirelessly (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that contains one or more media integrated therein. The available medium can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)), etc.

[0189] As described above, this is only the specific implementation manner of the present application. Those skilled in the art of this technology can think of variations or substitutions according to the specific implementation manner provided by the present application, and all should be covered within the protection scope of the present application.

Claims

1. A multi-dimensional data query method, characterized in that, Including: Obtain a query request, where the query request includes a first dimension, a second dimension, a first dimension query range, and a second dimension query range; In a pre-obtained first query table and a second query table, access the first query table in sequence according to the first dimension query range; when obtaining first data in the first query table, determine the first data in the second query table according to the pointer of the first data in the first query table, and access the second query table in sequence according to the second dimension query range; wherein, the first data in the first query table is: the data at the boundary of the first dimension query range when the value of the second dimension in the first query table is a first value; the first value is the minimum or maximum value of the second dimension query range; When obtaining second data in the second query table, determine the second data in the first query table according to the pointer of the second data in the second query table, and access the first query table in sequence according to the first dimension query range; wherein, the second data in the second query table is: the data at the boundary of the second dimension query range when the value of the first dimension in the second query table is a second value; the second value is the value of the first dimension of the first data.

2. The multi-dimensional data query method according to claim 1, characterized in that The data in the pre-obtained first query table and second query table is continuous in the first dimension and the second dimension; The data in the first query table is first sorted in sequence according to the second dimension, and then sorted in sequence according to the first dimension, and the data in the second query table is first sorted in sequence according to the first dimension, and then sorted in sequence according to the second dimension; For each data in the first query table, the pointer of this data points to this data in the second query table, and for each data in the second query table, the pointer of this data points to this data in the first query table.

3. The multi-dimensional data query method according to claim 2, characterized in that, The multi-dimensional data query method further includes: Sort the data in the database first in sequence according to the second dimension, and then in sequence according to the first dimension to obtain the first query table; copy the first query table, and sort the data in the copied first query table first in sequence according to the first dimension, and then in sequence according to the second dimension to obtain the second query table; Or, Sort the data in the database first in sequence according to the first dimension, and then in sequence according to the second dimension to obtain the second query table; copy the second query table, and sort the data in the copied second query table first in sequence according to the second dimension, and then in sequence according to the first dimension to obtain the first query table; Or, Copy the data in the database; sort the data in the database first in sequence according to the second dimension, and then in sequence according to the first dimension to obtain the first query table; sort the copied data first in sequence according to the first dimension, and then in sequence according to the second dimension to obtain the second query table.

4. The multi-dimensional data query method according to any one of claims 1-3, characterized in that, The multi-dimensional data query method further includes: Based on the first - dimension query range and the second - dimension query range, determine that the priority of the first dimension is the first priority, the priority of the second dimension is the second priority, and the first priority is higher than the second priority; Based on the first priority, determine to obtain data starting from the first query table.

5. The multi-dimensional data query method according to claim 4, wherein The determining that the priority of the first dimension is the first priority and the priority of the second dimension is the second priority based on the first - dimension query range and the second - dimension query range includes: Determine that the number of values of the first dimension in the first - dimension query range is greater than the number of values of the second dimension in the second - dimension query range; Determine that the priority of the first dimension is the first priority and the priority of the second dimension is the second priority.

6. A multi-dimensional data query device, characterized in that, The multi - dimensional data query device includes: An acquisition unit, configured to pre - acquire a first query table and a second query table, and to acquire a query request, where the query request includes a first dimension, a second dimension, a first - dimension query range, and a second - dimension query range; A query unit, configured to sequentially access the first query table pre - acquired by the acquisition unit according to the first - dimension query range acquired by the acquisition unit; The acquisition unit is further configured to acquire first data in the first query table; A determination unit, configured to, when the acquisition unit acquires first data in the first query table, determine the first data in the second query table pre - acquired by the acquisition unit according to the pointer of the first data in the first query table; where the first data in the first query table is: the data at the boundary of the first - dimension query range when the value of the second dimension in the first query table is the first value; the first value is the minimum value or the maximum value of the second - dimension query range; The query unit is further configured to, when the determination unit determines the first data in the second query table, sequentially access the second query table according to the second - dimension query range acquired by the acquisition unit; The acquisition unit is further configured to acquire second data in the second query table; The determination unit is further configured to, when the acquisition unit acquires second data in the second query table, determine the second data in the first query table according to the pointer of the second data in the second query table; where the second data in the second query table is: the data at the boundary of the second - dimension query range when the value of the first dimension in the second query table is the second value; the second value is the value of the first dimension of the first data.

7. The multi-dimensional data query device according to claim 6, characterized in that, The pre - acquired first query table and second query table are continuous in data in the first dimension and the second dimension; The data in the first query table is first sorted in sequence according to the second dimension and then sorted in sequence according to the first dimension, and the data in the second query table is first sorted in sequence according to the first dimension and then sorted in sequence according to the second dimension; For each data in the first query table, the pointer of this data points to the corresponding data in the second query table; for each data in the second query table, the pointer of this data points to the corresponding data in the first query table.

8. The multi-dimensional data query device according to claim 7, wherein, The multidimensional data query device further includes a generating unit; The generating unit is configured to: Sort the data in the database first in sequence according to the second dimension and then in sequence according to the first dimension to obtain the first query table; copy the first query table, and sort the data in the copied first query table first in sequence according to the first dimension and then in sequence according to the second dimension to obtain the second query table; Or, Sort the data in the database first in sequence according to the first dimension and then in sequence according to the second dimension to obtain the second query table; copy the second query table, and sort the data in the copied second query table first in sequence according to the second dimension and then in sequence according to the first dimension to obtain the first query table; Or, Copy the data in the database; sort the data first in sequence according to the second dimension and then in sequence according to the first dimension to obtain the first query table; sort the copied data first in sequence according to the first dimension and then in sequence according to the second dimension to obtain the second query table.

9. The multidimensional data query device according to any one of claims 6-8, wherein The determining unit is further configured to determine, according to the first dimension query range and the second dimension query range obtained by the obtaining unit, that the priority of the first dimension is the first priority, the priority of the second dimension is the second priority, and the first priority is higher than the second priority; and, according to the first priority, determine to obtain data starting from the first query table.

10. The multidimensional data query device according to claim 9, wherein The determining unit is specifically configured to determine that the number of values of the first dimension in the first dimension query range is greater than the number of values of the second dimension in the second dimension query range; and determine that the priority of the first dimension is the first priority and the priority of the second dimension is the second priority.

11. A multi-dimensional data query device, characterized in that, Comprising: A memory and one or more processors; The memory is coupled to the processor; The memory is used to store computer program code, and the computer program code includes computer instructions. When the computer instructions are executed by the multidimensional data query device, the multidimensional data query device is caused to execute the multidimensional data query method according to any one of claims 1-5.

12. A chip system, characterized in that, The chip system is applied to a multidimensional data query device; the chip system includes one or more interface circuits and one or more processors; The interface circuit and the processor are interconnected by a line; the interface circuit is configured to receive a signal from the memory of the multi-dimensional data query device and send the signal to the processor, and the signal includes computer instructions stored in the memory; when the processor executes the computer instructions, the multi-dimensional data query device executes the multi-dimensional data query method according to any one of claims 1-5.

13. A computer-readable storage medium, characterized in that, It includes computer instructions, and when the computer instructions run on the multi-dimensional data query device, the multi-dimensional data query device is enabled to implement the multi-dimensional data query method according to any one of claims 1-5.

14. A computer program product, characterized in that, When the computer program product runs on a computer, the computer is enabled to execute the multi-dimensional data query method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Indexing method for power dispatching automation mass messages

    CN104504030A

  • Data query method and related device

    CN110309181A