Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
FIG. 1 is a diagram illustrating the main steps of a multidimensional data query method according to an embodiment of the present invention. As a reference embodiment of the present invention, as shown in fig. 1, the main steps of the multidimensional data query method of the embodiment of the present invention may include:
step S101: establishing a dimension retrieval table according to the fact table and a dimension table related to the fact table, and adding a composite index of the dimension retrieval table;
step S102: according to at least one dimension query condition in the query request, querying in a dimension retrieval table by using a composite index, and determining a target data primary key;
step S103: and inquiring the fact table according to the target data main key to obtain the data to be inquired in the inquiry request.
The core thought of the multidimensional data query of the invention is as follows: step S101 establishes a dimension search table corresponding to the fact table, step S102 performs query in the dimension search table to obtain a target data primary key, and step S103 queries the fact table by using the obtained target data primary key to obtain data to be queried. The fact table in the invention needs to be determined according to the query request, if the result is queried in the query request, the result table is the fact table, if the personal information is queried in the query request, the personal information table is the fact table, and the dimension retrieval table corresponding to the fact table refers to the fact table and the dimension table related to the fact table, which are processed to obtain the dimension retrieval table.
It should be noted that a dimension table is a dimension of a fact table, and there are two types of fields of a dimension (i.e., a field of an attribute class) and a fact (i.e., a field which states a fact class, and is usually numerical data) in the fact table, for example, in an achievement table, students (individuals), disciplines, scholars, and the like are dimensions, and achievements are facts. Therefore, whether the dimension table is a fact table can be judged according to whether the dimension table has a fact field. In the present invention, if an aggregation calculation (sum, mean, maximum, minimum, etc.) can be performed on a field, it can be determined that the field is a fact field. For example, the personal information table has an age field, if there is a need to summarize the maximum age and the average age, the age is both dimension and fact, and accordingly, the personal information table is either a dimension table or a fact table. It should be noted that, in the personal information table, the age field may also be extended to an extended attribute of the age field, for example, a dimension table may be defined for the age, such as defining that the age is 2 to 3 years old, 4 to 8 years old, 9 to 18 years old, and so on, so that the dimension of the age group may be extended by the age attribute (dimension) of the personal dimension of the score table. In summary, the personal information table may be a fact table, or may be a dimension of the achievement table, which is equivalent to a single dimension table. In the invention, the individual dimension table is associated with the fact table, the dimension in the dimension table is associated with the fact table, and the dimension in the dimension table is uniformly stored in the dimension retrieval table, for example, the personal information table and the achievement table can be associated through names.
As an important technical point of the present invention, the dimension table is created in step S101 by using the fact table and the dimension table. All dimension information of the fact table is saved in the dimension retrieval table. In addition, there are some dimension tables related to the fact table around the fact table, and the information of these dimension tables also needs to be stored in the dimension search table. For example, attribute dimensions such as gender and age in a personal information table (dimension table) of a result table (fact table) are also stored in a dimension search table, and the stored data primary key is the corresponding data primary key in the result table.
The dimension retrieval table comprises a dimension name, a dimension value and a data primary key, wherein the data primary key is a unique identifier of a group of data in a fact table or a dimension table, such as a row number, a serial number and the like. FIG. 2 is a schematic diagram of a main flow for building a dimension lookup table according to another exemplary embodiment of the present invention. As shown in fig. 2, a specific process of building the dimension search table, that is, acquiring information in the dimension search table, may include step S201, step S202, and step S203.
Step S201: determining a fact table and a dimension table related to the fact table, taking a student achievement table of a high and middle grade as an example of the fact table, wherein the dimension table related to the fact table is a student information table of the high and middle grade and a student role information table of the high and middle grade, wherein table 1 is the student achievement table of the high and middle grade, table 2 is the student information table of the high and middle grade, and table 3 is the student role information table of the high and middle grade, students of the 3 tables are the same, and the student information table of table 2 can be used as a personal information dimension in table 1, and the student role information table of table 3 can be used as a role information dimension in table 1, so that the 3 tables are related, and for table 1, table 2 and table 3 can be regarded as separate dimension tables.
TABLE 1 high school grade student achievement table
Table 2 is a high school grade student information table
Table 3 shows the information of the jobs of students in the first grade of senior high school
Step S202: and storing the dimension name, the dimension value and the data main key information in the fact table into a dimension retrieval table, wherein the dimension name refers to the name of a storage dimension field, the dimension value refers to the numerical value of a storage specific dimension, and the stored data main key refers to the unique identification of each group of data in the fact table. The specific method for storing the information in the fact table into the dimension retrieval table is to store the dimension name, the dimension value corresponding to the dimension name and the data primary key of the fact table data in the fact table into the dimension retrieval table according to the fact table data in the fact table. As shown in the student performance fact table of the higher, middle and upper grades in table 1, the unique identifier of each line of data in table 1 is used as the data primary key information, and in table 1, 2 and 3 are the data primary key information. It can also be seen from table 1 that the chinese achievement level, the math achievement level, the english achievement level, the text achievement level, and the summary achievement level are dimension names. The dimension name of each line of data in table 1, the dimension value corresponding to the dimension name, and the data primary key corresponding to the line of data are stored in the dimension search table, so as to obtain the dimension search table shown in table 4.
Table 4 is the dimension search table corresponding to Table 1
Step S203: the method comprises the steps of storing information of a dimension table related to a fact table into a dimension retrieval table, and storing a dimension name in a group of dimension table data, a dimension value corresponding to the dimension name and a data main key in the fact table corresponding to the group of dimension table data into the dimension retrieval table according to the group of dimension table data in the dimension table. As can be seen from tables 1, 2 and 3, the students in the three tables are the same, and by taking the information data of the classmates a in table 2 as an example, the information data of the classmates a corresponds to the result information table of the classmates a in table 1, so if the dimension search table is established by taking table 1 as the fact table, the data primary key information corresponding to the information data of the classmates a in table 2 is 1. Therefore, the dimension name of each line of data in the student information table at the first grade of table 2 and the student job information table at the first grade of table 3, the dimension value corresponding to the dimension name, and the data primary key corresponding to the line of data are stored in the dimension search table, so that the dimension search table shown in table 5 is obtained.
Table 5 is a dimension search table corresponding to tables 2 and 3
It should be noted that, for convenience of description, the dimension search table 4 and the dimension search table 5 in the above example are divided into two tables for explanation, but the dimension search table obtained from the fact table and the dimension search table obtained from the dimension table in the present invention should be merged into one dimension search table. Further, in the above description of the fact table and the dimension table, it is mentioned that the dimension table in the present invention is one dimension of the fact table, but the dimension table itself may also be one fact table. Taking a student score table of the first grade of high school in table 1, a student information table of the first grade of high school in table 2 and a student job table of the first grade of high school in table 3 as an example, during multidimensional data analysis, the class ranking field of table 1 can be subjected to aggregation calculation, for example, the maximum value is obtained, so that table 1 can be a fact table; the age field in table 2 may also be aggregated, such as by averaging the ages, and thus table 2 may also be a fact table. In order to distinguish the dimension tables corresponding to different fact tables, a field representing the name of the fact table may be added to the dimension table, as shown in tables 6 and 7.
When table 6 is the fact table 1, the corresponding dimension search table, that is, table 6 is the dimension search table established by using the student achievement table of the first higher, middle and upper grade of table 1 as the fact table, and using the student information table of the first higher, middle and upper grade of table 2 and the student job table of the first higher, middle grade of table 3 as the dimension table. When table 7 is the fact table 2, the corresponding dimension search table, that is, table 7 is the dimension search table established by using the information table of students in the higher, middle and upper grades of table 2 as the fact table, and using the score table of students in the higher, middle and upper grades of table 1 and the job table of students in the higher, middle and upper grades of table 3 as the dimension table. It should be noted that, in table 2, the primary data key corresponding to the first-level student information table in the high school, the first-level student information table in the first. Here, table 6 and table 7 are described in a split manner, and the present invention can merge table 6 and table 7 into one dimension search table, so that the dimension search tables of all fact tables can be merged into one dimension search table only by adding name fields of the fact tables in the dimension search table, and thus, unified management of dimensions can be achieved.
Table 6 shows a dimension table corresponding to the fact table shown in Table 1
Table 7 shows a dimension table corresponding to the fact table shown in Table 2
After the dimension table is created, the composite index of the dimension table is also added in step S101. The index is equivalent to a directory, the rechecking index is an index consisting of a plurality of fields, the dimension name field, the dimension value field and the data main key field are stored in the dimension retrieval table, the composite index can be established according to the three fields, the number of the indexes cannot be increased along with the increase of the number of the dimensions, and in addition, the addition of the composite index can improve the query efficiency of the dimension retrieval table. For example, the order of the dimension search table in table 4 and table 5 is the dimension name, the dimension value, and the data key, so the present invention can establish the composite index of the dimension search table according to the order of the dimension name field, the dimension value field, and the data main key field stored in the dimension search table.
The dimension search table is used as an important technical point of the invention and is laid down for the operation of subsequent multidimensional data query, so that how to query data by using the dimension search table is another important technical point of the invention. In step S102, after the query request is obtained, the composite index may be used to perform query in the dimension search table according to the dimension query condition in the query request, so as to obtain the target data primary key corresponding to the query request. FIG. 3 is a schematic diagram of a main flow for determining a primary key of target data according to still another embodiment of the present invention. As shown in fig. 3, the main flow of determining the primary key of the target data of the present invention may include step S301, step S302, and step S303.
Step S301: receiving an inquiry request, wherein the inquiry request comprises at least one dimension inquiry condition and data to be inquired, for example, inquiring the grade ranking of students with English score level B and belonging class one class, and the inquiry request comprises two dimension inquiry conditions of English score level B and belonging class one class, and the data to be inquired is the grade ranking. It should be noted here that, in the multidimensional data query analysis, aggregation calculation is usually performed on data according to dimensions, if aggregation calculation is not performed on data, only simple query data details are used, and the meaning is not great, considering that the above table is only described by simply taking information of three classmates of "a, b, c" and c "as examples, and does not list many pieces of information, for convenience of understanding, the query request provided here is to query the rank of the rank, but in practical applications, the data to be queried in the multidimensional data query is data obtained by performing aggregation calculation on the fact fields in the fact table, for example, the maximum value or the minimum value of the rank is required.
Step S302: and generating a query data primary key set corresponding to the query request according to at least one dimension query condition. In this embodiment of the present invention, generating the query data primary key set corresponding to the query request may include: inquiring in a dimension retrieval table aiming at one dimension inquiry condition in at least one dimension inquiry condition, and determining a data main key corresponding to a dimension value meeting the dimension inquiry condition as an inquiry data main key; and generating a query data primary key set corresponding to the query request according to the query data primary key. For example, the two dimension query conditions are that the english score level is B and the class to which the query data belongs is one class, the first dimension query condition is analyzed for the english score level B, the query is performed in the dimension search table to obtain the english score level B corresponding to the data primary key 1 and the data primary key 2, the second dimension query condition is analyzed for the class to which the query data belongs, the query is performed in the dimension search table to obtain the class to which the data primary key 2 and the data primary key 3 correspond, and therefore the query data primary key set is obtained as follows: 1. 2, 2 and 3.
Step S303: and selecting a target data primary key from the query data primary key set according to the condition number of at least one dimension query condition. The main process of selecting the target data primary key from the query data primary key set in the invention can comprise the following steps: determining the condition number of at least one dimension query condition; grouping query data main keys in a query data main key set to obtain at least one group of query data main keys, wherein the query data main keys in each group of query data main keys are the same; and aiming at one group of query data main keys in at least one group of query data main keys, if the number of the query data main keys in the group of query data main keys is the same as the conditional number, determining the query data main keys in the group of query data main keys as target data main keys. After the target data primary key is acquired in step S102, the required data is queried in the fact table according to the queried target data primary key.
Specifically, if the grade ranking of the english score is B and the grade ranking of the student belonging to the class is one class is queried, the number of the dimension query conditions in the query request is 2, and then the query data primary key set obtained in step S302 is: 1. 2, 2 and 3. Next, query data primary keys in the query data primary key set are grouped, and the same query data primary keys are put together, so that 3 groups are obtained, wherein the 1 st group query data primary key is 1, the 2 nd group query data primary keys are 2 and 2, and the 3 rd group query data primary key is 3. Then, the number of the query data primary keys in the 2 nd group is counted to be 2, and is the same as the condition number 2, so that the data primary key 2 is determined to be the target data primary key. Finally, in the student achievement table of the first grade of senior high school in table 1, the grade ranking corresponding to the query data primary key of 3 is 62.
The following illustrates a multidimensional data query method in connection with a specific computer sentence.
Case 1, the multi-dimensional combined query is performed on the dimensions of the student achievement table of the first grade of high school in table 1. And (3) inquiring request: and inquiring the class ranking corresponding to the Chinese achievement level A, the English achievement level B and the literary achievement level B. The multidimensional data query method of the invention is adopted to obtain:
firstly, inquiring in a dimension retrieval table according to dimension conditions, and saving the result in a temporary table.
And secondly, grouping the temporary table _ dimension query results according to the data primary keys, summarizing the number of data queried by each data primary key, selecting the data primary key with the data number same as the condition number, and saving the data primary key in a new temporary table. Since the number of the dimension query conditions is 3, COUNT (×) is taken to be 3.
And thirdly, using the data primary key list in the temporary table _ data primary key result to inquire the class ranking in the student score table of the senior, middle and first grade in the table 1.
Case 2, multi-dimensional combined query is performed on dimensions on the student achievement table of the first grade in the top of table 1 and the student information table of the first grade in the top of table 2. And (3) inquiring request: and inquiring the class ranking corresponding to the Chinese achievement level A, the English achievement level B, the literary achievement level B and the Chinese family. The query method of case 2 is similar to that of case 1, and only the query of the condition part and the number of conditions need to be modified. The query of the three steps together is as follows:
FIG. 4 is a schematic main flow chart of a multidimensional data query method according to still another referential embodiment of the present invention. As shown in fig. 4, the multidimensional data query method of the present invention mainly includes:
step S401: determining a fact table and a dimension table related to the fact table;
step S402: storing information in a fact table into a dimension retrieval table, wherein the specific implementation method is that for a group of fact table data in the fact table, a dimension name in the group of fact table data, a dimension value corresponding to the dimension name, and a data primary key of the group of fact table data are stored into the dimension retrieval table;
step S403: storing information of a dimension table related to a fact table into a dimension retrieval table, storing a dimension name in a group of dimension table data, a dimension value corresponding to the dimension name and a data primary key in the fact table corresponding to the group of dimension table data into the dimension retrieval table aiming at a group of dimension table data in the dimension table, and storing the name of the dimension table into the dimension retrieval table;
step S404: establishing a composite index of the dimension retrieval table according to a dimension name field, a dimension value field and a data main key field stored in the dimension retrieval table;
step S405: receiving a query request, determining the number of conditions of a dimension query condition in the query request, and further comprising what data needs to be queried in the query request;
step S406: determining query data primary keys corresponding to each dimension query, where the query data primary keys constitute a query data primary key set corresponding to the query request, where a specific process of determining the query data primary keys corresponding to each dimension query is specifically explained in step S302 above, and is not repeated here;
step S407: grouping query data main keys in a query data main key set to obtain at least one group of query data main keys, wherein the query data main keys in each group of query data main keys are the same;
step S408: selecting a group of query data main keys from at least one group of query data main keys, wherein the number of the query data main keys in the selected group of query data main keys is the same as the number of the conditions;
step S409: and determining the data main key in the group of selected query data main keys as a target data main key, and querying data corresponding to the target data main key in the fact table by using the composite index to obtain the data to be queried in the query request.
According to the technical scheme of the multi-dimensional data query, the problem of multiple indexes due to multiple dimensions is solved by adopting the technical means of the dimension retrieval table and adding the compound index in the dimension retrieval table, the data can be quickly retrieved only by creating a small number of indexes, the number of the indexes is not increased along with the increase of the number of the dimensions, the dimension retrieval table can be used for uniformly managing the dimension data, and the dimension management complexity is reduced. According to the invention, the data main key field is established in the dimension retrieval table, and the data main key corresponding to the dimension value meeting the dimension query condition can be counted when the multidimensional data is queried, so that the data main key corresponding to the data to be queried in the query request can be obtained by means of the counted number of the data main keys, and the effect of obtaining the required data is achieved.
Fig. 5 is a schematic diagram of main blocks of a multidimensional data query device according to an embodiment of the present invention. As shown in fig. 5, the multidimensional data query device 500 according to the embodiment of the present invention mainly includes the following modules: a building module 501, a determining module 502 and a querying module 503. Wherein,
the setup module 501 may be configured to: establishing a dimension retrieval table according to the fact table and a dimension table related to the fact table, and adding a composite index of the dimension retrieval table;
the determination module 502 may be configured to: according to at least one dimension query condition in the query request, querying in a dimension retrieval table by using a composite index, and determining a target data primary key;
the query module 503 may be configured to: and inquiring the fact table according to the target data main key to obtain the data to be inquired in the inquiry request.
In this embodiment of the present invention, the establishing module 501 may further be configured to:
determining a fact table and a dimension table related to the fact table;
storing a dimension name, a dimension value corresponding to the dimension name and a data primary key of a group of fact table data in a dimension retrieval table aiming at a group of fact table data in a fact table;
and storing the dimension name in the group of dimension table data, the dimension value corresponding to the dimension name and the data main key in the fact table corresponding to the group of dimension table data into a dimension retrieval table according to the group of dimension table data in the dimension table.
In this embodiment of the present invention, the determining module 502 may further be configured to:
receiving a query request, wherein the query request comprises at least one dimension query condition;
generating a query data primary key set corresponding to the query request according to at least one dimension query condition;
and selecting a target data primary key from the query data primary key set according to the condition number of at least one dimension query condition.
In this embodiment of the present invention, the determining module 502 may further be configured to:
inquiring in a dimension retrieval table aiming at one dimension inquiry condition in at least one dimension inquiry condition, and determining a data main key corresponding to a dimension value meeting the dimension inquiry condition as an inquiry data main key;
and generating a query data primary key set corresponding to the query request according to the query data primary key.
In this embodiment of the present invention, the determining module 502 may further be configured to:
determining the condition number of at least one dimension query condition;
grouping query data main keys in a query data main key set to obtain at least one group of query data main keys, wherein the query data main keys in each group of query data main keys are the same;
and aiming at one group of query data main keys in at least one group of query data main keys, if the number of the query data main keys in the group of query data main keys is the same as the conditional number, determining the query data main keys in the group of query data main keys as target data main keys.
In this embodiment of the present invention, the establishing module 501 may further be configured to: and establishing a composite index of the dimension retrieval table according to the dimension name field, the dimension value field and the data main key field stored in the dimension retrieval table.
From the above description, it can be seen that the multidimensional data query device of the invention can adopt the technical means of the dimension search table and adding the compound index in the dimension search table, thereby overcoming the problem of multiple indexes caused by multiple dimensions, realizing the rapid search of data only by creating a small number of indexes, and the number of indexes is not increased along with the increase of the number of dimensions, and also uniformly managing the dimension data by using the dimension search table, thereby reducing the complexity of dimension management. According to the invention, the data main key field is established in the dimension retrieval table, and the data main key corresponding to the dimension value meeting the dimension query condition can be counted when the multidimensional data is queried, so that the data main key corresponding to the data to be queried in the query request can be obtained by means of the counted number of the data main keys, and the effect of obtaining the required data is achieved.
Fig. 6 illustrates an exemplary system architecture 600 of a multidimensional data query method or a multidimensional data query apparatus to which embodiments of the present invention may be applied.
As shown in fig. 6, the system architecture 600 may include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 serves to provide a medium for communication links between the terminal devices 601, 602, 603 and the server 605. Network 604 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 601, 602, 603 to interact with the server 605 via the network 604 to receive or send messages or the like. The terminal devices 601, 602, 603 may have installed thereon various communication client applications, such as shopping applications, web browser applications, search applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 601, 602, 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 605 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 601, 602, 603. The backend management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (for example, target push information, product information — just an example) to the terminal device.
It should be noted that the multidimensional data query method provided by the embodiment of the present invention is generally executed by the server 605, and accordingly, the multidimensional data query device is generally disposed in the server 605.
It should be understood that the number of terminal devices, networks, and servers in fig. 6 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 7, shown is a block diagram of a computer system 700 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 7 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 7, the computer system 700 includes a Central Processing Unit (CPU)701, which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data necessary for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
The following components are connected to the I/O interface 705: an input portion 706 including a keyboard, a mouse, and the like; an output section 707 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 708 including a hard disk and the like; and a communication section 709 including a network interface card such as a LAN card, a modem, or the like. The communication section 709 performs communication processing via a network such as the internet. A drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read out therefrom is mounted into the storage section 708 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 709, and/or installed from the removable medium 711. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 701.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a setup module, a determination module, and a query module. The names of these modules do not in some cases form a limitation on the module itself, for example, the creating module may also be described as a module that creates a dimension table according to a fact table and a dimension table related to the fact table, and adds a composite index to the dimension table.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: establishing a dimension retrieval table according to the fact table and a dimension table related to the fact table, and adding a composite index of the dimension retrieval table; according to at least one dimension query condition in the query request, querying in a dimension retrieval table by using a composite index, and determining a target data primary key; and inquiring the fact table according to the target data main key to obtain the data to be inquired in the inquiry request.
According to the technical scheme of the embodiment of the invention, the technical means of adopting the dimension retrieval table and adding the compound index in the dimension retrieval table can be adopted, the problem of multiple indexes caused by multiple dimensions is solved, the rapid retrieval of data can be realized only by creating a small number of indexes, the number of the indexes is not increased along with the increase of the number of the dimensions, the dimension retrieval table can be used for uniformly managing the dimension data, and the complexity of dimension management is reduced. According to the invention, the data main key field is established in the dimension retrieval table, and the data main key corresponding to the dimension value meeting the dimension query condition can be counted when the multidimensional data is queried, so that the data main key corresponding to the data to be queried in the query request can be obtained by means of the counted number of the data main keys, and the effect of obtaining the required data is achieved.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.