The content of the invention
The embodiment of the present application provides a kind of querying method and device of mass data multidimensional analysis, to solve prior art
In when on-line analytical processing be based on the form of relevant database to carry out the storage of multidimensional data with inquiry when, search efficiency
It is relatively low, and when on-line analytical processing be based on the form of multidimensional data organization to carry out the storage of multidimensional data with inquiry when, in advance
First exhaustion goes out all of dimension and the huge problem of caused amount of calculation.
The embodiment of the present application provides a kind of querying method of mass data multidimensional analysis, including:
The inquiry request for carrying dimensional information to be checked that receive user sends, wherein, the dimensional information includes:
Dimension name and dimension values;
According to the dimensional information, the corresponding data of the dimensional information are inquired about in the subcube tables for pre-building;
When the corresponding data of the dimensional information are inquired, then user is returned data to;When not inquiring the dimension
The corresponding data of information, then in the cube tables for pre-building inquire about the corresponding data of the dimensional information, return data to
User, and the dimension name that the dimensional information is included is acquired as overall, wherein, the subcube tables are by cube
Part row synthesis in table.
Preferably, the Query Information for carrying dimension name to be checked of user is obtained in advance, according to the dimension name, is looked into
The corresponding data of dimension name are ask, according to the dimension name and the corresponding data of dimension name, subcube tables is set up.
Preferably, when the data in the cube tables for pre-building occur to update, methods described also includes:Pre-building
Cube tables in obtain the data for occurring to update, the data to getting carry out dimension-reduction treatment, by the data after dimension-reduction treatment more
Newly to the subcube tables for pre-building.
Preferably, for arbitrary data for getting, it is determined that comprising the dimension name corresponding at least one data
Subcube tables, and subcube tables are determined for arbitrary, it is right with the subcube tables institute that the dimension corresponding to the data is dropped to
The dimension answered is consistent, and dimension values identical data corresponding with the data are searched in subcube tables;When finding out and the number
According to corresponding dimension values identical data, then data are merged, it is identical with the corresponding dimension values of the data when not finding out
Data, then be directly appended to subcube tables.
Preferably, methods described also includes:In special time, in special time, will be gathered comprising dimension name
Dimension combination in identical be classified as one group, count each group in gathered comprising dimension name dimension combination number of times, in institute
In the case that the number of times of the combination of the dimension comprising dimension name of collection exceedes default threshold value, newly-built subcube tables, and advance
The dimension is inquired about in the cube tables of foundation and combines the included corresponding data of dimension name, the dimension is combined into included dimension
The corresponding dimension values identical data of name are merged, and are added to newly-built subcube tables.
The embodiment of the present application provides a kind of inquiry unit of mass data multidimensional analysis, including:
Receiver module, for the inquiry request for carrying dimensional information to be checked that receive user sends, wherein, it is described
Dimensional information includes:Dimension name and dimension values;
Enquiry module, for according to the dimensional information, inquiring about the dimensional information in the subcube tables for pre-building
Corresponding data;
Data return module, for when the corresponding data of the dimensional information are inquired, then returning data to user;When
The corresponding data of the dimensional information are not inquired, then the corresponding number of the dimensional information is inquired about in the cube tables for pre-building
According to, user is returned data to, and the dimension name that the dimensional information is included is acquired as overall, wherein, it is described
Subcube tables are synthesized by the part row in cube tables.
Preferably, described device also includes:Module is pre-build, dimension to be checked is carried for obtain in advance user
The Query Information of degree name, according to the dimension name, inquires about the corresponding data of dimension name, according to the dimension name and the dimension name
Corresponding data, set up subcube tables.
Preferably, described device also includes:First update module, for occurring when the data in the cube tables for pre-building
During renewal, the data for occurring to update are obtained in the cube tables for pre-building, the data to getting carry out dimension-reduction treatment, will drop
Data after dimension process are updated to the subcube tables for pre-building.
Preferably, first update module is specifically for for arbitrary data for getting, it is determined that include at least one
The subcube tables of the dimension name corresponding to the data, and subcube tables are determined for arbitrary, by the dimension corresponding to the data
Degree drops to, and in subcube table lookup with the data corresponding dimension values phase consistent with the dimension corresponding to the subcube tables
Same data;When dimension values identical data corresponding with the data are found out, then data are merged, when do not find out with
The corresponding dimension values identical data of the data, then be directly appended to subcube tables.
Preferably, described device also includes:Second update module, in special time, will be gathered comprising dimension name
Dimension combination in identical be classified as one group, count each group in gathered comprising dimension name dimension combination number of times, in institute
In the case that the number of times of the combination of the dimension comprising dimension name of collection exceedes default threshold value, newly-built subcube tables, and advance
The dimension is inquired about in the cube tables of foundation and combines the included corresponding data of dimension name, the dimension is combined into included dimension
The corresponding dimension values identical data of name are merged, and are added to newly-built subcube tables.
The embodiment of the present application provides a kind of querying method and device of mass data multidimensional analysis, and the method receives use first
The inquiry request for carrying dimensional information to be checked that family sends, wherein, the dimensional information includes:Dimension name and dimension values,
According to the dimensional information, the corresponding data of the dimensional information are inquired about in the subcube tables for pre-building, when inquiring the dimension
The corresponding data of information, then return data to user, when the corresponding data of the dimensional information are not inquired, is then pre-building
Cube tables in inquire about the corresponding data of the dimensional information, return data to user, and the dimension that the dimensional information is included
Name is acquired as dimension combination, wherein, the subcube tables are synthesized by the part row in cube tables.By above-mentioned side
Method, as the subcube tables are synthesized by the part row in cube tables, that is to say, that the line number in subcube tables is less than
Line number in cube tables, subsequently, user is first inquired about in the subcube tables for pre-building during inquiry, this
Sample can effectively improve the efficiency of inquiry, also, subcube tables simply include the dimension combination of partial dimensional, and need not
Exhaustion goes out all of dimension combination, so effectively reduces amount of calculation.
Specific embodiment
To make purpose, technical scheme and the advantage of the application clearer, below in conjunction with the application specific embodiment and
Corresponding accompanying drawing is clearly and completely described to technical scheme.Obviously, described embodiment is only the application one
Section Example, rather than the embodiment of whole.Based on the embodiment in the application, those of ordinary skill in the art are not doing
The every other embodiment obtained under the premise of going out creative work, belongs to the scope of the application protection.
The query script of the mass data multidimensional analysis that Fig. 1 is provided for the embodiment of the present application, specifically includes following steps:
S101:The inquiry request for carrying dimensional information to be checked that receive user sends.
In actual applications, the multidimensional data for collecting can be deposited according to fixed by enterprise customer by on-line analytical processing
Storage form is stored in data warehouse, subsequently, can be required according to the dimension of enterprise customer, quickly clever by on-line analytical processing
Carry out the complex query of big data quantity livingly, and with it is a kind of it is directly perceived and understandable in the form of be supplied to enterprise to use Query Result
Family.
And enterprise customer needed the multidimensional data storage that will be collected to data warehouse before dimension required for inquiry
In.
Further, as the application is intended to by being proposed some of cube lists according to user's actual need
Come, these row for singly putting forward individually are set up into a table, with this by way of reducing whole table columns, so as to reach reduction
The line number of whole table, that is to say, that the columns of this table for individually setting up these row for singly putting forward is relative to original
Cube tables are compared and are reduced, and the line number of whole table is compared also relative to advance cube tables and reduced, and the line number of whole table subtracts
Few, then the inquiry velocity on this table will accelerate, therefore, in this application, can be in the cube tables for prestoring, root
Some row are extracted accordingly according to actual demand, and according to the row that these extract, set up a table.
Here is it should be noted that in order to distinguish original cube tables and corresponding according to the actual requirements well
Some row, and the table set up according to these row for extracting are extracted, in this application, will be carried accordingly according to the actual requirements
Some row are taken, and the table definition set up according to these row for extracting is subcube tables, that is to say, that the subcube tables
It is to be synthesized by the part row in cube tables, also, is directed to same cube table, the actual demand of user is typically comprising various
Mutually different dimension combination, can combine according to each different dimension that the actual demand of user is included, respectively basis
The data included in cube tables set up a subcube table, that is to say, that same cube table can be according to the actual need of user
The various dimension combinations for differing for being included are asked, the subcube tables that multiple dimension combinations are differed are set up.
Further, this application provides a method for pre-building subcube tables, specific as follows:
The Query Information for carrying dimension name to be checked of user is obtained in advance, according to the dimension name, inquires about the dimension
The corresponding data of name, according to the dimension name and the corresponding data of dimension name, set up subcube tables.
Here is it should be noted that the corresponding data of dimension name include:The fact that dimension values and dimension values correspondence, is worth, and
And, dimension name to be checked can be the combination of only one of which dimension name, or multiple dimension names, dimension name to be checked
Specifically include several dimension names then to be determined according to the actual demand of user.
In addition, according to the dimension name and the corresponding data of dimension name, during setting up subcube tables, first building
The vertical one subcube table for including true value name and dimension name, each row correspond to a dimension name, dimension (that is, are wrapped
Name containing dimension and dimension values) it is identical the fact value merge, and value and its corresponding dimension values are filled out for the fact that by after merging
Enter in subcube tables, e.g., if true 1 corresponding dimension of value is:Province=Beijing and season=first quarter, true value 2
Also corresponding to dimension is:Province=Beijing and season=first quarter, then the two true values can merge, the fact that after merging
It is worth for 3, i.e. 1+2, and true value 3 is filled into dimension:The fact that province=Beijing and season=first quarter correspondence, is worth row
In, if true 2 corresponding dimension A of value (that is, province=Beijing) and dimension C (season=second quarter), then true value can not be entered
Row merges.
For example, for simple and clear elaboration the application, it is assumed that cube tables such as table 4 in data warehouse:
Dimension A |
Dimension B |
Dimension C |
True value |
A1 |
B1 |
C1 |
1 |
A1 |
B2 |
C2 |
1 |
A2 |
B1 |
C1 |
1 |
A2 |
B2 |
C2 |
1 |
Table 4
Assume that user's first needs to set up subcube tables according to the actual requirements, therefore, data warehouse obtains the carrying of user's first
There is the Query Information of dimension A (that is, dimension name) to be checked, according to dimension A, inquire about the corresponding data of dimension A, i.e. table 5.
Dimension A |
True value |
A1 |
1 |
A1 |
1 |
A2 |
1 |
A2 |
1 |
Table 5
A subcube table for including true value name and dimension A (that is, dimension name) is set up, each row correspond to one
Individual dimension name, value is merged for the fact that will be dimension (that is, comprising dimension name and dimension values) identical, and the fact that after merging
Value and its corresponding dimension values are filled in subcube tables, as shown in table 6:
Dimension A |
True value |
A1 |
2 |
A2 |
2 |
Table 6
Further, after the completion of subcube tables are set up, user can pass through terminal by the inquiry of dimensional information to be checked
Request is sent to data warehouse, and the corresponding data of dimension needed for inquiring about.
Here it should be noted that due to during inquiry, needing to know the data of inquiry in which row of which row,
Therefore, dimensional information to be checked includes:Dimension name and dimension values.
In addition, the dimension name included in dimensional information to be checked can be one, e.g., dimension A, or multiple
The combination of dimension name, e.g., dimension A and dimension B specifically include several dimension names then according to user's in dimensional information to be checked
Actual demand and determine.
Use the example above, user's first inquires about the corresponding data of dimension A=A1 according to the actual requirements, therefore, user's first is by eventually
The inquiry request of dimension A=A1 (that is, dimensional information) to be checked is sent to data warehouse, and the dimension pair needed for inquiring about by end
The data answered.
S102:According to the dimensional information, the corresponding number of the dimensional information is inquired about in the subcube tables for pre-building
According to.
Data warehouse receive user transmission the inquiry request for carrying dimensional information to be checked after, direct basis
The dimension name included in dimensional information and dimension values, are inquired about in the subcube tables for pre-building, are inquired about the dimensional information
Corresponding data.
Here is it should be noted that the corresponding data of the dimensional information can include:True value.
Continuation of the previous cases, data warehouse are receiving the inquiry request for carrying dimensional information to be checked of user's first transmission
Afterwards, directly inquired about in the subcube tables 6 for pre-building, inquired according to dimension A=A1 included in dimensional information
The corresponding data of the dimensional information are:True value=2.
S103:When the corresponding data of the dimensional information are inquired, then user is returned data to;It is described when not inquiring
The corresponding data of dimensional information, then in the cube tables for pre-building inquire about the corresponding data of the dimensional information, data returned
Back to user, and the dimension name that the dimensional information is included is acquired as overall.
When the corresponding data of the dimensional information are inquired in the subcube tables for pre-building, then return data to use
Family.
Continue to use the example above, will inquire the corresponding data of the dimensional information is:True value=2 return to user's first.
But, due to, during the subcube for pre-building, being to determine to determine according to the actual demand of user
Dimension name to be checked, and user is it is determined that during actual demand simply rule of thumb or historical data is determining, therefore, by
In experience or the limitation of historical data, in actual applications, it is possible to there is user in dimension needed for inquiry not advance
In the subcube tables of foundation, therefore, when the corresponding data of the dimensional information are not inquired, then can only be in the cube for pre-building
The corresponding data of the dimensional information are inquired about in table, user is returned data to.
Further, in actual applications, although the dimensional information to be checked that data warehouse is sent according to user, do not have
The corresponding data of the dimensional information are inquired in the subcube tables for pre-building, but can also illustrate that later user has
Also may can there is the tendency for inquiring about the dimensional information to be checked, also, during active user's inquiry dimensional information, although simply
Queried dimension certain dimension values under one's name, but also illustrate that the user is possible to exist afterwards and inquire about the dimension under one's name its
The tendency of his dimension values, therefore, the corresponding data of the dimensional information are inquired about in the cube tables for pre-building, is returned data to
While user, the dimension name that the dimensional information is included is acquired as dimension combination.
For example, it is assumed that the user's first in upper example inquires about the corresponding data of dimension B=B1 according to the actual requirements, then data warehouse
The corresponding data of the dimensional information are not inquired in the subcube6 tables for pre-building, is looked in the cube tables 4 for pre-building
Ask the corresponding data of the dimensional information, i.e. true value is:2, user's first is returned data to, while using dimension B as dimension group
Conjunction is acquired.
Further, as, after being acquired each time, the dimension name that the dimension all to gathering is included in combining is carried out
Determine whether to subcube tables be set up according to the dimension name included in the dimension combination, can waste more computer resources, because
This, in this application, can be in collection certain hour, the dimension name that the dimension to being gathered is included in combining judges whether
Subcube tables are set up according to the dimension name included in the combination of the dimension of collection, wherein, certain hour can be according to specific reality
Need to determine.
Further, the dimension name that the dimension to gathering is included in combining is determined whether to the dimension according to the collection
The dimension name included in combination is set up specific as follows during subcube tables:
In special time, identical in the combination of the dimension comprising dimension name for being gathered is classified as into one group, each group is counted
The number of times of interior the gathered combination of the dimension comprising dimension name, exceedes in the number of times of the combination of the dimension comprising dimension name for being gathered
In the case of default threshold value, newly-built subcube tables, and inquire about what the dimension combination was included in the cube tables for pre-building
The dimension is combined the included corresponding dimension values identical data of dimension name and is merged by the corresponding data of dimension name, and
It is added to newly-built subcube tables, wherein, special time is consistent with certain hour mentioned above.
For example, it is assumed that special time is one day, in one day, the dimension comprising dimension name for collecting is combined such as 7 institute of table
Show:
Dimension B |
Dimension B |
Dimension A and dimension B |
Dimension C |
Dimension B |
Dimension B and dimension C |
Table 7
Identical in the combination of the dimension comprising dimension name for being gathered is classified as into one group, what is gathered in statistics each group includes
The number of times of the dimension combination of dimension name, such as table 8:
Dimension name |
Number of times |
Dimension B |
4 |
Dimension A and dimension B |
1 |
Dimension C |
1 |
Dimension B and dimension C |
1 |
Table 8
Default threshold value is assumed for 3 times, data warehouse determines that the number of times of the combination of the dimension comprising dimension B for being gathered surpasses
Default threshold value, i.e., 3 time are crossed, newly-built subcube tables inquire about what the dimension combination was included in the cube tables 4 for pre-building
The dimension is combined the included corresponding dimension values identical data of dimension B and is merged, and added by the corresponding data of dimension B
Newly-built subcube tables are added to, as shown in table 9:
Dimension B |
True value |
B1 |
2 |
B2 |
2 |
Table 9
By said method, as the subcube tables are synthesized by the part row in cube tables, that is to say, that
Line number in subcube tables is less than the line number in cube tables, and subsequently, user is first being pre-build during inquiry
Subcube tables in inquired about, so can effectively improve the efficiency of inquiry, also, subcube tables simply include portion
The dimension combination of fractional dimension, and go out all of dimension combination without the need for exhaustion, so effectively reduce amount of calculation.
In actual applications, there is more news in the data being stored in advance in the cube tables of data warehouse, and
Subcube tables are set up according to the data in cube tables, that is to say, that when the data in cube tables occur to update, then
Data in subcube tables will certainly also change, therefore, in this application, the data in the cube tables for pre-building
When generation updates, need to be updated the data in the subcube tables that pre-build.
This application provides the mode of the data in the subcube tables for pre-building specifically is updated, it is specific as follows:Pre-
The data for occurring to update are obtained in the cube tables first set up, the data to getting carry out dimension-reduction treatment, after dimension-reduction treatment
Data are updated to the subcube tables for pre-building.
In addition, the application is during the data to getting carry out dimension-reduction treatment, arbitrary number for getting can be directed to
According to, it is determined that the subcube tables comprising the dimension name corresponding at least one data, and subcube tables are determined for arbitrary,
Dimension corresponding to the data is dropped to it is consistent with the dimension corresponding to the subcube tables, and in subcube tables search with should
The corresponding dimension values identical data of data;When dimension values identical data corresponding with the data are found out, then data are entered
Row merges, and when dimension values identical data corresponding with the data are not found out, is then directly appended to subcube tables.
For example, it is assumed that the table stored in data warehouse is included:Table 4, table 6, table 9, it is assumed that user's first increased one in table 4
Row data, it is concrete as shown in table 10:
Dimension A |
Dimension B |
Dimension C |
True value |
A1 |
B1 |
C1 |
1 |
A1 |
B2 |
C2 |
1 |
A2 |
B1 |
C1 |
1 |
A2 |
B2 |
C2 |
1 |
A1 |
B3 |
C1 |
1 |
Table 10
Data warehouse then obtains the data that generation updates in table 10, for the data for obtaining, it is determined that including at least one
The subcube tables of the dimension name corresponding to the data, i.e. subcube tables 6 and subcube tables 9.
For subcube tables 6, the dimension corresponding to the data is dropped to and the dimension one corresponding to the subcube tables 6
Cause, i.e. the dimension corresponding to data after dimensionality reduction only includes dimension A, finds out corresponding with the data in subcube tables 6
Dimension values identical data, merge, concrete such as table 11:
Dimension A |
True value |
A1 |
3 |
A2 |
2 |
Table 11
For subcube tables 9, the dimension corresponding to the data is dropped to and the dimension one corresponding to the subcube tables 9
Cause, i.e. the dimension corresponding to data after dimensionality reduction only includes dimension B, does not find out corresponding with the data in subcube tables 9
Dimension values identical data, therefore, directly add the data in subcube tables 9, it is concrete such as table 12:
Dimension B |
True value |
B1 |
2 |
B2 |
2 |
B3 |
1 |
Table 12
The querying method of the mass data multidimensional analysis for providing for the embodiment of the present application above, based on same thinking, this
Application embodiment also provides a kind of inquiry unit of mass data multidimensional analysis.
As shown in Fig. 2 a kind of inquiry unit of mass data multidimensional analysis of the embodiment of the present application offer, including:
Receiver module 201, for the inquiry request for carrying dimensional information to be checked that receive user sends, wherein,
The dimensional information includes:Dimension name and dimension values;
Enquiry module 202, for according to the dimensional information, inquiring about the dimension in the subcube tables for pre-building
The corresponding data of information;
Data return module 203, for when the corresponding data of the dimensional information are inquired, then returning data to use
Family;When the corresponding data of the dimensional information are not inquired, then the dimensional information pair is inquired about in the cube tables for pre-building
The data answered, return data to user, and the dimension name that the dimensional information is included is acquired as dimension combination, its
In, the subcube tables are synthesized by the part row in cube tables.
Described device also includes:
Module 204 is pre-build, for the Query Information for carrying dimension name to be checked in advance obtaining user, according to
The dimension name, inquires about the corresponding data of dimension name, according to the dimension name and the corresponding data of dimension name, sets up
Subcube tables.
Described device also includes:
First update module 205, for when the data in the cube tables for pre-building occur to update, what is pre-build
The data for occurring to update are obtained in cube tables, the data to getting carry out dimension-reduction treatment, and the data after dimension-reduction treatment are updated
To the subcube tables for pre-building.
First update module 205 is specifically for for arbitrary data for getting, it is determined that include at least one number
According to the subcube tables of corresponding dimension name, and subcube tables are determined for arbitrary, the dimension corresponding to the data is dropped
To consistent with the dimension corresponding to the subcube tables, and dimension values identical corresponding with the data is searched in subcube tables
Data;When dimension values identical data corresponding with the data are found out, then data are merged, when not finding out and the number
According to corresponding dimension values identical data, then subcube tables are directly appended to.
Described device also includes:
Second update module 206, the dimension comprising dimension name for, in special time, being gathered are identical in combining
Be classified as one group, count each group in gathered comprising dimension name dimension combination number of times, gathered comprising dimension name
Dimension combination number of times exceed default threshold value in the case of, newly-built subcube tables, and looking in the cube tables for pre-building
Ask the dimension and combine the included corresponding data of dimension name, the dimension is combined into the included corresponding dimension values phase of dimension name
Same data are merged, and are added to newly-built subcube tables.
In a typical configuration, computing device includes one or more processors (CPU), input/output interface, net
Network interface and internal memory.
Internal memory potentially includes the volatile memory in computer-readable medium, random access memory (RAM) and/or
The forms such as Nonvolatile memory, such as read-only storage (ROM) or flash memory (flash RAM).Internal memory is computer-readable medium
Example.
Computer-readable medium includes that permanent and non-permanent, removable and non-removable media can be by any method
Or technology is realizing information Store.Information can be computer-readable instruction, data structure, the module of program or other data.
The example of the storage medium of computer includes, but are not limited to phase transition internal memory (PRAM), static RAM (SRAM), moves
State random access memory (DRAM), other kinds of random access memory (RAM), read-only storage (ROM), electric erasable
Programmable read only memory (EEPROM), fast flash memory bank or other memory techniques, read-only optical disc read-only storage (CD-ROM),
Digital versatile disc (DVD) or other optical storages, magnetic cassette tape, the storage of tape magnetic rigid disk or other magnetic storage apparatus
Or any other non-transmission medium, can be used to store the information that can be accessed by a computing device.Define according to herein, calculate
Machine computer-readable recording medium does not include temporary computer readable media (transitory media), the such as data-signal and carrier wave of modulation.
Also, it should be noted that term " including ", "comprising" or its any other variant are intended to nonexcludability
Comprising so that a series of process, method, commodity or equipment including key elements not only includes those key elements, but also wrapping
Other key elements being not expressly set out are included, or also includes intrinsic for this process, method, commodity or equipment wanting
Element.In the absence of more restrictions, the key element for being limited by sentence "including a ...", it is not excluded that wanting including described
The process of element, method, also there is other identical element in commodity or equipment.
It will be understood by those skilled in the art that embodiments herein can be provided as method, system or computer program.
Therefore, the application can adopt complete hardware embodiment, complete software embodiment or with reference to the embodiment in terms of software and hardware
Form.And, the application can be deposited using the computer for wherein including computer usable program code at one or more is available
The shape of the computer program implemented on storage media (including but not limited to magnetic disc store, CD-ROM, optical memory etc.)
Formula.
Embodiments herein is the foregoing is only, the application is not limited to.For those skilled in the art
For, the application can have various modifications and variations.All any modifications made within spirit herein and principle, equivalent
Replace, improve etc., within the scope of should be included in claims hereof.