CN104182546B - The data query method and device of database - Google Patents

The data query method and device of database Download PDF

Info

Publication number
CN104182546B
CN104182546B CN201410455910.9A CN201410455910A CN104182546B CN 104182546 B CN104182546 B CN 104182546B CN 201410455910 A CN201410455910 A CN 201410455910A CN 104182546 B CN104182546 B CN 104182546B
Authority
CN
China
Prior art keywords
data
dimension table
dimension
database
nearest
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.)
Active
Application number
CN201410455910.9A
Other languages
Chinese (zh)
Other versions
CN104182546A (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 CN201410455910.9A priority Critical patent/CN104182546B/en
Publication of CN104182546A publication Critical patent/CN104182546A/en
Application granted granted Critical
Publication of CN104182546B publication Critical patent/CN104182546B/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/245Query processing
    • G06F16/2453Query optimisation
    • G06F16/24534Query rewriting; Transformation
    • G06F16/24537Query rewriting; Transformation of operators
    • 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/2455Query execution
    • G06F16/24553Query execution of query operations
    • 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/2457Query processing with adaptation to user needs
    • 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/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/283Multi-dimensional databases or data warehouses, e.g. MOLAP or ROLAP

Landscapes

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

Abstract

The invention discloses a kind of data query method and device of database.This method includes:The first dimension table in the first database is obtained, the first database is used to store all data in dimension table;The second dimension table created in the second database is obtained, wherein, the second database is the database inquired about for data processing;The dynamic condition added for the first dimension table is obtained, dynamic condition makes the data of the nearest dimension processing time period stored in the second dimension table the first dimension table of preservation;The data of a nearest dimension processing time period are inquired about by the second dimension table, solve to when big dimension table inquires about the data of a nearest processing time period in analytical database, the problem of slow efficiency comparison of inquiry velocity is low, has reached the effect for accelerating inquiry velocity, improving search efficiency.

Description

The data query method and device of database
Technical field
The present invention relates to data processing field, in particular to a kind of data query method and device of database.
Background technology
Database is a kind of general data processing system, can store all relevant data of an application field.Data Data in storehouse are shared its information by numerous users and set up, and have had been extricated from the limitation and restriction of specific procedure.No With user the data in database, the data that multiple users can simultaneously in shared data bank can be used by respective usage Resource, i.e., different users can access the same data in database simultaneously.Data sharing not only meets each user Requirement to the information content, while also meeting the requirement of each user-to-user information communication.
Data analytics server (SQL Services Analysis Services abbreviation SSAS) is excavated for merging data Solution provide an integrated platform.Over time, data volume gradually increases in big dimension, works as analyze data When being handled in storehouse index in big dimension, processing speed is significantly reduced.Because index is in processing, it is necessary to relevant to its Dimension in inquired about accordingly, then store.For example, when dimension table reaches hundred million ranks or more, query performance is obvious Reduction.In a practical situation, it is the data for inquiring about a nearest processing time period that majority of case, which performs data query, still Inquiry velocity is very slow.
For correlation technique, big dimension table inquires about the data of a nearest processing time period in analytical database When, the problem of slow efficiency comparison of inquiry velocity is low not yet proposes effective solution at present.
The content of the invention
It is a primary object of the present invention to provide a kind of data query method and device of database, to solve to analysis When big dimension table inquires about the data of a nearest processing time period in database, the problem of slow efficiency comparison of inquiry velocity is low.
To achieve these goals, according to an aspect of the invention, there is provided a kind of data query method of database. Included according to the data query method of the database of the present invention:The first dimension table in the first database is obtained, wherein, the first number It is used to store all data in dimension table according to storehouse;The second dimension table created in the second database is obtained, wherein, the second database For the database inquired about for data processing;The dynamic condition added for the first dimension table is obtained, wherein, dynamic condition makes the Two-dimensionses table preserves the data of the nearest dimension processing time period stored in the first dimension table;Looked into by the second dimension table Ask the data of a nearest dimension processing time period.
Further, the first dimension table obtained in the first database includes:Member value sum in the first dimension table is detected, Wherein, multiple member value are included in the first dimension table, member value sum is used for the total quantity for representing multiple member value;Judge into Whether member's value sum is more than the first predetermined threshold value;In the case where member value sum is more than the first predetermined threshold value, obtains first and tie up Spend table.
Further, the data for inquiring about a nearest dimension processing time period by the second dimension table include:Obtain thing Index in real table, wherein, true table stores all achievement datas;Second dimension table is mapped with the Index Establishment in true table Relation;By mapping relations, the data of a nearest dimension processing time period are inquired about by the second dimension table, inquiry knot is obtained Really.
Further, method also includes:The data processing time cycle of the second dimension table is detected, wherein, during data processing Between the cycle be the time cycle pre-set;According to the data processing time cycle, data processing is carried out to the second dimension table.
Further, include after the data that a nearest dimension processing time period is inquired about by the second dimension table:Inspection Survey the Query Result for the data that a nearest dimension processing time period is inquired about by the second dimension table;By Query Result send to Distributor is inquired about, wherein, inquiry Distributor is used to collect all inquiry request information and Query Result;Inquiry distribution Server sends Query Result information to client.
To achieve these goals, there is provided a kind of data query method of database according to another aspect of the present invention Device.The device includes:First acquisition unit, for obtaining the first dimension table in the first database, wherein, the first database For storing all data in dimension table;Second acquisition unit, for obtaining the second dimension table created in the second database, its In, the second database is the database inquired about for data processing;3rd acquiring unit, adds for obtaining for the first dimension table Plus dynamic condition, wherein, dynamic condition make the second dimension table preserve the first dimension table in store a nearest dimension processing The data of time cycle;Query unit, the data for inquiring about a nearest dimension processing time period by the second dimension table.
Further, first acquisition unit includes:First detection module, for detecting that member value is total in the first dimension table Number, wherein, include multiple member value in the first dimension table, member value sum is used for the total quantity for representing multiple member value;Sentence Disconnected module, for judging whether member value sum is more than the first predetermined threshold value;First acquisition module, for big in member value sum In the case of the first predetermined threshold value, the first dimension table is obtained.
Further, query unit includes:Second acquisition module, for obtaining the index in true table, wherein, true table Store all achievement datas;Creation module, for by the second dimension table and the Index Establishment mapping relations in true table;First looks into Module is ask, for by mapping relations, the data of a nearest dimension processing time period being inquired about by the second dimension table, are obtained Query Result.
Further, device also includes:Second detection module, the data processing time week for detecting the second dimension table Phase, wherein, the data processing time cycle is the time cycle pre-set;Processing module, for according to data processing time week Phase, data processing is carried out to the second dimension table.
Further, device also includes:3rd detection module, a nearest dimension is inquired about for detecting by the second dimension table Spend the Query Result of the data of processing time period;Sending module, for Query Result to be sent to inquiry Distributor, its In, inquiry Distributor is used to collect all inquiry request information and Query Result;Second enquiry module, for inquiring about distribution Server sends Query Result information to client.
The data query method of the database provided by the present invention, by obtaining the first dimension in the first database Table, the first database is used to store all data in dimension table;The second dimension table created in the second database is obtained, wherein, Second database is the database inquired about for data processing;Obtain the dynamic condition added for the first dimension table, dynamic bar Part makes the data of the nearest dimension processing time period stored in the second dimension table the first dimension table of preservation;Pass through the second dimension The data that table inquires about a nearest dimension processing time period are spent, are solved to big dimension table inquiry nearest one in analytical database During the data of individual processing time period, the problem of slow efficiency comparison of inquiry velocity is low has reached and has accelerated inquiry velocity, improves The effect of search efficiency.
Brief description of the drawings
The accompanying drawing for constituting the part of the application is used for providing a further understanding of the present invention, schematic reality of the invention Apply example and its illustrate to be used to explain the present invention, do not constitute inappropriate limitation of the present invention.In the accompanying drawings:
Fig. 1 is the flow chart of the first embodiment of the data query method of the database according to the present invention;
Fig. 2 is the flow chart of the second embodiment of the data query method of the database according to the present invention;
Fig. 3 is the flow chart of the 3rd embodiment of the data query method of the database according to the present invention;
Fig. 4 is the schematic diagram of the first embodiment of the data query arrangement of the database according to the present invention;
Fig. 5 is the schematic diagram of the second embodiment of the data query arrangement of the database according to the present invention;And
Fig. 6 is the schematic diagram of the 3rd embodiment of the data query arrangement of the database according to the present invention.
Embodiment
It should be noted that in the case where not conflicting, the feature in embodiment and embodiment in the application can phase Mutually combination.Describe the present invention in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
In order that those skilled in the art is better understood from the present invention program, below in conjunction with the embodiment of the present invention Accompanying drawing, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is only The embodiment of a part of the invention, rather than whole embodiments.Based on the embodiment in the present invention, in ordinary skill Personnel do not make the every other embodiment obtained under the premise of creative work, should all belong to the protection model of the present invention Enclose.
It should be noted that term " first " in description and claims of this specification and above-mentioned accompanying drawing, " Two " etc. be for distinguishing similar object, without for describing specific order or precedence.It should be appreciated that so using Data can exchange in the appropriate case, so as to embodiments of the invention described herein can with except illustrating herein or Order beyond those of description is implemented.In addition, term " comprising " and " having " and their any deformation, it is intended that cover Lid is non-exclusive to be included.
Fig. 1 is the flow chart of the first embodiment of the data query method of the database according to the present invention.As shown in figure 1, This method includes steps S101 to step S104:
Step S101, obtains the first dimension table in the first database.
First database in this refers to data warehouse, English name Data Warehouse, abbreviation DW or DWH, data Warehouse is the strategy for all types data supported for the decision-making system process raising of all ranks of enterprise.It is that individual data is deposited Storage, the purpose of Chinese idiom analytical presentation and decision support and create, being provided for enterprise needs business intelligence to know operation flow Improve and time of supervision, cost, quality and control.
Dimension table can be regarded as including true record in fact table in the window that user carrys out analyze data, dimension table Characteristic, some characteristics provide descriptive information, and some characteristics specify how to collect fact table data, to be analyst Useful information is provided, dimension table includes the hierarchical structure for the characteristic for helping combined data.For example, the dimension comprising product information If each class that table is generally comprised in the hierarchical structure that product is divided into the Ganlei such as food, beverage, non-consumption product, these products is entered One step is repeatedly segmented, until each product reaches lowest level.In dimension table, each table is included independently of other dimension tables True characteristic, for example, client's dimension table includes the data about client.Information can be divided into difference by the row field in dimension table The structural level of level.Dimension table contains the associated detailed information of specified attribute in true table, such as, detailed product, client Attribute, storage information etc..
The first dimension table in the first database is obtained, is the data volume for first detecting the first dimension table, then by each dimension table Data volume and setting the first predetermined threshold value be compared, pick out data volume be more than the first predetermined threshold value dimension., this step Purpose be in order to filter out the big dimension table in database, i.e. data volume exceed threshold value dimension table, to the big dimension filtered out Degree table passes through subsequent treatment, lifts data query speed.
Step S102, obtains the second dimension table created in the second database.
The second above-mentioned database refers to analytical database, and analytical database can carry out Online statistics, data to data The work of information data value is excavated in on-line analysis, immediately inquiry etc., is one important branch of database product.
The second dimension table is created in analytical database, the second dimension table is obtained.The purpose of this step is to create one Store the dimension table of a nearest time-triggered protocol cycle data.
Step S103, obtains the dynamic condition added for the first dimension table.
To filtering out the addition dynamic condition of the big dimension table in database, the purpose of this step is nearest in order to ensure only to return The data of one time cycle, it is ensured that the data stored in the second dimension table are the data of a nearest time cycle.
For example, a concrete implementation code is as follows:
CREATE VIEW[SnapshotLatestWindow].[DimFactSessionView]
AS
SELECT SessionKey,'-'AS SessionKeyName
FROM dbo.FactSession S
WHERE S.SessionTimeKey>=(SELECT MIN (timekey) FROM dbo.DimTime WHERE PreciseHourDateTime=CONVERT (DATE, DATEADD (dd, -2, GETDATE ())))
Realize all Session only retained in two days SessionKey data.Where a line, is as moved above State filter condition, the meaning of expression is Session data of the time that is returned only in two days, wherein where followed by condition For more than or equal to the sessiontimekey values before two days.
Step S104, the data of a nearest dimension processing time period are inquired about by the second dimension table.
When it is the data of a nearest dimension processing time period to inquire about Distributor to detect inquiry data, pass through The second dimension table in analytical database is inquired about.This step, which is avoided, is inquiring about the number of a nearest dimension processing time period According to when, historical data base is inquired about in analytical database.So as to accelerate inquiry velocity, improve search efficiency.
The data query method of the database provided in embodiments of the invention, by obtaining first in the first database Dimension table, the first database is used to store all data in dimension table;The second dimension table created in the second database is obtained, its In, the second database is the database inquired about for data processing;Obtain the dynamic condition added for the first dimension table, dynamic Condition makes the data of the nearest dimension processing time period stored in the second dimension table the first dimension table of preservation;Pass through second Dimension table inquires about the data of a nearest dimension processing time period, solves nearest to big dimension table inquiry in analytical database During the data of one processing time period, the problem of slow efficiency comparison of inquiry velocity is low has reached and has accelerated inquiry velocity, raising The effect of search efficiency.
Above-mentioned first embodiment is further comprising the steps of:The index in true table is obtained, wherein, true table storage is all to be referred to Mark data.
The true each data warehouse of table editor includes one or more fact table.Fact table may be included Business sales data, such as cash register affairs.Produced data, fact table generally comprises substantial amounts of row.Factual data Being mainly characterized by of table includes numerical data, and these digital informations can collect, to provide units concerned as history Data, each fact table includes an index being made up of some, and the index is included to be tieed up as the correlation of external key The major key of table is spent, and dimension table includes the characteristic of true record.Fact table should not include descriptive information, also should not This includes except digital metric field and makes any data in true and dimension table in addition to the relative index field of respective items.Comprising " metric " in fact table has two kinds:A kind of is the metric that can add up, and another is non-accumulative metric. Most useful metric is the metric that can add up, and its numeral added up is significantly.User can be by tired Count metric and obtain summary information, for example.The sales situation of the particular commodity in one group of shop in the specific period can be collected.It is non- Accumulative metric can be used for fact table, and single summarized results is usually nonsensical, for example, at mansion During diverse location measurement temperature, if it is nonsensical that the temperature of all diverse locations in mansion, which is added up, but it is averaging Value is meaningful.
In general, a fact table will be associated with one or more dimension tables, and user is utilizing true number When creating cube according to table, one or more dimension tables can be used.
By the second dimension table and the Index Establishment mapping relations in true table.
Mapping refers to the relation of element mutually " correspondence " between the collection of two elements, also refers to " formation corresponding relation ".It will obtain Index sets up mapping relations with the second dimension table in true table.
By mapping relations, the data of a nearest dimension processing time period are inquired about by the second dimension table, are looked into Ask result.
By the second dimension table and Index Establishment mapping relations, when inquiring about nearest dimension processing by the second dimension table Between the cycle data, its corresponding index can be mapped to accordingly by the second dimension table.Poll-final, so as to can just succeed Return Query Result.
Fig. 2 is the flow chart of the second embodiment of the data query method of the database according to the present invention.As shown in figure 1, This method includes steps S201 to step S206:
Member value sum in step S201, the first dimension table of detection, wherein, include multiple members in the first dimension table Value, member value sum is used for the total quantity for representing multiple member value.
Step S202, judges whether member value sum is more than the first predetermined threshold value.
First predetermined threshold value refers to refer to the big default numerical value of dimension member value total quantity.
Step S203, in the case where member value sum is more than the first predetermined threshold value, obtains the first dimension table.
In the case where member value sum is more than the first predetermined threshold value, the first dimension table is obtained.Even if filtering out member value Sum is more than the big dimension table of the first predetermined threshold value, obtains big dimension table.
Step S204, obtains the second dimension table created in the second database.
The step is with above-mentioned steps S102.
Step S205, obtains the dynamic condition added for the first dimension table.
The step is with above-mentioned steps S103.
Step S206, the data of a nearest dimension processing time period are inquired about by the second dimension table.
The step is with above-mentioned steps S104.
The data query method of the database provided in embodiments of the invention, by detecting member value in the first dimension table Sum, wherein, include multiple member value in the first dimension table, member value sum is used for the total quantity for representing multiple member value; Judge whether member value sum is more than the first predetermined threshold value;In the case where member value sum is more than the first predetermined threshold value, obtain First dimension table, obtains the second dimension table created in the second database, obtains the dynamic condition added for the first dimension table, The data of a nearest dimension processing time period are inquired about by the second dimension table, are solved to big dimension table in analytical database When inquiring about the data of a nearest processing time period, the problem of slow efficiency comparison of inquiry velocity is low has reached and has accelerated inquiry Speed, the effect for improving search efficiency.
Fig. 3 is the flow chart of the 3rd embodiment of the data query method of the database according to the present invention.As shown in figure 3, This method includes steps S301 to step S307:
Step S301, obtains the first dimension table in the first database.
The step is with above-mentioned steps S101.
Step S302, obtains the second dimension table created in the second database.
The step is with above-mentioned steps S102.
Step S303, obtains the dynamic condition added for the first dimension table.
The step is with above-mentioned steps S103.
Step S304, the data of a nearest dimension processing time period are inquired about by the second dimension table.
The step is with above-mentioned steps S104.
The inquiry knot of the data of a nearest dimension processing time period is inquired about in step S305, detection by the second dimension table Really.
Step S306, Query Result is sent to inquiry Distributor;Wherein, inquiry Distributor is used to collect institute There are inquiry request information and Query Result.
In data processing field, inquiry Distributor is used for all inquiry request information in collection system, and will look into Ask solicited message and be sent to inquiry server.When inquiry server lookup terminates, inquiry Distributor receives inquiry server Query Result.It is connected by data query server with inquiry Distributor, inquires about Distributor by the progress of collection The information of data query is sent to data query server, and data query server obtains data query information.Looked into by data The information of inquiry, data query server sends query statement, and inquiry Distributor obtains Query Result.Data query server After progress data query terminates, Query Result is sent to inquiry Distributor, inquiry Distributor obtains inquiry and tied Really.
Step S307, inquiry Distributor sends Query Result information to client.
Query Result is fed back to client by inquiry Distributor, can obtain the Query Result from client.This step Purpose Query Result can be made into feedback in time, be easy to obtain Query Result in time.
The data query method of the database provided in embodiments of the invention, by obtaining first in the first database Dimension table, obtains the second dimension table created in the second database, obtains the dynamic condition added for the first dimension table, passes through Second dimension table inquires about the data of a nearest dimension processing time period, and detection inquires about a nearest dimension by the second dimension table Spend the Query Result of the data of processing time period;Query Result is sent to inquiry Distributor, wherein, inquiry distribution clothes Business device is used to collect all inquiry request information and Query Result;Inquiry Distributor sends Query Result information to client End, is solved to when big dimension table inquires about the data of a nearest processing time period in analytical database, inquiry velocity is imitated slowly Rate than it is relatively low the problem of, reached the effect for improving search efficiency and being capable of feedback query result in time.
It should be noted that can be in such as one group computer executable instructions the step of the flow of accompanying drawing is illustrated Performed in computer system, and, although logical order is shown in flow charts, but in some cases, can be with not The order being same as herein performs shown or described step.
Fig. 4 is the schematic diagram of the first embodiment of the data query arrangement of the database according to the present invention.The database Data query arrangement includes:First acquisition unit 10, second acquisition unit 20, the 3rd acquiring unit 30 and query unit 40.
First acquisition unit 10, for obtaining the first dimension table in the first database, the first database, which is used to store, to be tieed up Spend all data in table.
Second acquisition unit 20, for obtaining the second dimension table created in the second database, wherein, the second database is The database inquired about for data processing.
3rd acquiring unit 30, for obtaining the dynamic condition added for the first dimension table, dynamic condition makes the second dimension Degree table preserves the data of the nearest dimension processing time period stored in the first dimension table.
Query unit 40, the data for inquiring about a nearest dimension processing time period by the second dimension table.
The data query arrangement of the database provided in embodiments of the invention, the device includes:First acquisition unit 10 The first dimension table in the first database is obtained, the first database is used to store all data, second acquisition unit in dimension table The second dimension table created in 20 the second databases of acquisition, wherein, the second database is the database inquired about for data processing, 3rd acquiring unit 30 obtains the dynamic condition added for the first dimension table, and dynamic condition makes the second dimension table preserve the first dimension The data of the nearest dimension processing time period stored in degree table, query unit 40 inquires about nearest one by the second dimension table The data of individual dimension processing time period.Solve and a nearest processing time period is inquired about to big dimension table in analytical database Data when, the problem of slow efficiency comparison of inquiry velocity is low has reached the effect for accelerating inquiry velocity, improving search efficiency Really.
Fig. 5 is the schematic diagram of the second embodiment of the data query arrangement of the database according to the present invention.The database Data query arrangement includes:First acquisition unit 10, second acquisition unit 20, the 3rd acquiring unit 30 and query unit 40.Its Middle query unit 40 includes:Second acquisition module 401, the enquiry module 403 of creation module 402 and first.
First acquisition unit 10, second acquisition unit 20, the effect of the 3rd acquiring unit 30 and query unit 40 with it is above-mentioned Act on identical in embodiment, will not be repeated here.
Second acquisition module 401, for obtaining the index in true table, wherein, true table stores all achievement datas.
Creation module 402, for by the second dimension table and the Index Establishment mapping relations in true table.
First enquiry module 403, when being handled for by mapping relations, a nearest dimension to be inquired about by the second dimension table Between the cycle data, obtain Query Result.
Fig. 6 is the schematic diagram of the 3rd embodiment of the data query arrangement of the database according to the present invention.The database Data query arrangement includes:First acquisition unit 10, second acquisition unit 20, the 3rd acquiring unit 30 and query unit 40.Its Middle query unit 40 includes:3rd detection module 404, the enquiry module 406 of sending module 405 and second.
First acquisition unit 10, second acquisition unit 20, the effect of the 3rd acquiring unit 30 and query unit 40 with it is above-mentioned Act on identical in embodiment, will not be repeated here.
3rd detection module 404, a nearest dimension processing time period is inquired about for detecting by the second dimension table The Query Result of data.
Sending module 405, for Query Result to be sent to inquiry Distributor, wherein, inquiry Distributor is used In all inquiry request information of collection and Query Result.
Second enquiry module 406, sends Query Result information to client for inquiring about Distributor.
The data query arrangement of the database provided in embodiments of the invention, the device includes:First acquisition unit 10 The first dimension table in the first database is obtained, the first database is used to store all data, second acquisition unit in dimension table The second dimension table created in 20 the second databases of acquisition, wherein, the second database is the database inquired about for data processing, 3rd acquiring unit 30 obtains the dynamic condition added for the first dimension table, and dynamic condition makes the second dimension table preserve the first dimension The data of the nearest dimension processing time period stored in degree table, query unit 40 inquires about nearest one by the second dimension table The data of individual dimension processing time period, the second acquisition module 401 obtains the index in true table, wherein, true table stores institute There is achievement data;Creation module 402 is by the second dimension table and the Index Establishment mapping relations in true table;First enquiry module 403, by mapping relations, the data of a nearest dimension processing time period are inquired about by the second dimension table, obtain inquiry knot Really.Solve to when big dimension table inquires about the data of a nearest processing time period in analytical database, inquiry velocity is imitated slowly Rate than it is relatively low the problem of, reached the effect for improving search efficiency and being capable of feedback query result in time.
Obviously, those skilled in the art should be understood that above-mentioned each module of the invention or each step can be with general Computing device realize that they can be concentrated on single computing device, or be distributed in multiple computing devices and constituted Network on, alternatively, the program code that they can be can perform with computing device be realized, it is thus possible to they are stored Performed in the storage device by computing device, either they are fabricated to respectively each integrated circuit modules or by they In multiple modules or step single integrated circuit module is fabricated to realize.So, the present invention is not restricted to any specific Hardware and software is combined.
The preferred embodiments of the present invention are the foregoing is only, are not intended to limit the invention, for the skill of this area For art personnel, the present invention can have various modifications and variations.Within the spirit and principles of the invention, that is made any repaiies Change, equivalent substitution, improvement etc., should be included in the scope of the protection.

Claims (10)

1. a kind of data query method of database, it is characterised in that including:
The first dimension table in the first database is obtained, wherein, first database is used to store all data in dimension table;
The second dimension table created in the second database is obtained, wherein, second database is to be inquired about for data processing Database, second database is analytical database;
The dynamic condition added for first dimension table is obtained, wherein, the dynamic condition protects second dimension table Deposit the data of the nearest dimension processing time period stored in first dimension table;And
The data of a nearest dimension processing time period are inquired about by second dimension table.
2. according to the method described in claim 1, it is characterised in that the first dimension table obtained in the first database includes:
Member value sum in first dimension table is detected, wherein, include multiple member value in first dimension table, it is described Member value sum is used for the total quantity for representing the multiple member value;
Judge whether the member value sum is more than the first predetermined threshold value;And
In the case where member value sum is more than first predetermined threshold value, first dimension table is obtained.
3. according to the method described in claim 1, it is characterised in that inquired about by second dimension table at a nearest dimension The data of reason time cycle include:
The index in true table is obtained, wherein, the true table stores all achievement datas;
By the Index Establishment mapping relations in second dimension table and the true table;And
By the mapping relations, the data of a nearest dimension processing time period are inquired about by second dimension table, are obtained To Query Result.
4. according to the method described in claim 1, it is characterised in that obtain the dynamic bar set for first dimension table Part, the dynamic condition makes second dimension table preserve the nearest dimension processing time stored in first dimension table It is described before the data that a nearest dimension processing time period is inquired about by second dimension table after the data in cycle Method also includes:
The data processing time cycle of second dimension table is detected, wherein, the data processing time cycle is to pre-set Time cycle;And
According to the data processing time cycle, data processing is carried out to second dimension table.
5. according to the method described in claim 1, it is characterised in that inquired about by second dimension table at a nearest dimension Include after the data for managing the time cycle:
Detect the Query Result for the data that a nearest dimension processing time period is inquired about by second dimension table;
The Query Result is sent to inquiry Distributor, wherein, the inquiry Distributor is used to collect all look into Ask solicited message and Query Result;And
The inquiry Distributor sends the Query Result information to client.
6. a kind of data query arrangement of database, it is characterised in that including:
First acquisition unit, for obtaining the first dimension table in the first database, wherein, first database is used to store All data in dimension table;
Second acquisition unit, for obtaining the second dimension table created in the second database, wherein, second database is use The database inquired about in data processing, second database is analytical database;
3rd acquiring unit, for obtaining the dynamic condition added for first dimension table, wherein, the dynamic condition makes Second dimension table preserves the data of the nearest dimension processing time period stored in first dimension table;And
Query unit, the data for inquiring about a nearest dimension processing time period by second dimension table.
7. device according to claim 6, it is characterised in that the first acquisition unit includes:
First detection module, for detecting member value sum in first dimension table, wherein, wrapped in first dimension table Multiple member value are included, the member value sum is used for the total quantity for representing the multiple member value;
Judge module, for judging whether the member value sum is more than the first predetermined threshold value;And
First acquisition module, in the case of being more than first predetermined threshold value in member value sum, obtains described the Dimension table.
8. device according to claim 6, it is characterised in that the query unit includes:
Second acquisition module, for obtaining the index in true table, wherein, the true table stores all achievement datas;
Creation module, for by the Index Establishment mapping relations in second dimension table and the true table;And
First enquiry module, for by the mapping relations, inquiring about a nearest dimension by second dimension table and handling The data of time cycle, obtain Query Result.
9. device according to claim 6, it is characterised in that described device also includes:
Second detection module, the data processing time cycle for detecting second dimension table, wherein, during the data processing Between the cycle be the time cycle pre-set;And
Processing module, for according to the data processing time cycle, data processing to be carried out to second dimension table.
10. device according to claim 6, it is characterised in that after the query unit, described device also includes:
3rd detection module, the data of a nearest dimension processing time period are inquired about for detecting by second dimension table Query Result;
Sending module, for the Query Result to be sent to inquiry Distributor, wherein, the inquiry Distributor is used In all inquiry request information of collection and Query Result;And
Second enquiry module, sends the Query Result information to client for the inquiry Distributor.
CN201410455910.9A 2014-09-09 2014-09-09 The data query method and device of database Active CN104182546B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410455910.9A CN104182546B (en) 2014-09-09 2014-09-09 The data query method and device of database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410455910.9A CN104182546B (en) 2014-09-09 2014-09-09 The data query method and device of database

Publications (2)

Publication Number Publication Date
CN104182546A CN104182546A (en) 2014-12-03
CN104182546B true CN104182546B (en) 2017-10-27

Family

ID=51963585

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410455910.9A Active CN104182546B (en) 2014-09-09 2014-09-09 The data query method and device of database

Country Status (1)

Country Link
CN (1) CN104182546B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106503054A (en) * 2016-09-26 2017-03-15 深圳市金立通信设备有限公司 A kind of data query method and server
CN110019544B (en) * 2017-09-30 2022-08-19 北京国双科技有限公司 Data query method and system
CN109672992B (en) * 2019-01-24 2020-07-10 国佳云为(常州)信息科技有限公司 Data collection and updating method and system
CN111831695B (en) * 2020-07-10 2023-09-08 四川明星电力股份有限公司 Query system and method for line loss information of transformer area

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102867071A (en) * 2012-10-19 2013-01-09 烽火通信科技股份有限公司 Management method for massive network management historical data
CN103258054A (en) * 2013-05-31 2013-08-21 闫朝升 Method and device for processing data
CN103473271A (en) * 2013-08-20 2013-12-25 苏州迈科网络安全技术股份有限公司 Optimized storing method for mass data
CN103544317A (en) * 2013-11-05 2014-01-29 北京国双科技有限公司 Dimension table data processing method and device
CN103744913A (en) * 2013-12-27 2014-04-23 高新兴科技集团股份有限公司 Database retrieval method based on search engine technology
CN103927337A (en) * 2014-03-26 2014-07-16 北京国双科技有限公司 Method and device for processing data of association relationships in online analytical processing

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7814094B2 (en) * 2005-09-29 2010-10-12 Teradata Us, Inc. Optimizing access to a database by utilizing a star join

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102867071A (en) * 2012-10-19 2013-01-09 烽火通信科技股份有限公司 Management method for massive network management historical data
CN103258054A (en) * 2013-05-31 2013-08-21 闫朝升 Method and device for processing data
CN103473271A (en) * 2013-08-20 2013-12-25 苏州迈科网络安全技术股份有限公司 Optimized storing method for mass data
CN103544317A (en) * 2013-11-05 2014-01-29 北京国双科技有限公司 Dimension table data processing method and device
CN103744913A (en) * 2013-12-27 2014-04-23 高新兴科技集团股份有限公司 Database retrieval method based on search engine technology
CN103927337A (en) * 2014-03-26 2014-07-16 北京国双科技有限公司 Method and device for processing data of association relationships in online analytical processing

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
面向聚集查询的语义缓存技术;蔡建宇 等;《软件学报》;20070228;第18卷(第2期);摘要,第2.3节,第3.1节 *

Also Published As

Publication number Publication date
CN104182546A (en) 2014-12-03

Similar Documents

Publication Publication Date Title
CN102214187B (en) Complex event processing method and device
US20180314854A1 (en) Event processing system
CN109995650B (en) SDN network-based path calculation method and device under multidimensional constraint
CN109189782A (en) A kind of indexing means in block chain commodity transaction inquiry
CN104182546B (en) The data query method and device of database
MX2012003721A (en) Systems and methods for social graph data analytics to determine connectivity within a community.
CN110502546A (en) A kind of data processing method and device
CN109472568A (en) A kind of block chain method of commerce, device, management system, equipment and storage medium
CN106933989A (en) A kind of method of Web realease information system
US9135630B2 (en) Systems and methods for large-scale link analysis
CN104618304B (en) Data processing method and data handling system
CN107483381A (en) The monitoring method and device of interlock account
CN106815258A (en) A kind of date storage method and coordinator node
CN104217032B (en) The processing method and processing device of database dimension
CN106033438A (en) Public sentiment data storage method and server
US10055469B2 (en) Method and software for retrieving information from big data systems and analyzing the retrieved data
CN106952085A (en) A kind of method and device of data storage and Business Processing
CN110119396A (en) Data managing method and Related product
CN104268293B (en) The index treating method and apparatus that can not add up in database
US10970417B1 (en) Differential privacy security for benchmarking
CN101819569A (en) Expert system for worksheet preprocessing and worksheet preprocessing method
CN106469166B (en) A kind of information processing method and device
CN107562858A (en) A kind of method and apparatus of menu manager
CN112347099A (en) Data processing method and device, computing equipment and computer readable storage medium
CN107622090A (en) Acquisition methods, the apparatus and system of object

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: Method and device for querying data in databases

Effective date of registration: 20190531

Granted publication date: 20171027

Pledgee: Shenzhen Black Horse World Investment Consulting Co.,Ltd.

Pledgor: BEIJING GRIDSUM TECHNOLOGY Co.,Ltd.

Registration number: 2019990000503

PE01 Entry into force of the registration of the contract for pledge of patent right
CP02 Change in the address of a patent holder

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

Patentee after: BEIJING GRIDSUM TECHNOLOGY Co.,Ltd.

Address before: 100086 Beijing city Haidian District Shuangyushu Area No. 76 Zhichun Road cuigongfandian 8 layer A

Patentee before: BEIJING GRIDSUM TECHNOLOGY Co.,Ltd.

CP02 Change in the address of a patent holder
PP01 Preservation of patent right

Effective date of registration: 20240604

Granted publication date: 20171027