CN108241692A - The querying method and device of data - Google Patents

The querying method and device of data Download PDF

Info

Publication number
CN108241692A
CN108241692A CN201611220548.2A CN201611220548A CN108241692A CN 108241692 A CN108241692 A CN 108241692A CN 201611220548 A CN201611220548 A CN 201611220548A CN 108241692 A CN108241692 A CN 108241692A
Authority
CN
China
Prior art keywords
dimension
index
inquiry
data
big
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201611220548.2A
Other languages
Chinese (zh)
Other versions
CN108241692B (en
Inventor
洪超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Gridsum Technology Co Ltd
Original Assignee
Beijing Gridsum Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Gridsum Technology Co Ltd filed Critical Beijing Gridsum Technology Co Ltd
Priority to CN201611220548.2A priority Critical patent/CN108241692B/en
Publication of CN108241692A publication Critical patent/CN108241692A/en
Application granted granted Critical
Publication of CN108241692B publication Critical patent/CN108241692B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2425Iterative querying; Query formulation based on the results of a preceding query

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses the querying methods and device of a kind of data.Wherein, this method includes:The big dimension in metadata is obtained, wherein, big dimension is more than or equal to the dimension of predetermined threshold value for unique value, metadata includes the unique value of dimension and dimension, the metadata record correspondence of dimension and unique value;The target dimension identical with big dimension is searched, and using the corresponding index of the target dimension identical with big dimension as the corresponding index of big dimension in inquiry records, wherein, inquiry has recorded the correspondence of target dimension and index in recording;The data for choosing preset quantity from fact table according to big dimension and its corresponding index generate Aggregation Table;Inquiry and big dimension and the relevant data of index in Aggregation Table.The present invention is solved carries out the technical issues of efficiency data query is low according to caused by big dimension directly generates Aggregation Table by Aggregation Table.

Description

The querying method and device of data
Technical field
The present invention relates to data processing field, in particular to the querying method and device of a kind of data.
Background technology
In on-line analytical processing field, we are through being commonly encountered some big dimensions, such as channel (channel), url (nets Page) etc., many times we need to do these big dimensions grouping anatomy, then go to see the top n of corresponding index, that is, see The value and index of this dimension of top n, such as see dimension url, from the point of view of page browsing figureofmerit, see preceding 10 pageviews most Which more url pages are, for instructing website operation or service optimization.
It is that big dimension does the performance cost being grouped when dissecting, common tradition side that on-line analytical processing, which suffers from a problem that, Formula is solved by the thinking of the on-line analytical processing of Aggregation Table, but after prepolymerization, due to the unique value of the big dimension such as url Too much, cause its query performance slow.
For it is above-mentioned the problem of, currently no effective solution has been proposed.
Invention content
An embodiment of the present invention provides the querying methods and device of a kind of data, directly raw according to big dimension at least to solve The technical issues of efficiency data query is low is carried out by Aggregation Table caused by into Aggregation Table.
One side according to embodiments of the present invention provides a kind of data query method, including:It obtains in metadata Big dimension, wherein, the big dimension is more than or equal to the dimension of predetermined threshold value for unique value, and the metadata includes dimension and dimension Unique value, the metadata record dimension and the correspondence of the unique value;Lookup and institute in inquiry records The identical target dimension of big dimension is stated, and using the target dimension corresponding index identical with the big dimension as described big The corresponding index of dimension, wherein, the inquiry has recorded the correspondence of the target dimension and the index in recording;According to The big dimension and its corresponding index choose the data generation Aggregation Table of preset quantity from fact table;In the polymerization Inquiry and the big dimension and the relevant data of the index in table.
Further, the data of preset quantity are chosen from fact table according to the big dimension and its corresponding index Generation Aggregation Table includes:The fact table is grouped according to the big dimension;According to the index to the fact Data in tables of data are ranked up, and obtain the data after packet sequencing;Sequence is selected from the data after packet sequencing to lean on The data of preceding preset quantity;Aggregation Table is generated according to the data of the preset quantity selected.
Further, the big dimension obtained in metadata includes:The metadata is obtained, wherein, the metadata includes The unique value of dimension and dimension, the dimension are corresponding with the unique value;Unique value described in the metadata is searched to be more than Equal to the dimension of predetermined threshold value;Unique value described in the metadata is more than or equal to the dimension of predetermined threshold value as the big dimension Degree.
Further, it inquires in the Aggregation Table and includes with the big dimension and the relevant data of the index:It obtains Querying condition, the querying condition include inquiry dimension and inquiry index;Judge whether include looking into described in the Aggregation Table Ask the consistent big dimension of dimension;If it is judged that the Aggregation Table includes the big dimension consistent with the inquiry dimension, then sentence Whether the disconnected inquiry index and index when generating the Aggregation Table are consistent, and judge the ordering of the inquiry index It is whether consistent with the ordering of the index during generation Aggregation Table;If it is judged that the inquiry index is described poly- with generating Index when closing table is consistent, and judges the ordering of the inquiry index and the row of the index during generation Aggregation Table Row order is consistent, then inquires data in the Aggregation Table according to the inquiry dimension and the inquiry index.
Further, after the big dimension consistent with the inquiry dimension whether is included in the Aggregation Table is judged, institute The method of stating further includes:If it is judged that the big dimension consistent with the inquiry dimension is not included in the Aggregation Table, then according to institute It states inquiry dimension and the inquiry index inquires data from the fact table;Or the if it is judged that inquiry index It is inconsistent or judge that the ordering of the inquiry index described polymerize with generation with index when generating the Aggregation Table The ordering of index during table is inconsistent, then according to the inquiry dimension and the inquiry index from the fact table Inquire data.
Another aspect according to embodiments of the present invention additionally provides a kind of data query arrangement, including:Acquiring unit is used In obtaining the big dimension in metadata, wherein, the big dimension is more than or equal to the dimension of predetermined threshold value, the member number for unique value According to the unique value for including dimension and dimension, the metadata record dimension and the correspondence of the unique value;It searches Unit, for searching the target dimension identical with the big dimension in being recorded in inquiry, and by the institute identical with the big dimension The corresponding index of target dimension is stated as the corresponding index of the big dimension, wherein, have recorded the mesh in the inquiry record Mark the correspondence of dimension and the index;Polymerized unit, for being engaged in real number according to the big dimension and its corresponding index Aggregation Table is generated according to the data that preset quantity is chosen in table;Query unit, for the inquiry in the Aggregation Table and the big dimension Degree and the relevant data of the index.
Further, the polymerized unit includes:Grouping module, for according to the big dimension to the fact table It is grouped;Sorting module for being ranked up according to the index to the data in the fact table, obtains grouping row Data after sequence;Selecting module, for selecting the data for the forward preset quantity that sorts from the data after packet sequencing;It is poly- Block is molded, for generating the Aggregation Table according to the data of the preset quantity selected.
Further, the acquiring unit includes:First acquisition module, for obtaining the metadata, wherein, the member Data include the unique value of dimension and dimension, and the dimension is corresponding with the unique value;Searching module, for searching the member Unique value described in data is more than or equal to the dimension of predetermined threshold value;Determining module, for by unique value described in the metadata More than or equal to predetermined threshold value dimension as the big dimension.
Further, the query unit includes:Second acquisition module, for obtaining querying condition, the querying condition Including inquiry dimension and inquiry index;First judgment module, for judging whether include tieing up with the inquiry in the Aggregation Table The consistent big dimension of degree;Second judgment module, for judging that it is consistent with the inquiry dimension that the Aggregation Table includes During big dimension, judge whether the inquiry index and index when generating the Aggregation Table are consistent, and judge that the inquiry refers to Whether target ordering is consistent with the ordering of the index during generation Aggregation Table;First enquiry module, for sentencing Break it is described inquiry index with generate the Aggregation Table when index it is consistent, and judge it is described inquire index ordering When consistent with the ordering of the index during generation Aggregation Table, according to the inquiry dimension and the inquiry index described Data are inquired in Aggregation Table.
Further, the query unit further includes:Second enquiry module, for not wrapped in the Aggregation Table is judged When including the big dimension consistent with the inquiry dimension, according to the inquiry dimension and the index of inquiring from the fact table Middle inquiry data;Or third enquiry module, for judging the inquiry index with generating the index during Aggregation Table The ordering of index when ordering that is inconsistent or judging the inquiry index is with generating the Aggregation Table differs During cause, data are inquired from the fact table according to the inquiry dimension and the inquiry index.
In embodiments of the present invention, using the big dimension obtained in metadata;It is searched and big dimension phase in inquiry records The same corresponding index of target dimension and target dimension;Preset quantity is chosen from fact table according to big dimension and index Data generate Aggregation Table;Inquiry and big dimension and the mode of the relevant data of index in Aggregation Table, by pressing index to data It is ranked up, and chooses the data generation Aggregation Table of preset quantity, achieved the purpose that reduce data dimension in Aggregation Table, so as to The technique effect for improving the efficiency that data query is carried out by Aggregation Table is realized, and then solves and is directly generated according to big dimension The technical issues of efficiency data query is low is carried out by Aggregation Table caused by Aggregation Table.
Description of the drawings
Attached drawing described herein is used to provide further understanding of the present invention, and forms the part of the application, this hair Bright illustrative embodiments and their description do not constitute improper limitations of the present invention for explaining the present invention.In the accompanying drawings:
Fig. 1 is a kind of flow chart of the querying method of optional data according to embodiments of the present invention;
Fig. 2 is a kind of schematic diagram of the inquiry unit of optional data according to embodiments of the present invention.
Specific embodiment
In order to which those skilled in the art is made to more fully understand the present invention program, below in conjunction in the embodiment of the present invention The technical solution in the embodiment of the present invention is clearly and completely described in attached drawing, it is clear that described embodiment is only The embodiment of a part of the invention, instead of all the embodiments.Based on the embodiments of the present invention, ordinary skill people Member's all other embodiments obtained without making creative work should all belong to the model that the present invention protects It encloses.
It should be noted that term " first " in description and claims of this specification and above-mentioned attached drawing, " Two " etc. be the object for distinguishing similar, and specific sequence or precedence are described without being used for.It should be appreciated that it uses in this way Data can be interchanged in the appropriate case, so as to the embodiment of the present invention described herein can in addition to illustrating herein or Sequence other than those of description is implemented.In addition, term " comprising " and " having " and their any deformation, it is intended that cover Cover it is non-exclusive include, be not necessarily limited to for example, containing the process of series of steps or unit, method, system, product or equipment Those steps or unit clearly listed, but may include not listing clearly or for these processes, method, product Or the intrinsic other steps of equipment or unit.
According to embodiments of the present invention, a kind of embodiment of the method for data query method is provided, it should be noted that attached The step of flow of figure illustrates can perform in the computer system of such as a group of computer-executable instructions, though also, So show logical order in flow charts, but in some cases, can be performed with the sequence being different from herein shown by Or the step of description.
Fig. 1 is a kind of flow chart of the querying method of optional data according to embodiments of the present invention, as shown in Figure 1, should Method includes the following steps:
Step S102 obtains the big dimension in metadata, wherein, big dimension is more than or equal to the dimension of predetermined threshold value for unique value Degree, metadata include the unique value of dimension and dimension, the metadata record correspondence of dimension and unique value.
The relevant information of data is had recorded in metadata, including the unique value of dimension and dimension, by dimension Unique value is judged, obtains the big dimension in metadata, wherein, the unique value of big dimension is more than or equal to predetermined threshold value.
Optionally, the big dimension obtained in metadata includes:Metadata is obtained, wherein, metadata includes dimension and dimension Unique value, dimension is corresponding with unique value;Search the dimension that unique value in metadata is more than or equal to predetermined threshold value;By metadata Middle unique value is more than or equal to the dimension of predetermined threshold value as big dimension.
Big dimension in metadata is obtained, i.e., in the dimension recorded in metadata, finds out all big dimensions.Specifically Ground obtains metadata first, due to having recorded the relevant information of data in metadata, wherein including the dimension and dimension of data The information such as corresponding unique value, and for dimension, the unique value of dimension is bigger, then dimension is bigger, therefore, is obtaining first number According to a threshold value later, is set, and search the unique value more than or equal to predetermined threshold value in the metadata, then it is more than or waits Dimension corresponding to unique value in predetermined threshold value is big dimension.
Step S104, searches the target dimension identical with big dimension in inquiry records, and by the mesh identical with big dimension The corresponding index of dimension is marked as the corresponding index of big dimension, wherein, inquiry has recorded pair of target dimension and index in recording It should be related to.
After all big dimensions are obtained, the target dimension identical with big dimension is searched in inquiry records.Due to In each historical query record of inquiry record, in addition to record has the inquiry dimension of this inquiry, it is also recorded for this and looks into The inquiry index of inquiry, therefore its corresponding index can be found according to target dimension, the index is corresponding as big dimension Index.
Such as:What is recorded in fact table is sales volume and consumption sum of the specific product in different time, In, dimension includes:Product type, time and user type, index include:Sales volume and consumption sum.Assuming that pass through metadata " time " is got as big dimension, and is had recorded in inquiry records to the sales volume of all products in different time sections Inquiry, then the index corresponding to big dimension " time " is " sales volume ".
Step S106, the data for choosing preset quantity from fact table according to big dimension and its corresponding index generate Aggregation Table.
Big dimension is determined and index corresponding to big dimension after, according to big dimension and index from fact table The data of preset quantity are chosen, generate Aggregation Table, wherein, the quantity for the data chosen from fact table is according to practical need Ask what is set.
Optionally, the data generation for choosing preset quantity from fact table according to big dimension and its corresponding index is poly- Conjunction table includes:Fact table is grouped according to big dimension;The data in fact table are ranked up according to index, Obtain the data after packet sequencing;The data for the forward preset quantity that sorts are selected from the data after packet sequencing;According to The data generation Aggregation Table of the preset quantity selected.
When according to big dimension and index generation Aggregation Table, the data in fact table are divided according to big dimension Group, while the data in fact table are ranked up according to big dimension corresponding index, in embodiments of the present invention, not Restriction sequentially is carried out, and in implementation process to above-mentioned grouping and sequence, above-mentioned grouping and sequence can simultaneously into Row.After grouping and sequence, the data generation Aggregation Table of the forward preset quantity of selected and sorted.
Such as:What is recorded in fact table is sales volume and consumption sum of the specific product in different time, In, dimension includes:Product type, time and user type, index include:Sales volume and consumption sum.By " product type " and The dimension combination of " time ", by " consumption sum " as index, one is generated based on the fact table as a big dimension Aggregation Table is then grouped the data in fact table according to " product type " and " time ", in grouping process, ignores Other dimensions merge other dimensions according to " product type " dimension and " time " dimension, meanwhile, according to " sale gold Volume " is ranked up from high to low, obtains the result of packet sequencing, it is assumed that in the example, it is only necessary to 50 data before concern, then The data that selected and sorted is preceding 50 from packet sequencing result generate Aggregation Table.
Step S108, inquiry and big dimension and the relevant data of index in Aggregation Table.
The number under the big dimension and index of correlation is contained in the Aggregation Table generated due to the big dimension of above-mentioned basis and index According to when carrying out data query, the data related with the big dimension and index of correlation can be inquired in the Aggregation Table.
In embodiments of the present invention, using the big dimension obtained in metadata;It is searched and big dimension phase in inquiry records The same corresponding index of target dimension and target dimension;Preset quantity is chosen from fact table according to big dimension and index Data generate Aggregation Table;Inquiry and big dimension and the mode of the relevant data of index in Aggregation Table, by pressing index to data It is ranked up, and chooses the data generation Aggregation Table of preset quantity, achieved the purpose that reduce data dimension in Aggregation Table, so as to The technique effect for improving the efficiency that data query is carried out by Aggregation Table is realized, and then solves and is directly generated according to big dimension The technical issues of efficiency data query is low is carried out by Aggregation Table caused by Aggregation Table.
Optionally, it inquires in Aggregation Table and includes with big dimension and the relevant data of index:Querying condition is obtained, inquires item Part includes inquiry dimension and inquiry index;Judge whether include the big dimension consistent with inquiry dimension in Aggregation Table;If it is determined that Go out Aggregation Table include with the consistent big dimension of inquiry dimension, then judge to inquire index and index during generation Aggregation Table whether one It causes, and judges to inquire whether the ordering of index is consistent with the ordering of index during generation Aggregation Table;If it is determined that When it is consistent with index during generation Aggregation Table to go out to inquire index, and judging to inquire the ordering of index with generating Aggregation Table Index ordering it is consistent, then according to inquiry dimension and inquiry index data are inquired in Aggregation Table.
In embodiments of the present invention, in order to improve the efficiency of inquiry, when carrying out data query, preferentially judging whether can be with Data query is carried out from Aggregation Table, specifically, first to obtaining querying condition, obtains the inquiry dimension in querying condition and inquiry Whether index is judged containing the big dimension consistent with the inquiry dimension in Aggregation Table, if Aggregation Table includes and the inquiry dimension Consistent big dimension, then the inquiry index for continuing to judge the index and current queries being ranked up during generation Aggregation Table to data are Sortord required by the mode and current queries that are ranked up during no consistent and generation Aggregation Table to data whether one It causes, if it is consistent with the inquiry index of current queries to the index that data are ranked up during generation Aggregation Table, and would generate polymerization It is consistent with the sortord required by current queries to the mode that data are ranked up during table, then according to when inquiry dimension and inquiry Index inquires data in Aggregation Table.
Optionally, after whether including inquiry dimension in Aggregation Table is judged, method further includes:If it is judged that Aggregation Table In do not include with the consistent big dimension of inquiry dimension, then according to the inquiry dimension and the index of inquiring from fact table Inquire data;Either if it is judged that inquiry index with generate Aggregation Table when index it is inconsistent or judge inquiry index Ordering and index during generation Aggregation Table ordering it is inconsistent, then according to inquiry dimension and inquiry index from the fact Data are inquired in tables of data.
In data query, if by judging, current queries dimension is not included in Aggregation Table, then according in querying condition Inquiry dimension and inquiry index, data are inquired in fact table;If Aggregation Table includes the dimension of current queries, but Although the index and the inquiry index of current queries that are ranked up when generating Aggregation Table to data be inconsistent or generation Aggregation Table When it is to the index that data are ranked up consistent with the inquiry index of current queries, but while generating Aggregation Table data are ranked up Mode and the sortord required by current queries are inconsistent, then data cannot be inquired from Aggregation Table, be according to current queries Inquiry dimension and inquiry index in condition inquire data in fact table.
According to embodiments of the present invention, a kind of embodiment of the inquiry unit of data, the inquiry unit of the data are additionally provided It is mainly used for performing the querying method of data that the above of the embodiment of the present invention is provided, Fig. 2 is according to embodiments of the present invention A kind of optional data inquiry unit schematic diagram, as shown in Fig. 2, the device mainly includes:
Acquiring unit 210, for obtaining the big dimension in metadata, wherein, big dimension is more than or equal to default for unique value The dimension of threshold value, metadata include the unique value of dimension and dimension, the metadata record correspondence of dimension and unique value;
The relevant information of data is had recorded in metadata, including the unique value of dimension and dimension, acquiring unit 210 is logical It crosses and the unique value of dimension is judged, obtain the big dimension in metadata, wherein, the unique value of big dimension is more than or equal to Predetermined threshold value.
Optionally, acquiring unit includes:First acquisition module, for obtaining metadata, wherein, metadata include dimension and The unique value of dimension, dimension are corresponding with unique value;Searching module is more than or equal to default threshold for searching unique value in metadata The dimension of value;Determining module, for unique value in metadata to be more than or equal to the dimension of predetermined threshold value as big dimension.
Big dimension in metadata is obtained, i.e., in the dimension recorded in metadata, finds out all big dimensions.Specifically Ground, the first acquisition module obtains metadata, due to having recorded the relevant information of data in metadata, wherein including the dimension of data The information such as degree unique value corresponding with dimension, and for dimension, the unique value of dimension is bigger, then dimension is bigger, therefore, After obtaining metadata, a threshold value is set, and searching module is searched unique more than or equal to predetermined threshold value in the metadata Value, determining module will be greater than or be determined as big dimension equal to the dimension corresponding to the unique value of predetermined threshold value.
Searching unit 220, for searching the target dimension identical with big dimension, and will be with big dimension phase in inquiry record With the corresponding index of target dimension as the corresponding index of big dimension, wherein, inquiry record in have recorded target dimension with refer to Target correspondence;
After all big dimensions are obtained, the target dimension identical with big dimension is searched in inquiry records.Due to In each historical query record of inquiry record, in addition to record has the inquiry dimension of this inquiry, it is also recorded for this and looks into The inquiry index of inquiry, therefore searching unit 220 can find its corresponding index according to target dimension, using the index as big The corresponding index of dimension.
Such as:What is recorded in fact table is sales volume and consumption sum of the specific product in different time, In, dimension includes:Product type, time and user type, index include:Sales volume and consumption sum.Assuming that pass through metadata " time " is got as big dimension, and is had recorded in inquiry records to the sales volume of all products in different time sections Inquiry, then the index corresponding to big dimension " time " is " sales volume ".
Polymerized unit 230, for choosing preset quantity from fact table according to big dimension and its corresponding index Data generate Aggregation Table;
Big dimension is determined and index corresponding to big dimension after, polymerized unit 230 according to big dimension and index from The data of preset quantity are chosen in fact table, generate Aggregation Table, wherein, the quantity for the data chosen from fact table It is set according to actual demand.
Optionally, polymerized unit includes:Grouping module, for being grouped according to big dimension to fact table;Sequence Module for being ranked up according to index to the data in fact table, obtains the data after packet sequencing;Selecting module, For selecting the data for the forward preset quantity that sorts from the data after packet sequencing;Aggregation module, for according to selection The data generation Aggregation Table of the preset quantity gone out.
When according to big dimension and index generation Aggregation Table, grouping module is by the data in fact table according to big dimension It is grouped, while sorting module is ranked up the data in fact table according to the corresponding index of big dimension, in this hair In bright embodiment, the execution of above-mentioned module sequence is not defined, and in implementation process, above-mentioned module can be simultaneously It performs.After grouping and sequence, the data of the forward preset quantity of selecting module selected and sorted, aggregation module is according to selecting Preset quantity data generation Aggregation Table.
Such as:What is recorded in fact table is sales volume and consumption sum of the specific product in different time, In, dimension includes:Product type, time and user type, index include:Sales volume and consumption sum.By " product type " and The dimension combination of " time ", by " consumption sum " as index, one is generated based on the fact table as a big dimension Aggregation Table is then grouped the data in fact table according to " product type " and " time ", in grouping process, ignores Other dimensions merge other dimensions according to " product type " dimension and " time " dimension, meanwhile, according to " sale gold Volume " is ranked up from high to low, obtains the result of packet sequencing, it is assumed that in the example, it is only necessary to 50 data before concern, then The data that selected and sorted is preceding 50 from packet sequencing result generate Aggregation Table.
Query unit 240, for the inquiry in Aggregation Table and big dimension and the relevant data of index.
The number under the big dimension and index of correlation is contained in the Aggregation Table generated due to the big dimension of above-mentioned basis and index According to when carrying out data query, query unit 240 inquires the number related with the big dimension and index of correlation in the Aggregation Table According to.
In embodiments of the present invention, using the big dimension obtained in metadata;It is searched and big dimension phase in inquiry records The same corresponding index of target dimension and target dimension;Preset quantity is chosen from fact table according to big dimension and index Data generate Aggregation Table;Inquiry and big dimension and the mode of the relevant data of index in Aggregation Table, by pressing index to data It is ranked up, and chooses the data generation Aggregation Table of preset quantity, achieved the purpose that reduce data dimension in Aggregation Table, so as to The technique effect for improving the efficiency that data query is carried out by Aggregation Table is realized, and then solves and is directly generated according to big dimension The technical issues of efficiency data query is low is carried out by Aggregation Table caused by Aggregation Table.
Optionally, query unit includes:Second acquisition module, for obtaining querying condition, querying condition, which includes inquiry, to be tieed up Degree and inquiry index;First judgment module, for judging whether include the big dimension consistent with inquiry dimension in Aggregation Table;Second Judgment module, for when judging that Aggregation Table includes the big dimension consistent with inquiry dimension, judging to inquire index and generation Whether index during Aggregation Table is consistent, and judges to inquire the ordering of index and the arrangement time of index during generation Aggregation Table Whether sequence is consistent;First enquiry module, for judging that inquiry index is consistent with index when generating Aggregation Table, and judges Go out to inquire the ordering of index it is consistent with the ordering of the index during generation Aggregation Table when, refer to according to inquiry dimension and inquiry It is marked in Aggregation Table and inquires data.
In embodiments of the present invention, in order to improve the efficiency of inquiry, when carrying out data query, preferentially judging whether can be with Data query is carried out from Aggregation Table, specifically, the second acquisition module obtains the inquiry in querying condition to obtaining querying condition Whether dimension and inquiry index, the first judgment module judge to look into if Aggregation Table includes this containing the inquiry dimension in Aggregation Table Dimension is ask, then the second judgment module continues to judge the inquiry for the index and current queries being ranked up during generation Aggregation Table to data Sortord required by whether index consistent and when generation Aggregation Table is ranked up data mode and current queries is It is no consistent, if it is consistent with the inquiry index of current queries to the index that data are ranked up during generation Aggregation Table, and generate It is consistent with the sortord required by current queries to the mode that data are ranked up during Aggregation Table, then the first enquiry module according to When inquiry dimension and inquiry index inquire data in Aggregation Table.
Optionally, query unit further includes:Second enquiry module, for not including tieing up with inquiry in Aggregation Table is judged When spending consistent big dimension, data are inquired from fact table according to the inquiry dimension and the inquiry index;Or the Three enquiry modules, for judge inquire index with generate Aggregation Table when index it is inconsistent or judge inquiry index Ordering and during the inconsistent ordering of index during generation Aggregation Table, according to inquiry dimension and inquiry index from the fact Data are inquired in tables of data.
In data query, if by judging, current queries dimension is not included in Aggregation Table, then the second enquiry module is pressed According to the inquiry dimension in querying condition and inquiry index, data are inquired in fact table;If Aggregation Table is included currently The dimension of inquiry, but while generating Aggregation Table index that data are ranked up and the inquiry index of current queries it is inconsistent or Although generation Aggregation Table when it is consistent with the inquiry index of current queries to the index that data are ranked up, generate Aggregation Table when pair Sortord required by mode and current queries that data are ranked up is inconsistent, then data cannot be inquired from Aggregation Table, Data are inquired in fact table according to the inquiry dimension in current queries condition and inquiry index by third enquiry module.
The embodiments of the present invention are for illustration only, do not represent the quality of embodiment.
In the above embodiment of the present invention, all emphasize particularly on different fields to the description of each embodiment, do not have in some embodiment The part of detailed description may refer to the associated description of other embodiment.
In several embodiments provided herein, it should be understood that disclosed technology contents can pass through others Mode is realized.Wherein, the apparatus embodiments described above are merely exemplary, such as the division of the unit, Ke Yiwei A kind of division of logic function, can there is an other dividing mode in actual implementation, for example, multiple units or component can combine or Person is desirably integrated into another system or some features can be ignored or does not perform.Another point, shown or discussed is mutual Between coupling, direct-coupling or communication connection can be INDIRECT COUPLING or communication link by some interfaces, unit or module It connects, can be electrical or other forms.
The unit illustrated as separating component may or may not be physically separate, be shown as unit The component shown may or may not be physical unit, you can be located at a place or can also be distributed to multiple On unit.Some or all of unit therein can be selected according to the actual needs to realize the purpose of this embodiment scheme.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, it can also That each unit is individually physically present, can also two or more units integrate in a unit.Above-mentioned integrated list The form that hardware had both may be used in member is realized, can also be realized in the form of SFU software functional unit.
If the integrated unit is realized in the form of SFU software functional unit and is independent product sale or uses When, it can be stored in a computer read/write memory medium.Based on such understanding, technical scheme of the present invention is substantially The part to contribute in other words to the prior art or all or part of the technical solution can be in the form of software products It embodies, which is stored in a storage medium, is used including some instructions so that a computer Equipment (can be personal computer, server or network equipment etc.) perform each embodiment the method for the present invention whole or Part steps.And aforementioned storage medium includes:USB flash disk, read-only memory (ROM, Read-Only Memory), arbitrary access are deposited Reservoir (RAM, Random Access Memory), mobile hard disk, magnetic disc or CD etc. are various can to store program code Medium.
The above is only the preferred embodiment of the present invention, it is noted that for the ordinary skill people of the art For member, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications also should It is considered as protection scope of the present invention.

Claims (10)

1. a kind of querying method of data, which is characterized in that including:
The big dimension in metadata is obtained, wherein, the big dimension is more than or equal to the dimension of predetermined threshold value, the member for unique value Data include the unique value of dimension and dimension, metadata record correspondence of the dimension with the unique value;
Search the target dimension identical with the big dimension in inquiry records, and by the target identical with the big dimension The corresponding index of dimension as the corresponding index of the big dimension, wherein, have recorded the target dimension in the inquiry record With the correspondence of the index;
The data for choosing preset quantity from fact table according to the big dimension and its corresponding index generate Aggregation Table;
Inquiry and the big dimension and the relevant data of the index in the Aggregation Table.
2. according to the method described in claim 1, it is characterized in that, real number is engaged according to the big dimension and its corresponding index Include according to the data generation Aggregation Table that preset quantity is chosen in table:
The fact table is grouped according to the big dimension;
The data in the fact table are ranked up according to the index, obtain the data after packet sequencing;
The data for the forward preset quantity that sorts are selected from the data after packet sequencing;
Aggregation Table is generated according to the data of the preset quantity selected.
3. according to the method described in claim 1, it is characterized in that, the big dimension obtained in metadata includes:
The metadata is obtained, wherein, the metadata includes the unique value of dimension and dimension, the dimension and the unique value It is corresponding;
Search the dimension that unique value described in the metadata is more than or equal to predetermined threshold value;
Unique value described in the metadata is more than or equal to the dimension of predetermined threshold value as the big dimension.
4. according to claim 1-3 any one of them methods, which is characterized in that inquiry and the big dimension in the Aggregation Table Degree and the relevant data of the index include:
Querying condition is obtained, the querying condition includes inquiry dimension and inquiry index;
Judge whether include the big dimension consistent with the inquiry dimension in the Aggregation Table;
If it is judged that including the big dimension consistent with the inquiry dimension, then judge the inquiry index with generating described polymerize Whether index during table is consistent, and judges the ordering of the inquiry index and the row of the index during generation Aggregation Table Whether row order is consistent;
If it is judged that the inquiry index is consistent with index when generating the Aggregation Table, and judge the inquiry index Ordering it is consistent with the ordering of index when generating the Aggregation Table, then according to the inquiry dimension and inquiry Index inquires data in the Aggregation Table.
5. according to the method described in claim 4, it is characterized in that, whether include and the inquiry in the Aggregation Table is judged After the consistent big dimension of dimension, the method further includes:
If it is judged that the big dimension consistent with the inquiry dimension is not included in the Aggregation Table, then according to the inquiry dimension With the inquiry index data are inquired from the fact table;Or
If it is judged that it is described inquiry index with generate the Aggregation Table when index it is inconsistent or judge it is described inquire refer to Target ordering and the ordering of index when generating the Aggregation Table are inconsistent, then according to the inquiry dimension and described Inquiry index inquires data from the fact table.
6. a kind of inquiry unit of data, which is characterized in that including:
Acquiring unit, for obtaining the big dimension in metadata, wherein, the big dimension is more than or equal to predetermined threshold value for unique value Dimension, the metadata includes the unique value of dimension and dimension, the metadata record dimension and the unique value Correspondence;
Searching unit, for searching the target dimension identical with the big dimension, and will be with the big dimension in inquiry record The identical corresponding index of the target dimension as the corresponding index of the big dimension, wherein, recorded in the inquiry record The correspondence of the target dimension and the index;
Polymerized unit, for choosing the data of preset quantity from fact table according to the big dimension and its corresponding index Generate Aggregation Table;
Query unit, for the inquiry in the Aggregation Table and the big dimension and the relevant data of the index.
7. device according to claim 6, which is characterized in that the polymerized unit includes:
Grouping module, for being grouped according to the big dimension to the fact table;
Sorting module, for being ranked up according to the index to the data in the fact table, after obtaining packet sequencing Data;
Selecting module, for selecting the data for the forward preset quantity that sorts from the data after packet sequencing;
Aggregation module, for generating Aggregation Table according to the data of the preset quantity selected.
8. device according to claim 6, which is characterized in that the acquiring unit includes:
First acquisition module, for obtaining the metadata, wherein, the metadata includes the unique value of dimension and dimension, institute It is corresponding with the unique value to state dimension;
Searching module, for searching the dimension that unique value described in the metadata is more than or equal to predetermined threshold value;
Determining module, for unique value described in the metadata to be more than or equal to the dimension of predetermined threshold value as the big dimension Degree.
9. device according to claim 6, which is characterized in that the query unit includes:
Second acquisition module, for obtaining querying condition, the querying condition includes inquiry dimension and inquiry index;
First judgment module, for judging whether include the big dimension consistent with the inquiry dimension in the Aggregation Table;
Second judgment module, for when judging that the Aggregation Table includes the inquiry dimension, judging the inquiry index It is whether consistent with index when generating the Aggregation Table, and judge the ordering of the inquiry index with generating described polymerize Whether the ordering of index during table is consistent;
First enquiry module, for judging that the inquiry index is consistent with index when generating the Aggregation Table, and sentences When the ordering for the inquiry index that breaks is consistent with the ordering of the index during generation Aggregation Table, looked into according to described It askes dimension and the inquiry index inquires data in the Aggregation Table.
10. device according to claim 9, which is characterized in that the query unit further includes:
Second enquiry module, for when not including in judging the Aggregation Table with the inquiry consistent big dimension of dimension, According to the inquiry dimension and the inquiry index data are inquired from the fact table;Or
Third enquiry module, for judge it is described inquiry index with generation the Aggregation Table when index it is inconsistent or When judging the ordering of the inquiry index and the inconsistent ordering of the index during generation Aggregation Table, according to institute It states inquiry dimension and the inquiry index inquires data from the fact table.
CN201611220548.2A 2016-12-26 2016-12-26 Data query method and device Active CN108241692B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611220548.2A CN108241692B (en) 2016-12-26 2016-12-26 Data query method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611220548.2A CN108241692B (en) 2016-12-26 2016-12-26 Data query method and device

Publications (2)

Publication Number Publication Date
CN108241692A true CN108241692A (en) 2018-07-03
CN108241692B CN108241692B (en) 2020-08-11

Family

ID=62701369

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611220548.2A Active CN108241692B (en) 2016-12-26 2016-12-26 Data query method and device

Country Status (1)

Country Link
CN (1) CN108241692B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109086339A (en) * 2018-07-06 2018-12-25 深圳市彬讯科技有限公司 It is a kind of for generating the data processing method and device of index recombination rate
CN109522345A (en) * 2018-11-19 2019-03-26 百度在线网络技术(北京)有限公司 For showing the method and device of information
CN111625545A (en) * 2020-06-08 2020-09-04 北京创鑫旅程网络技术有限公司 Data fusion method, data fusion device and storage medium
CN112199390A (en) * 2020-09-30 2021-01-08 上海达梦数据库有限公司 Data query method, device, equipment and storage medium in database
CN112269792A (en) * 2020-12-11 2021-01-26 腾讯科技(深圳)有限公司 Data query method, device, equipment and computer readable storage medium

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1347529A (en) * 1999-01-15 2002-05-01 米泰吉公司 Method for visualizing information in data warehousing environment
CN1508728A (en) * 2002-12-18 2004-06-30 �Ҵ���˾ Method and system for setting up multi-dimension data set in relation database using metadats
CN102682118A (en) * 2012-05-15 2012-09-19 北京久其软件股份有限公司 Multidimensional data model access method and device
CN104199821A (en) * 2014-07-08 2014-12-10 浙江大学城市学院 Method for establishing streaming data cube based on synopsis structure
CN104392001A (en) * 2014-12-15 2015-03-04 北京国双科技有限公司 Database inquiry method and device
CN104408179A (en) * 2014-12-15 2015-03-11 北京国双科技有限公司 Method and device for processing data from data table
CN104408169A (en) * 2014-12-09 2015-03-11 北京国双科技有限公司 Multi-dimensional expression language based dimension query method and device
US20150088885A1 (en) * 2013-09-20 2015-03-26 Oracle International Corporation Aggregating dimensional data using dense containers
CN104794221A (en) * 2015-04-29 2015-07-22 苏州国云数据科技有限公司 Multi-dimensional data analyzing system based on service objects
CN105183917A (en) * 2015-10-15 2015-12-23 国家电网公司 Multi-dimensional analysis method for multi-level storage data
CN105404637A (en) * 2015-09-18 2016-03-16 北京锐安科技有限公司 Data mining method and device
US20160154838A1 (en) * 2014-12-01 2016-06-02 International Business Machines Corporation Avoid double counting of mapped database data

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1347529A (en) * 1999-01-15 2002-05-01 米泰吉公司 Method for visualizing information in data warehousing environment
CN1508728A (en) * 2002-12-18 2004-06-30 �Ҵ���˾ Method and system for setting up multi-dimension data set in relation database using metadats
CN102682118A (en) * 2012-05-15 2012-09-19 北京久其软件股份有限公司 Multidimensional data model access method and device
US20150088885A1 (en) * 2013-09-20 2015-03-26 Oracle International Corporation Aggregating dimensional data using dense containers
CN104199821A (en) * 2014-07-08 2014-12-10 浙江大学城市学院 Method for establishing streaming data cube based on synopsis structure
US20160154838A1 (en) * 2014-12-01 2016-06-02 International Business Machines Corporation Avoid double counting of mapped database data
CN104408169A (en) * 2014-12-09 2015-03-11 北京国双科技有限公司 Multi-dimensional expression language based dimension query method and device
CN104392001A (en) * 2014-12-15 2015-03-04 北京国双科技有限公司 Database inquiry method and device
CN104408179A (en) * 2014-12-15 2015-03-11 北京国双科技有限公司 Method and device for processing data from data table
CN104794221A (en) * 2015-04-29 2015-07-22 苏州国云数据科技有限公司 Multi-dimensional data analyzing system based on service objects
CN105404637A (en) * 2015-09-18 2016-03-16 北京锐安科技有限公司 Data mining method and device
CN105183917A (en) * 2015-10-15 2015-12-23 国家电网公司 Multi-dimensional analysis method for multi-level storage data

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109086339A (en) * 2018-07-06 2018-12-25 深圳市彬讯科技有限公司 It is a kind of for generating the data processing method and device of index recombination rate
CN109522345A (en) * 2018-11-19 2019-03-26 百度在线网络技术(北京)有限公司 For showing the method and device of information
CN111625545A (en) * 2020-06-08 2020-09-04 北京创鑫旅程网络技术有限公司 Data fusion method, data fusion device and storage medium
CN111625545B (en) * 2020-06-08 2023-09-01 北京创鑫旅程网络技术有限公司 Data fusion method, data fusion device and storage medium
CN112199390A (en) * 2020-09-30 2021-01-08 上海达梦数据库有限公司 Data query method, device, equipment and storage medium in database
CN112199390B (en) * 2020-09-30 2023-05-30 上海达梦数据库有限公司 Data query method, device, equipment and storage medium in database
CN112269792A (en) * 2020-12-11 2021-01-26 腾讯科技(深圳)有限公司 Data query method, device, equipment and computer readable storage medium
WO2022121560A1 (en) * 2020-12-11 2022-06-16 腾讯科技(深圳)有限公司 Data query method and apparatus, device, and computer-readable storage medium
US11989176B2 (en) 2020-12-11 2024-05-21 Tencent Technology (Shenzhen) Company Limited Data query method and apparatus, device, and computer-readable storage medium

Also Published As

Publication number Publication date
CN108241692B (en) 2020-08-11

Similar Documents

Publication Publication Date Title
CN108241692A (en) The querying method and device of data
CN104123332B (en) The display methods and device of search result
US9262534B2 (en) Recommender system for identifying a new set of media items responsive to an input set of media items and knowledge base metrics
Kraft et al. Searching with context
CN102117321B (en) The automatic discovery that subject areas is discussed is assembled and tissue
Müller et al. Learning from user behavior in image retrieval: Application of market basket analysis
CA2484009A1 (en) Managing expressions in a database system
CN103502957B (en) Data processing method and device
US20100125573A1 (en) Visualizing hyperlinks in a search results list
US9262454B2 (en) Web page retrieval method and device
CN101847161A (en) Method for searching web pages and establishing database
CN108897761A (en) A kind of clustering storage method and device
CA2369912A1 (en) Computerized information search and indexing method, software and device
CN103714096A (en) Lucene-based inverted index system construction method and device, and Lucene-based inverted index system data processing method and device
KR20090077073A (en) Personal music recommendation mapping
CN103034663A (en) Information searching method and equipment
CN106294815B (en) A kind of clustering method and device of URL
CN103218443A (en) Blogging webpage retrieval system and retrieval method
CN107832444A (en) Event based on search daily record finds method and device
CN106209614A (en) A kind of net packet classifying method and device
CN106649385B (en) Data reordering method and device based on HBase database
CN108241691A (en) The gathering method and device of hotspot query data
CN105117403B (en) Daily record data fragment and querying method and device
CN102789615B (en) Book information correlation recommendation method, server and system
CN104463627A (en) Data processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 100083 No. 401, 4th Floor, Haitai Building, 229 North Fourth Ring Road, Haidian District, Beijing

Applicant after: Beijing Guoshuang Technology Co.,Ltd.

Address before: 100086 Cuigong Hotel, 76 Zhichun Road, Shuangyushu District, Haidian District, Beijing

Applicant before: Beijing Guoshuang Technology Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant