CN107735781A - Store method and apparatus, the computing device of Query Result - Google Patents

Store method and apparatus, the computing device of Query Result Download PDF

Info

Publication number
CN107735781A
CN107735781A CN201580001205.4A CN201580001205A CN107735781A CN 107735781 A CN107735781 A CN 107735781A CN 201580001205 A CN201580001205 A CN 201580001205A CN 107735781 A CN107735781 A CN 107735781A
Authority
CN
China
Prior art keywords
inquiry
major key
determined
target query
query
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
CN201580001205.4A
Other languages
Chinese (zh)
Other versions
CN107735781B (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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Publication of CN107735781A publication Critical patent/CN107735781A/en
Application granted granted Critical
Publication of CN107735781B publication Critical patent/CN107735781B/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

Landscapes

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

Abstract

A kind of method and apparatus for storing Query Result.This method includes:Multiple queries table corresponding to the first inquiry request is determined, wherein, first inquiry request is used to ask to be associated the plurality of inquiry table inquiry (S110);Target query table is determined from the plurality of inquiry table, wherein, the fact that the target query table is at least one inquiry table in addition to the target query table in the plurality of inquiry table table, and the fact that the target query table is not present in the plurality of inquiry table table (S120);According to the target query table, the major key of the first table is determined, wherein, first table is used to store Query Result (S130) corresponding to first inquiry request;According to the major key of first table, the Query Result is stored to first table (S140).The method and apparatus of the storage Query Result, the problem of search efficiency is low when can avoid being associated inquiry to the first table in the prior art, so as to improve the efficiency of correlation inquiry.

Description

It stores the method and apparatus of query result, calculate equipment Technical field
The present invention relates to database fields, and more particularly, to the method and apparatus of storage query result, calculating equipment.
Background technique
Transaction Processing Performance Council's benchmark (Transaction Processing Performance Council BenchmarkTMH, TPC-H) it is mainly used to simulate the application environment of authentic commercial, including simulating the dynamic queries to authentic commercial transaction data base, using the reference as decision support and database application system.
TPC-H relates generally to following concept:
True table, for storing at least one fact record, a line in each corresponding true table of true record, and including key assignments column and metric column, wherein, the dimension of the corresponding true record of value in key assignments column, such as, the commodity place of production, commodity price, commodity amount, trade date, type of merchandize, product name, etc.;Value in metric column corresponds to the subject content of true table, for example, sales volume or sales volume, etc..
Dimension table, for storing the dimensional properties of true record, dimension table may include name column and attribute column, such as, it include three column in this dimension table of the commodity place of production, (locationId) and address (Address) is numbered in place of production title (locationName), the place of production, wherein, the entitled name column in the place of production, place of production number and address are attribute column.Key assignments column in true table can correspond to the attribute column in dimension table, and each key assignments column in true table can correspond to a dimension table.
Interim table, for storing ephemeral data.Interim table is broadly divided into the interim table of transaction-level and the interim table of session level, wherein the interim table of transaction-level is automatically deleted after affairs submission, and the interim table of session level is deleted after the session is completed.
Major key, the column in unique identification table, any two row has different Major keys in a table, and major key is not allow for null value.Generally, the major key of table is the first row of table.
External key, for connecting two tables, if the column M in Table A is corresponding with the column N in table B, i.e. column M and column N correspond to identical attribute, for example, both corresponding to order number, and arranging M is the major key in Table A, then arranging N is the external key in table B.The external key of true table corresponds to the major key of dimension table.
In Database Systems, when carrying out the associated complex query of multiple tables, if the data volume of multiple tables is larger, a query statement can be resolved into multiple queries substatement, and pass through large-scale parallel Multiple inquiry substatement is distributed on multiple nodes of cluster by processing (Massively Parallel Processing, MPP) mechanism.Each node can be inquired according to the inquiry substatement received, and the corresponding query result of inquiry substatement is stored in interim table.After multiple node completes inquiry, inquiry can be associated to the interim table that each node obtains using query statement, to obtain final query result.
By taking the Q7 of TPC-H inquiry and SQL as an example, if to inquire one between nineteen ninety-five to 1997 and in belonging country, supplier and client belonging country of Shipping Date is France, another is the transaction record of Germany, can use query statement as shown in Table 1.
1 TPC-H Q7 query statement example of table
Wherein, in sql like language, " select [A] from [TABLE B] where [C] " indicates to choose the data for recording corresponding column A for meeting querying condition C from table B.It is related to complex query in above-mentioned example, wherein, the inquiry table that the subquery in the complex query is related to includes: supplier (supplier) table, project (lineitem) table, order (orders) table, client (customer) table, country's (nation) table for being named as n1 and another national (nation) table for being named as n2.The query result that the subquery obtains is inserted into shipment (shipping) table, and the data of column supp_nation, cust_nation, l_year are then chosen from table shipping and carry out the data for the column revenue that summation obtains by the data to column volume.
In order to improve search efficiency, the corresponding query statement of above-mentioned complex query can be resolved into two inquiry substatements, wherein, first inquiry substatement is as shown in table 2, for being associated inquiry to table orders, table n1, table n2 and table customer, and query result is inserted into interim table q7_tmp_order_customer;Second inquiry substatement is as shown in table 3, for table lineitem, Table n1, table n2 and table supplier are associated inquiry, and query result is inserted into interim table q7_tmp_lineitem_supplier.Finally, inquiry can be associated to interim table q7_tmp_order_customer and q7_tmp_lineitem_supplier by query statement shown in table 4, to obtain final query result.
2 first inquiry substatements of table
3 second inquiry substatements of table
Table 4 is used to be associated two interim tables the query statement of inquiry
The interim table q7_tmp_lineitem_supplier example of table 5
Wherein, " insert into [table A] " indicates for be inserted into Table A query result.However, due to being deposited the corresponding query result of substatement will be inquired when establishing interim table and the major key of not specified interim table When storage to interim table, node can actively be that the interim table adds a major key without practical significance, such as, as shown in table 5, node is inserted into interim table using the column ID that numerical value is line number as the major key of interim table q7_tmp_lineitem_supplier using query result as other column other than major key.In this way, can have repetition values when being associated inquiry to multiple interim tables in one or more column in multiple interim table, need to be filtered every record in query process, lead to the inefficiency of multilist correlation inquiry.To solve the above-mentioned problems, creation index can be arranged one at least one interim table, but since interim table is only used for current queries, the cost for creating index is higher, further, since the data of interim table need to be frequently inserted into, it is thus possible to will cause index failure.
Summary of the invention
The embodiment of the present invention provides a kind of method and apparatus of storage query result, calculates equipment, can be avoided the problem that search efficiency is low when being associated inquiry in the prior art.
In a first aspect, providing a kind of method for storing query result, comprising: determine the corresponding multiple queries table of the first inquiry request, wherein first inquiry request is associated inquiry to multiple inquiry table for requesting;Target query table is determined from multiple inquiry table, wherein the fact that the target query table is not present in multiple inquiry table table, and the fact that the target query table is at least one inquiry table in addition to the target query table in multiple inquiry table table;According to the target query table, the major key of the first table is determined, wherein first table is for storing the corresponding query result of the first inquiry request;According to the major key of first table, which is stored to first table.
In the first possible implementation, the major key according to first table, which is stored to first table, comprising: according to the major key of first table, stored the query result to first table in a manner of column cluster.
In conjunction with above-mentioned possible implementation, in the second possible implementation, target query table should be determined from multiple inquiry table, comprise determining that at least one corresponding first correlation inquiry condition of first inquiry request, wherein, the first correlation inquiry condition is made of the secondary series in the first row and the second inquiry table in the first inquiry table, and multiple inquiry table includes first inquiry table and second inquiry table different from first inquiry table;Determine the incidence relation between at least one corresponding first inquiry table of the first correlation inquiry condition and second inquiry table;According to the incidence relation between first inquiry table and second inquiry table, the target query table is determined from first inquiry table and second inquiry table.
In conjunction with above-mentioned possible implementation, in the third possible implementation, the incidence relation between the determination first inquiry table and second inquiry table, comprising: determine the first row of first inquiry table Whether be first inquiry table major key;If the first of first inquiry table is classified as the major key of first inquiry table, the fact that second inquiry table is first inquiry table table is determined;If the first of first inquiry table is classified as the external key of first inquiry table, the fact that first inquiry table is second inquiry table table is determined.
In conjunction with above-mentioned possible implementation, in the fourth possible implementation, the corresponding first correlation inquiry condition of first inquiry request;The third determines that subelement is specifically used for: if the second determining subelement determines the fact that second inquiry table is first inquiry table table, it is determined that second inquiry table is the target query table;If the second determining subelement determines the fact that first inquiry table is second inquiry table table, it is determined that first inquiry table is the target query table.
In conjunction with above-mentioned possible implementation, in a fifth possible implementation, which corresponds to multiple first correlation inquiry conditions;This is according to the incidence relation between first inquiry table and second inquiry table, the target query table is determined from first inquiry table and second inquiry table, it include: according to the incidence relation between first inquiry table and second inquiry table, establish incidence relation tree, wherein, if the fact that second inquiry table is first inquiry table table, which is the father node of first inquiry table;The root node of the incidence relation tree is determined as the target query table.
In conjunction with above-mentioned possible implementation, in a sixth possible implementation, this determines the major key of first table according to the target query table, comprising: determines the non-joint major key that whether there is the target query table in the corresponding multiple column of the query result;If the non-joint major key of the target query table to be determined as to the major key of first table there are the non-joint major key of the target query table in multiple column.
In conjunction with above-mentioned possible implementation, in the 7th kind of possible implementation, this is according to the target query table, determine the major key of first table, further include: if the non-joint major key of the target query table is not present in multiple column, determine that the second inquiry request corresponding with first inquiry request, second inquiry request are associated inquiry to first table and the second table for requesting;According to second inquiry request, the major key of first table is determined.
In conjunction with above-mentioned possible implementation, in the 8th kind of possible implementation, this is according to second inquiry request, determine the major key of first table, comprise determining that at least one corresponding second correlation inquiry condition of second inquiry request, wherein, which is made of the 4th column of the third of first table column and second table;The second target association querying condition is determined at least one second correlation inquiry condition from this, which includes the major key of second table;The third column for first table for including in the second target association querying condition are determined as to the major key of first table.
Second aspect provides a kind of device for storing query result, comprising: the first determination unit, for determining the corresponding multiple queries table of the first inquiry request, wherein first inquiry request is for request pair Multiple inquiry table is associated inquiry;Second determination unit, for determining target query table from multiple inquiry table that first determination unit determines, wherein, the fact that the target query table is not present in multiple inquiry table table, and the fact that the target query table is at least one inquiry table in addition to the target query table in multiple inquiry table table;Third determination unit, the target query table for being determined according to second determination unit, determines the major key of the first table, wherein first table is for storing the corresponding query result of the first inquiry request;Storage unit, the major key of first table for being determined according to the third determination unit, which is stored to first table.
In the first possible implementation, which is specifically used for: according to the major key for first table that the third determination unit determines, being stored the query result to first table in a manner of column cluster.
In conjunction with above-mentioned possible implementation, in the second possible implementation, second determination unit includes: the first determining subelement, for determining at least one corresponding first correlation inquiry condition of first inquiry request, wherein, the first correlation inquiry condition is made of the secondary series in the first row and the second inquiry table in the first inquiry table, and multiple inquiry table includes first inquiry table and second inquiry table different from first inquiry table;Second determines subelement, for determining the incidence relation between the first determining subelement determining corresponding first inquiry table of at least one first correlation inquiry condition and second inquiry table;Third determines subelement, and the incidence relation between first inquiry table and second inquiry table for being determined according to the second determining subelement determines the target query table from first inquiry table and second inquiry table.
In conjunction with above-mentioned possible implementation, in the third possible implementation, this second determine subelement be specifically used for: determine the first row in first inquiry table whether be first inquiry table major key;If first in first inquiry table is classified as the major key of first inquiry table, the fact that second inquiry table is first inquiry table table is determined;If first in first inquiry table is classified as the external key of first inquiry table, the fact that first inquiry table is second inquiry table table is determined.
In conjunction with above-mentioned possible implementation, in the fourth possible implementation, the corresponding first correlation inquiry condition of first inquiry request;The third determines that subelement is specifically used for: if the second determining subelement determines the fact that second inquiry table is first inquiry table table, it is determined that second inquiry table is the target query table;If the second determining subelement determines the fact that first inquiry table is second inquiry table table, it is determined that first inquiry table is the target query table.
In conjunction with above-mentioned possible implementation, in a fifth possible implementation, which corresponds to multiple first correlation inquiry conditions;The third determines that subelement is specifically used for: the incidence relation between first inquiry table and second inquiry table determined according to the second determining subelement is established association and is closed System tree, wherein if the fact that second inquiry table is first inquiry table table, which is the father node of first inquiry table;The root node of the incidence relation tree is determined as the target query table.
In conjunction with above-mentioned possible implementation, in a sixth possible implementation, which includes: the 4th determining subelement, for determining the non-joint major key that whether there is the target query table in the corresponding multiple column of the query result;5th determines subelement, if determining that subelement determines the non-joint major key in multiple column there are the target query table for the 4th, the non-joint major key of the target query table is determined as to the major key of first table.
In conjunction with above-mentioned possible implementation, in the 7th kind of possible implementation, the third determination unit further include: the 6th determines subelement, if determining that subelement determines the non-joint major key in multiple column there is no the target query table for the 4th, determine that the second inquiry request corresponding with first inquiry request, second inquiry request are associated inquiry to first table and the second table for requesting;7th determines subelement, for determining determining second inquiry request of subelement according to the 6th, determines the major key of first table.
In conjunction with above-mentioned possible implementation, in the 8th kind of possible implementation, 7th determines that subelement is specifically used for: determining at least one corresponding second correlation inquiry condition of second inquiry request, wherein, which is made of the 4th column of the third of first table column and second table;The second target association querying condition is determined at least one second correlation inquiry condition from this, which includes the major key of second table;The third column for first table for including in the second target association querying condition are determined as to the major key of first table.
The third aspect provides a kind of calculating equipment, comprising: processor, memory and bus;The memory is for storing computer executed instructions, the processor is connect with the memory by the bus, when calculating equipment operation, the processor reads the computer executed instructions of memory storage, the method for the storage query result in any possible implementation to execute first aspect or first aspect.
Based on the above-mentioned technical proposal, the method and apparatus of storage query result provided in an embodiment of the present invention, calculate equipment, target query table is determined from the corresponding multiple queries table of the first inquiry request, wherein, the fact that the target query table is at least one inquiry table in multiple inquiry table in addition to target query table table, and the fact that the target query table is not present in multiple inquiry table table, and the major key for storing the first table of query result is determined according to the target query table, can be avoided in the prior art due to by no practical significance column as the first table major key and cause it is subsequent inquiry is associated to the first table when the low problem of search efficiency, to improve the efficiency of correlation inquiry.
Detailed description of the invention
To describe the technical solutions in the embodiments of the present invention more clearly, the embodiment of the present invention or attached drawing needed to be used in the description of the prior art will be briefly described below, apparently, drawings described below is only some embodiments of the present invention, for those of ordinary skill in the art, without creative efforts, it is also possible to obtain other drawings based on these drawings.
Fig. 1 is the schematic flow chart of the method for storage query result provided in an embodiment of the present invention.
Fig. 2 is another schematic flow chart of the method for storage query result provided in an embodiment of the present invention.
Fig. 3 is the schematic diagram of the incidence relation tree in the method example of storage query result provided in an embodiment of the present invention.
Fig. 4 is the schematic diagram of another incidence relation tree in the method example of storage query result provided in an embodiment of the present invention.
Fig. 5 is the schematic block diagram of the device of storage query result provided in an embodiment of the present invention.
Fig. 6 is the schematic block diagram of the device of another storage query result provided in an embodiment of the present invention.
Fig. 7 is the schematic block diagram provided in an embodiment of the present invention for calculating equipment.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is a part of the embodiments of the present invention, rather than whole embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art's every other embodiment obtained without making creative work, all should belong to the scope of protection of the invention.
It should be understood that, the technical solution of the embodiment of the present invention can be applied to various Database Systems, such as, Relational DBMS (Relational Database Management System, RDBMS), non-relational (NoSQL) Database Systems, MPP database (Massively Parallel Processing Database, MPP-DB), etc., it is not limited in the embodiment of the present invention.
It will also be understood that, the embodiment of the present invention is with structured query language (Structured Query Language, SQL it) is described for language, but the embodiment of the present invention can also use other language, for example, the query language (Hibernate Query Language, HQL) of object-oriented, etc., it is not limited in the embodiment of the present invention.
Fig. 1 is the schematic flow chart of the method 100 of the storage query result of the embodiment of the present invention, and this method 100 can be executed by the device of storage query result.Specifically, the device of the storage query result can be specially autonomous device or for a module in equipment, for example, the device of the storage query result It can be single machine or clustered node (cluster node), but the embodiment of the present invention is without being limited thereto.
S110 determines the corresponding multiple queries table of the first inquiry request, wherein first inquiry request is associated inquiry to multiple inquiry table for requesting.
The device of the storage query result can receive the first inquiry request from client, wherein the first inquiry request from client can pass through the device of the network equipment or other device forwards to the storage query result.First inquiry request can request to be associated inquiry to multiple inquiry table, for example, the corresponding query statement of the first inquiry request can be as shown in any table of the table 1 into table 4.First inquiry request can be an individual query, or the subquery of a complex query, it is not limited in the embodiment of the present invention.
The device of the storage query result can determine the corresponding multiple queries table of first inquiry request, and be associated inquiry to multiple first table according to first inquiry request.It at this point, may include where sentence in the corresponding query statement of the first inquiry request, and may include correlation inquiry condition in querying condition defined by where sentence.Correlation inquiry condition can be made of the column N in the column M and table B in Table A, and arranging M can be connected in query statement by equal sign with column N, such as, in the querying condition shown in table 1, query statement " where s_suppkey=l_suppkey " corresponds to a correlation inquiry condition, the correlation inquiry condition is made of the column suppkey in the column suppkey and table lineitem in table supplier, but the embodiment of the present invention is without being limited thereto.
S120 determines target query table from multiple inquiry table, wherein the fact that the target query table is at least one inquiry table in addition to the target query table in multiple inquiry table table, and the fact that the target query table is not present in multiple inquiry table table.
Multiple inquiry table includes the target query table.The fact that the target query table can be for one or more of multiple inquiry table other tables table, but the fact that do not include the target query table in multiple inquiry table table.Specifically, the device of the storage query result can determine the target query table, but the embodiment of the present invention is without being limited thereto according to the querying condition for including in first inquiry request from multiple inquiry table.
S130 determines the major key of the first table according to the target query table, wherein first table is for storing the corresponding query result of the first inquiry request.
The device of the storage query result can determine in several ways and store query result to first table.Optionally, first inquiry request can request to store the query result for being associated inquiry to multiple inquiry table to the first table, first table can be common table or interim table, correspondingly, the corresponding query statement of first inquiry request may include insert into sentence, and the device of the storage query result determines first table according to first inquiry request.Alternatively, the device of the storage query result can be with Actively determination stores the corresponding query result of the first inquiry request to first table, at this point, first table can be interim table, but the embodiment of the present invention is without being limited thereto.
S140 stores the query result to first table according to the major key of first table.
The query result may include the data for meeting the corresponding multiple column of target record of querying condition in multiple inquiry table, wherein, the data of the corresponding multiple column of the target record may include the data of at least one column in the target record, it or include the data of acquisition of being performed mathematical calculations by the data at least one column in the target record, here data can be with index value or character string, and it is not limited in the embodiment of the present invention.
Therefore, the method of storage query result according to an embodiment of the present invention, target query table is determined from the corresponding multiple queries table of the first inquiry request, wherein, the fact that the target query table is at least one inquiry table in multiple inquiry table in addition to target query table table, and the fact that the target query table is not present in multiple inquiry table table, and the major key for storing the first table of query result is determined according to the target query table, can be avoided in the prior art due to by no practical significance column as the first table major key and cause it is subsequent inquiry is associated to the first table when the low problem of search efficiency, to improve the efficiency of correlation inquiry.
In embodiments of the present invention, the corresponding multiple column of the query result may include the major key of first table, correspondingly, in S140, other column in the corresponding multiple column of the query result in addition to the major key of first table can be inserted into first table by the device of the storage query result in the form of non-primary key.Optionally, if there are repetition values for the major key of corresponding first table of the query result, then the device of the storage query result can store the corresponding multiple column of the query result in a manner of column cluster (Column Family), so that repetition values are not present in the major key in first table, but the embodiment of the present invention is without being limited thereto.
Optionally, S140 stores the query result to first table according to the major key of first table, comprising:
According to the major key of first table, the query result is stored to first table in a manner of column cluster.
Such as, the interim table q7_tmp_order_customer that first inquiry substatement as shown in Table 2 obtains can be stored in the form of column cluster shown in table 6, and the interim table q7_tmp_lineitem_supplier that second inquiry substatement as shown in Table 3 obtains can be stored in the form of column cluster shown in table 7.
The interim table q7_tmp_order_customer that table 6 is stored in the form of column cluster
The interim table q7_tmp_lineitem_supplier that table 7 is stored in the form of column cluster
Optionally, as another embodiment, before the query result is inserted into and is stored to first table, the device of the storage query result can determine that first table whether there is, if first table is not present, then the device of the storage query result can initially set up first table, and the query result is then inserted into first table and stores first table.If first table is existing, then query result directly can be inserted into first table by the device of the storage query result, or first table is deleted first and re-establishes first table, then query result is inserted into newly-built first table and stores first table, but the embodiment of the present invention is without being limited thereto.
In S120, the device of the storage query result can determine the target query table from multiple inquiry table in several ways.As an alternative embodiment, the device of the storage query result can determine the target query table according at least one corresponding first correlation inquiry condition of first inquiry request from multiple inquiry table.
Optionally, as shown in Fig. 2, S120, determines target query table from multiple inquiry table, comprising:
S121, determine at least one corresponding first correlation inquiry condition of first inquiry request, wherein, the first correlation inquiry condition is made of the secondary series in the first row and the second inquiry table in the first inquiry table, and multiple inquiry table includes first inquiry table and second inquiry table different from first inquiry table;
S122 determines the incidence relation between corresponding first inquiry table of the first correlation inquiry condition and second inquiry table;
S123 determines the target query table according to the incidence relation between first inquiry table and second inquiry table from first inquiry table and second inquiry table.
Specifically, in the corresponding query statement of the first inquiry request, the first row of first inquiry table can be connect with the secondary series of second inquiry table with equal sign.For second inquiry substatement shown in the table 3, it include two correlation inquiry conditions in the inquiry substatement, i.e., the correlation inquiry condition " s_nationkey=n1.n_nationkey " that the column nationkey in column nationkey and table n1 in correlation inquiry condition " l_suppkey=s_suppkey " the He Youbiao supplier being made of the column suppkey of the column suppkey of table lineitem and table supplier is constituted.The device of the storage query result can determine the target query table from table lineitem, table supplier and table n1.
Optionally, as another embodiment, S122 determines the incidence relation between first inquiry table and second inquiry table, comprising:
Determine first inquiry table first row whether be first inquiry table major key;
If the first of first inquiry table is classified as the major key of first inquiry table, the fact that second inquiry table is first inquiry table table is determined;
If the first of first inquiry table is classified as the external key of first inquiry table, the fact that first inquiry table is second inquiry table table is determined.
If the device of the storage query result determines first major key for being classified as first inquiry table, then show second external key for being classified as second inquiry table, at this time, the device of the storage query result can determine the fact that first inquiry table is the dimension table of second inquiry table, which is first inquiry table table.Optionally, if the device of the storage query result determines first external key for being classified as first inquiry table, then show second major key for being classified as second inquiry table, at this time, the device of the storage query result can determine the fact that first inquiry table is second inquiry table table, which is the dimension table of first inquiry table.
Alternatively, the device of the storage query result can also determine whether the secondary series is second inquiry table Major key, if second major key for being classified as second inquiry table, the device of the storage query result can determine the fact that first inquiry table is second inquiry table table;And if second external key for being classified as second inquiry table, the device of the storage query result can determine the fact that second inquiry table is first inquiry table table, but the embodiment of the present invention is without being limited thereto.
It should be understood that, in embodiments of the present invention, it can be seen directly that unless expressly stated or from context, term " major key " can refer to a column of unique identification a line, i.e. non-joint major key, at this point, the corresponding column of major key, can also refer to unique identification a line multiple row or can be with a column of other common unique identification a line of column, combine one of major key or joint major key, at this point, major key corresponds to the column in multiple row or multiple row, it is not limited in the embodiment of the present invention.
If first inquiry request corresponds to a first correlation inquiry condition, and the device of the storage query result determines the fact that second inquiry table is first inquiry table table, then the device of the storage query result can determine that second inquiry table is the target query table.If first inquiry request corresponds to multiple first correlation inquiry conditions, then the device of the storage query result can determine the incidence relation between two inquiry tables in each first correlation inquiry condition, and according to the incidence relation between two inquiry tables in the first correlation inquiry condition of each of multiple first correlation inquiry condition, determine the target query table.Still by taking second inquiry substatement shown in Fig. 3 as an example, the device of the storage query result can determine the incidence relation between incidence relation and table supplier and table n1 between table lineitem and table supplier.Wherein, the canonical form of table lineitem can be as shown in table 8, wherein the value of joint major key of the orderkey and linenumber as table lineitem, the value of orderkey and a linenumber being capable of a line in common ID table.The canonical form of table supplier can be as shown in table 9, wherein suppkey is the non-joint major key of table supplier, a line that can be separately identified in table.The canonical form for being named as the table nation of table n1 can be as shown in table 10, wherein nationkey is the major key of table n1.At this point, by table 8 and table 9 it is known that suppkey be the external key of table lineitem and be table supplier major key, then table lineitem be table supplier the fact table;By table 9 and table 10 it is known that nationkey be the external key of table supplier and be table n1 major key, then table supplier be table n1 the fact table.In these three inquiry tables of table lineitem, supplier and n1, the fact that table lineitem is table supplier table, and the fact that table lineitem is not present in table lineitem, supplier and n1 table, therefore, the device of the storage query result can determine that table lineitem is target query table.
Fig. 8 table lineitem example
Fig. 9 table supplier example
Figure 10 table nation example
Optionally, as another embodiment, the corresponding first correlation inquiry condition of first inquiry request;
Correspondingly, S123 determines the target query table according to the incidence relation between first inquiry table and second inquiry table from first inquiry table and second inquiry table, comprising:
If the fact that second inquiry table is first inquiry table table, it is determined that second inquiry table is the target query table;
If the fact that first inquiry table is second inquiry table table, it is determined that first inquiry table is the target query table.
Optionally, as another embodiment, if first inquiry request corresponds to multiple first correlation inquiry conditions, this is according to the incidence relation between first inquiry table and second inquiry table, the target query table is determined from first inquiry table and second inquiry table, comprising:
According to the incidence relation between first inquiry table and second inquiry table, incidence relation tree is established, wherein if the fact that second inquiry table is first inquiry table table, which is the father node of first inquiry table;
The root node of the incidence relation tree is determined as the target query table.
When establishing incidence relation tree, the device of the storage query result can be using true table as the father node of dimension table, and a node can have multiple child nodes.At this time, since the father node of root node is not present in the incidence relation tree, the fact that do not include root node i.e. in the incidence relation tree table, and there are the child nodes of the root node in the incidence relation tree, there is the dimension table of the root node, therefore, the root node of the incidence relation tree can be determined as the target query table by the device of the storage query result.Still shown in the table 3 for second inquiry substatement, the fact that according to table lineitem be table supplier table and table supplier the fact that be table n1 table, the device of the storage query result can establish incidence relation tree as shown in Figure 3, wherein, project (lineitem) table is the root node of the incidence relation tree, therefore, the device of the storage query result can determine that table lineitem is the corresponding target query table of the second inquiry substatement.Similarly, can first inquiry substatement according to shown in table 2 establish incidence relation tree as shown in Figure 4, wherein the root node of the incidence relation tree be order (orders) table, therefore the storage inquiry knot The device of fruit can determine that table orders is the corresponding target query table of first inquiry substatement shown in table 2, but the embodiment of the present invention is without being limited thereto.
Optionally, as another embodiment, S130 determines the major key of first table according to the target query table, comprising:
Determine the non-joint major key that whether there is the target query table in the corresponding multiple column of the query result;
If the non-joint major key of the target query table to be determined as to the major key of first table there are the non-joint major key of the target query table in multiple column.
Specifically, the device of the storage query result can determine that the major key of the target query table be joint major key is also non-joint major key, if the major key of the target query table is joint major key, the device of the storage query result can determine the non-joint major key that the target query table is not present in the corresponding multiple column of the query result.For second inquiry substatement shown in the table 3, the corresponding target query table of this second inquiry substatement is table lineitem, and the major key of table lineitem is the joint major key being made of orderkey and linenumber, then the device of the storage query result can determine do not include in the corresponding multiple column of the query result table orders non-joint major key, but the embodiment of the present invention is without being limited thereto.
Optionally, if the major key of the target query table is non-joint major key, the device of the storage query result may further determine that the non-joint major key that whether there is the target query table in the corresponding multiple column of the query result.For first inquiry substatement shown in the table 2, the corresponding target query table of this first inquiry substatement is table orders, and the major key of table orders be orderkey, then the device of the storage query result can determine this first inquiry substatement it is corresponding it is multiple column o_orderkey, n1.n_name and n2.n_name in whether include table orders major key orderkey.Due to including o_orderkey in multiple column, then the device of the storage query result can be using o_orderkey as the major key of interim table q7_tmp_order_customer, but the embodiment of the present invention is without being limited thereto.
Optionally, as another embodiment, S130 determines the major key of first table according to the target query table, further includes:
If the non-joint major key of the target query table is not present in the corresponding multiple column of the query result, determine that the second inquiry request corresponding with first inquiry request, second inquiry request are associated inquiry to first table and the second table for requesting;
According to second inquiry request, the major key of first table is determined.
If the non-joint major key of the target query table is not present, i.e. the major key of the target query table is specially joint major key, or if the major key of the target query table is non-joint major key, but does not include the non-joint major key of the target query table in the corresponding multiple column of the query result, then the non-joint major key of the target query table is not present in the corresponding multiple column of the query result.At this point, the device of the storage query result can be true Fixed to whether there is the second inquiry request corresponding with first inquiry request, if there is no the second inquiry request corresponding with first inquiry request, then the device of the storage query result can be by a major key of the column as first table without practical significance.If there is the second inquiry request corresponding with first inquiry request, then the device of the storage query result can determine the major key of first table according to second inquiry request.Specifically, second inquiry request is for being associated inquiry to first table and the second table, such as, first table is interim table q7_tmp_lineitem_supplier, and query statement shown in table 4 is for being associated inquiry to interim table q7_tmp_order_customer and q7_tmp_lineitem_supplier, therefore, query statement shown in table 4 can be used as corresponding second inquiry request of the first inquiry request shown in table 3.At this point, the device of the storage query result can the query statement according to shown in table 4 determine the major key of interim table q7_tmp_lineitem_supplier, but the embodiment of the present invention is without being limited thereto.
The device of the storage query result can determine the major key of first table according to second inquiry request in several ways.As an alternative embodiment, this determines the major key of first table according to second inquiry request, comprising:
Determine at least one corresponding second correlation inquiry condition of second inquiry request, wherein the second correlation inquiry condition is made of the 4th column of the third of first table column and second table;
The second target association querying condition is determined at least one second correlation inquiry condition from this, which includes the major key of second table;
The third column for first table for including in the second target association querying condition are determined as to the major key of first table.
The second correlation inquiry condition can be arranged by the third of first table and the 4th column of second table are constituted, the device of the storage query result can determine the second target association querying condition from least one corresponding second correlation inquiry condition of second inquiry request, wherein, the second target association querying condition is made of the third column of the first table and the 4th column of second table, and the 4th major key for being classified as second table.The third of the first table in the second target association querying condition can be arranged the major key for being determined as first table by the device of the storage query result, but the embodiment of the present invention is without being limited thereto.
Second inquiry request can be specifically used for request and be associated inquiry to first table and at least one second table.Optionally, as another embodiment, if the number of second table is multiple, before the device of the storage query result determines the second target association querying condition, the device of the storage query result can determine the second object table from multiple second table, wherein, second object table be multiple second table at least one table the fact table, and in multiple second table be not present second object table the fact table.At this point, the device of the storage query result can determine the second target query condition from least one corresponding second correlation inquiry condition of second inquiry request, wherein the second target query item Part is made of the third of the major key of second object table and first table column, and the third of first table in the second target query condition can be arranged the major key as first table by the device of the storage query result, but the embodiment of the present invention is without being limited thereto.
Still shown in the table 3 for second inquiry substatement, query statement shown in table 4 is corresponding second inquiry request of this second inquiry substatement, second inquiry request is used for first table (interim table q7_tmp_lineitem_supplier, be named as table n2) and second table (interim table q7_tmp_order_customer, be named as table n1) be associated inquiry.At this time, it include three the second correlation inquiry conditions in query statement shown in table 4, " n2.l_orderkey=n1.o_orderkey ", " n1.cust_nation=n2.cust_nation " and " n1.supp_nation=n2.supp_nation ", wherein, the second target association querying condition in these three second correlation inquiry conditions is " n2.l_orderkey=n1.o_orderkey ", the target association querying condition is made of the column l_orderkey of the major key o_orderkey of table n1 and table n2, then the device of the storage query result can be using the l_orderkey as the interim table q7_ The major key of tmp_lineitem_supplier.At this time, the major key l_orderkey of interim table q7_tmp_lineitem_supplier is corresponding with the major key o_orderkey of interim table q7_tmp_order_customer, repeated data is both not present, at this time, when carrying out correlation inquiry shown in table 4, it can directly inquire and be indexed without establishing, to improve search efficiency and speed.
Therefore, the method of storage query result according to an embodiment of the present invention, target query table is determined from the corresponding multiple queries table of the first inquiry request, wherein, the fact that the target query table is at least one inquiry table in multiple inquiry table in addition to target query table table, and the fact that the target query table is not present in multiple inquiry table table, and the major key for storing the first table of query result is determined according to the target query table, can be avoided in the prior art due to by no practical significance column as the first table major key and cause it is subsequent inquiry is associated to the first table when the low problem of search efficiency, to improve the efficiency of correlation inquiry.
It should be noted that the example of table 1 to table 4, which is to help those skilled in the art, more fully understands the embodiment of the present invention, and the range of the embodiment of the present invention have to be limited.Those skilled in the art's example according to shown in given table 1 to table 4, it is clear that the modification or variation of various equivalences can be carried out, such modification or variation are also fallen into the range of the embodiment of the present invention.
It should also be understood that magnitude of the sequence numbers of the above procedures are not meant that the order of the execution order, the execution sequence of each process be should be determined by its function and internal logic, and the implementation process of the embodiments of the invention shall not be constituted with any limitation.
It should also be understood that in embodiments of the present invention, term " first ", " second " and " third ", should not be to any restrictions of composition of the embodiment of the present invention just for the sake of the different content of differentiation.The embodiment of the present invention In the first table and the second table just for the sake of distinguishing different table, the secondary series in first row, the second inquiry table in first inquiry table arranges just to the inquiry inquired column and belong to the second inquiry table for belonging to the first inquiry table distinguished in correlation inquiry condition, similarly, third column in first table and the 4th column in the second table cause to limit also just to distinguish different column without coping with each specific location being shown in the table.
Above in conjunction with Fig. 1 to Fig. 4, the method that storage query result according to an embodiment of the present invention is described in detail describes the device of storage query result according to an embodiment of the present invention below in conjunction with Fig. 5 to Fig. 7.
Fig. 5 schematically shows the device 200 of storage query result according to an embodiment of the present invention.As shown in figure 5, the device 200 includes:
First determination unit 210, for determining the corresponding multiple queries table of the first inquiry request, wherein first inquiry request is associated inquiry to multiple inquiry table for requesting;
Second determination unit 220, for determining target query table from multiple inquiry table that first determination unit 210 determines, wherein, the fact that the target query table is not present in multiple inquiry table table, and the fact that the target query table is at least one inquiry table in addition to the target query table in multiple inquiry table table;
Third determination unit 230, the target query table for being determined according to second determination unit 220, determines the major key of the first table, wherein first table is for storing the corresponding query result of the first inquiry request;
Storage unit 240, the major key of first table for being determined according to the third determination unit 230, which is stored to first table.
Therefore, the device of storage query result according to an embodiment of the present invention, target query table is determined from the corresponding multiple queries table of the first inquiry request, wherein, the fact that the target query table is at least one inquiry table in multiple inquiry table in addition to target query table table, and the fact that the target query table is not present in multiple inquiry table table, and the major key for storing the first table of query result is determined according to the target query table, can be avoided in the prior art due to by no practical significance column as the first table major key and cause it is subsequent inquiry is associated to the first table when the low problem of search efficiency, to improve the efficiency of correlation inquiry.
Optionally, as another embodiment, which can also include:
Receiving unit, for receiving first inquiry request from client before first determination unit 210 determines the corresponding multiple queries table of the first inquiry request;
Query unit, for being associated inquiry to multiple inquiry table according to received first inquiry request of the receiving unit.
At this point, the storage unit 240 is specifically used for storing the query result that the query unit obtains to first table.
Optionally, which is specifically used for: according to the major key for first table that the third determination unit 230 determines, being stored the query result to first table in a manner of column cluster.
Optionally, as another embodiment, which includes:
First determines subelement, for determining at least one corresponding first correlation inquiry condition of first inquiry request, wherein, the first correlation inquiry condition is made of the secondary series in the first row and the second inquiry table in the first inquiry table, and multiple inquiry table includes first inquiry table and second inquiry table different from first inquiry table;
Second determines subelement, for determining the incidence relation between the first determining subelement determining corresponding first inquiry table of the first correlation inquiry condition and second inquiry table;
Third determines subelement, and the incidence relation between first inquiry table and second inquiry table for being determined according to the second determining subelement determines the target query table from first inquiry table and second inquiry table.
Optionally, as another embodiment, which is specifically used for:
Determine first inquiry table first row whether be first inquiry table major key;
If the first of first inquiry table is classified as the major key of first inquiry table, the fact that second inquiry table is first inquiry table table is determined;
If the first of first inquiry table is classified as the external key of first inquiry table, the fact that first inquiry table is second inquiry table table is determined.
Optionally, as another embodiment, the corresponding first correlation inquiry condition of first inquiry request;
Correspondingly, which determines that subelement is specifically used for:
If the second determining subelement determines the fact that second inquiry table is first inquiry table table, it is determined that second inquiry table is the target query table;
If the second determining subelement determines the fact that first inquiry table is second inquiry table table, it is determined that first inquiry table is the target query table.
Optionally, as another embodiment, which corresponds to multiple first correlation inquiry conditions, at this point, the third determines that subelement is specifically used for:
The pass between first inquiry table and second inquiry table determined according to the second determining subelement Connection relationship establishes incidence relation tree, wherein if the fact that second inquiry table is first inquiry table table, which is the father node of first inquiry table;
The root node of the incidence relation tree is determined as the target query table.
Optionally, as another embodiment, which includes:
4th determines subelement, for determining the non-joint major key that whether there is the target query table in the corresponding multiple column of the query result;
5th determines subelement, if determining that subelement determines the non-joint major key in multiple column there are the target query table for the 4th, the non-joint major key of the target query table is determined as to the major key of first table.
Optionally, as another embodiment, the third determination unit further include:
6th determines subelement, if determining that subelement determines the non-joint major key in multiple column there is no the target query table for the 4th, determine that the second inquiry request corresponding with first inquiry request, second inquiry request are associated inquiry to first table and the second table for requesting;
7th determines subelement, for determining determining second inquiry request of subelement according to the 6th, determines the major key of first table.
Optionally, as another embodiment, the 7th determines that subelement is specifically used for:
Determine at least one corresponding second correlation inquiry condition of second inquiry request, wherein the second correlation inquiry condition is made of the 4th column of the third of first table column and second table;
The second target association querying condition is determined at least one second correlation inquiry condition from this, which includes the major key of second table;
The third column for first table for including in the second target association querying condition are determined as to the major key of first table.
The device 200 of storage query result according to an embodiment of the present invention can correspond to the executing subject of the method 100 of storage query result according to an embodiment of the present invention, and above and other operation and/or functions of the modules in the device 200 of query result is stored respectively to realize the corresponding process of each method in Fig. 1 to Fig. 4, for sake of simplicity, details are not described herein.
Therefore, the device of storage query result according to an embodiment of the present invention, target query table is determined from the corresponding multiple queries table of the first inquiry request, wherein, the fact that the target query table is at least one inquiry table in multiple inquiry table in addition to target query table table, and the fact that the target query table is not present in multiple inquiry table table, and the major key for storing the first table of query result is determined according to the target query table, can be avoided in the prior art due to the major key by the column of no practical significance as the first table And subsequent search efficiency low problem when being associated inquiry to the first table is caused, to improve the efficiency of correlation inquiry.
Fig. 6 schematically shows the device 300 of another storage query result according to an embodiment of the present invention.As shown in fig. 6, the device 300 includes:
Processor 310, is used for: determining the corresponding multiple queries table of the first inquiry request, wherein first inquiry request is associated inquiry to multiple inquiry table for requesting;Target query table is determined from multiple inquiry table, wherein the fact that the target query table is not present in multiple inquiry table table, and the fact that the target query table is at least one inquiry table in addition to the target query table in multiple inquiry table table;According to the target query table, the major key of the first table is determined, wherein first table is for storing the corresponding query result of the first inquiry request;
Memory 320 stores the query result to first table for managing the major key for first table that device 310 determines according to this.
Therefore, the device of storage query result according to an embodiment of the present invention, target query table is determined from the corresponding multiple queries table of the first inquiry request, wherein, the fact that the target query table is at least one inquiry table in multiple inquiry table in addition to target query table table, and the fact that the target query table is not present in multiple inquiry table table, and the major key for storing the first table of query result is determined according to the target query table, can be avoided in the prior art due to by no practical significance column as the first table major key and cause it is subsequent inquiry is associated to the first table when the low problem of search efficiency, to improve the efficiency of correlation inquiry.
It should be understood that, in embodiments of the present invention, the processor 310 can be central processing unit (Central Processing Unit, referred to as " CPU "), which can also be other general processors, digital signal processor (DSP), specific integrated circuit (ASIC), ready-made programmable gate array (FPGA) either other programmable logic device, discrete gate or transistor logic, discrete hardware components etc..General processor can be microprocessor or the processor is also possible to any conventional processor etc..
The memory 320 may include read-only memory and random access memory, and provide instruction and data to processor 310.The a part of of memory 320 can also include nonvolatile RAM.For example, memory 320 can be with the information of storage device type.
During realization, each step of the above method can be completed by the integrated logic circuit of the hardware in processor 310 or the instruction of software form.The step of method in conjunction with disclosed in the embodiment of the present invention, can be embodied directly in hardware processor and execute completion, or in processor hardware and software module combination execute completion.Software module can be located at random access memory, and flash memory, read-only memory may be programmed only In the storage medium for reading this fields such as memory or electrically erasable programmable memory, register maturation.The step of storage medium is located at memory 320, and processor 310 reads the information in memory 320, completes the above method in conjunction with its hardware.To avoid repeating, it is not detailed herein.
Optionally, as another embodiment, which can also include:
Receiver, for receiving first inquiry request from client before the processor 310 determines the corresponding multiple queries table of the first inquiry request;
Correspondingly, which is also used to be associated inquiry to multiple inquiry table according to received first inquiry request of the receiver.
At this point, the memory 320 is specifically used for storing the query result that the processor 310 obtains to first table.
Optionally, which is specifically used for: managing the major key for first table that device 310 determines according to this, is stored the query result to first table in a manner of column cluster.
Optionally, as another embodiment, which is specifically used for:
Determine at least one corresponding first correlation inquiry condition of first inquiry request, wherein, the first correlation inquiry condition is made of the secondary series in the first row and the second inquiry table in the first inquiry table, and multiple inquiry table includes first inquiry table and second inquiry table different from first inquiry table;
Determine the incidence relation between corresponding first inquiry table of the first correlation inquiry condition and second inquiry table;
According to the incidence relation between first inquiry table and second inquiry table, the target query table is determined from first inquiry table and second inquiry table.
Optionally, as another embodiment, which is specifically used for:
Determine first inquiry table first row whether be first inquiry table major key;
If the first of first inquiry table is classified as the major key of first inquiry table, the fact that second inquiry table is first inquiry table table is determined;
If the first of first inquiry table is classified as the external key of first inquiry table, the fact that first inquiry table is second inquiry table table is determined.
Optionally, as another embodiment, the corresponding first correlation inquiry condition of first inquiry request;
Correspondingly, which is specifically used for:
If it is determined that the fact that second inquiry table is first inquiry table table, it is determined that second inquiry table is the target query table;
If it is determined that the fact that first inquiry table is second inquiry table table, it is determined that first inquiry table is The target query table.
Optionally, as another embodiment, which corresponds to multiple first correlation inquiry conditions, at this point, the processor 310 is specifically used for:
According to the incidence relation between first inquiry table and second inquiry table, incidence relation tree is established, wherein if the fact that second inquiry table is first inquiry table table, which is the father node of first inquiry table;
The root node of the incidence relation tree is determined as the target query table.
Optionally, as another embodiment, which is also used to:
Determine the non-joint major key that whether there is the target query table in the corresponding multiple column of the query result;
If it is determined that the non-joint major key of the target query table to be determined as to the major key of first table there are the non-joint major key of the target query table in multiple column.
Optionally, as another embodiment, which is also used to:
If it is determined that the non-joint major key of the target query table is not present in multiple column, determine that the second inquiry request corresponding with first inquiry request, second inquiry request are associated inquiry to first table and the second table for requesting;
According to second inquiry request, the major key of first table is determined.
Optionally, as another embodiment, which is specifically used for:
Determine at least one corresponding second correlation inquiry condition of second inquiry request, wherein the second correlation inquiry condition is made of the 4th column of the third of first table column and second table;
The second target association querying condition is determined at least one second correlation inquiry condition from this, which includes the major key of second table;
The third column for first table for including in the second target association querying condition are determined as to the major key of first table.
The device 300 of storage query result according to an embodiment of the present invention can correspond to the executing subject of the method 100 of storage query result according to an embodiment of the present invention, and above and other operation and/or functions of the modules in the device 300 of query result is stored respectively to realize the corresponding process of each method in Fig. 1 to Fig. 4, for sake of simplicity, details are not described herein.
Therefore, the device of storage query result according to an embodiment of the present invention, target query table is determined from the corresponding multiple queries table of the first inquiry request, wherein, the fact that the target query table is at least one inquiry table in multiple inquiry table in addition to target query table table, and the fact that the target query table is not present in multiple inquiry table table, and for storing query result is determined according to the target query table The major key of one table, can be avoided in the prior art due to by no practical significance column as the first table major key and cause it is subsequent inquiry is associated to the first table when the low problem of search efficiency, to improve the efficiency of correlation inquiry.
Fig. 7 schematically shows calculating equipment 400 according to an embodiment of the present invention.As shown in fig. 7, the calculating equipment 400 includes: processor 402, memory 404 and bus 410.Wherein, processor 402 and memory 404 pass through the communication connection between the realization of bus 410.
Processor 402 can use general central processing unit (Central Processing Unit, CPU), microprocessor, application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, for executing relative program, to realize technical solution provided by the embodiment of the present invention.
Memory 404 can be read-only memory (Read Only Memory, ROM), static storage device, dynamic memory or random access memory (Random Access Memory, RAM).Memory 404 can store an operating system and other applications.When by software or firmware to realize technical solution provided in an embodiment of the present invention, it is stored in memory 404 for realizing the program code of technical solution provided in an embodiment of the present invention, and executed by processor 402.
Specifically, memory 404 can be used for storing executable instruction, can be used for storing various information, for example, query result.Processor 402 can read the information of the memory 404 storage by bus system 410, or query result is stored to memory 404.In addition, when the calculating equipment 400 operation, processor 402 can execute the executable instruction of the storage of memory 404, to determine the corresponding multiple queries table of the first inquiry request, wherein first inquiry request is associated inquiry to multiple inquiry table for requesting;Target query table is determined from multiple inquiry table, wherein the fact that the target query table is not present in multiple inquiry table table, and the fact that the target query table is at least one inquiry table in addition to the target query table in multiple inquiry table table;According to the target query table, the major key of the first table is determined, wherein first table is for storing the corresponding query result of the first inquiry request;According to the major key of first table, which is stored to first table.
Optionally, as shown in fig. 7, the calculating equipment can also include input/output interface 406 and communication interface 408.The data for receiving input of input/output interface 406 and information, the data such as output operating result.
Communication interface 408 is using the R-T unit for being such as, but not limited to transceiver one kind, to realize the communication calculated between equipment 400 and other equipment or communication network.
Bus 410 may include an access, transmit information between 400 all parts of equipment (such as processor 402, memory 404, input/output interface 406 and communication interface 408) calculating.
The method that hardware configuration and foregoing description shown in Fig. 7 are adapted for carrying out various storage query results provided by the embodiment of the present invention, for example, various method flows shown in Fig. 1 to Fig. 4, for sake of simplicity, which is not described herein again.
It should be noted that, although calculating equipment 400 shown in Fig. 7 illustrate only processor 402, memory 404, input/output interface 406, communication interface 408 and bus 410, but during specific implementation, it should be apparent to a person skilled in the art that calculating equipment 400 also operates normally other necessary devices comprising realizing.Meanwhile according to specific needs, it should be apparent to a person skilled in the art that calculating equipment 400 also may include the hardware device for realizing other additional functions.In addition, it should be apparent to a person skilled in the art that calculating equipment 400 can also only include device necessary to realizing the embodiment of the present invention, without including whole devices shown in fig. 7.
It should be understood that in embodiments of the present invention, term and/or only a kind of incidence relation for describing affiliated partner indicate may exist three kinds of relationships.For example, A and/or B, can indicate: individualism A exists simultaneously A and B, these three situations of individualism B.In addition, herein character/, typically represent forward-backward correlation object be it is a kind of or relationship.
Those of ordinary skill in the art may be aware that, various method steps and unit in conjunction with described in the embodiments described herein, it can be realized with electronic hardware, computer software, or a combination of the two, in order to clearly illustrate the interchangeability of hardware and software, the step of according to function having generally described each embodiment in the above description and composition.These functions are implemented in hardware or software actually, the specific application and design constraint depending on technical solution.Those of ordinary skill in the art can use different methods to achieve the described function each specific application, but such implementation should not be considered as beyond the scope of the present invention.
It is apparent to those skilled in the art that for convenience of description and succinctly, system, the specific work process of device and unit of foregoing description can refer to corresponding processes in the foregoing method embodiment, details are not described herein.
In several embodiments provided herein, it should be understood that disclosed systems, devices and methods may be implemented in other ways.Such as, the apparatus embodiments described above are merely exemplary, such as, the division of the unit, only a kind of logical function partition, there may be another division manner in actual implementation, such as multiple units or components can be combined or can be integrated into another system, or some features can be ignored or not executed.In addition, shown or discussed mutual coupling, direct-coupling or communication connection can be through some interfaces, the indirect coupling or communication connection of device or unit, be also possible to electricity, the connection of mechanical or other forms.
The unit as illustrated by the separation member may or may not be physically separated, and component shown as a unit may or may not be physical unit, it can and it is in one place, or may be distributed over multiple network units.It can select some or all of unit therein according to the actual needs to realize the purpose of the embodiment of the present invention.
In addition, the functional units in various embodiments of the present invention may be integrated into one processing unit, it is also possible to each unit and physically exists alone, is also possible to two or more units and is integrated in one unit.Above-mentioned integrated unit both can take the form of hardware realization, can also realize in the form of software functional units.
If the integrated unit is realized in the form of SFU software functional unit and when sold or used as an independent product, can store in a computer readable storage medium.Based on this understanding, technical solution of the present invention substantially the part that contributes to existing technology in other words, or all or part of the technical solution can be embodied in the form of software products, the computer software product is stored in a storage medium, it uses including some instructions so that a computer equipment (can be personal computer, server or the network equipment etc.) it performs all or part of the steps of the method described in the various embodiments of the present invention.And storage medium above-mentioned includes: USB flash disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), the various media that can store program code such as random access memory (Random Access Memory, RAM), magnetic or disk.
It is described above; only a specific embodiment of the invention; but scope of protection of the present invention is not limited thereto; anyone skilled in the art is in the technical scope disclosed by the present invention; various equivalent modifications or substitutions can be readily occurred in, these modifications or substitutions should be covered by the protection scope of the present invention.Therefore, protection scope of the present invention should be subject to the protection scope in claims.

Claims (19)

  1. A method of storage query result characterized by comprising
    Determine the corresponding multiple queries table of the first inquiry request, wherein first inquiry request is associated inquiry to the multiple inquiry table for requesting;
    Target query table is determined from the multiple inquiry table, wherein, the fact that the target query table is not present in the multiple inquiry table table, and the fact that the target query table is at least one inquiry table in addition to the target query table in the multiple inquiry table table;
    According to the target query table, the major key of the first table is determined, wherein first table is for storing the corresponding query result of first inquiry request;
    According to the major key of first table, the query result is stored to first table.
  2. The method according to claim 1, wherein the major key according to first table, the query result is stored to first table, comprising:
    According to the major key of first table, the query result is stored to first table in a manner of column cluster.
  3. Method according to claim 1 or 2, which is characterized in that described that target query table is determined from the multiple inquiry table, comprising:
    Determine at least one corresponding first correlation inquiry condition of first inquiry request, wherein, the first correlation inquiry condition is made of the secondary series in the first row and the second inquiry table in the first inquiry table, and the multiple inquiry table includes first inquiry table and second inquiry table different from first inquiry table;
    Determine the incidence relation between corresponding first inquiry table of at least one correlation inquiry condition and second inquiry table;
    According to the incidence relation between first inquiry table and second inquiry table, the target query table is determined from first inquiry table and second inquiry table.
  4. According to the method described in claim 3, it is characterized in that, incidence relation between corresponding first inquiry table of at least one correlation inquiry condition described in the determination and second inquiry table, comprising:
    Determine the first row in first inquiry table whether be first inquiry table major key;
    If first in first inquiry table is classified as the major key of first inquiry table, the fact that second inquiry table is first inquiry table table is determined;
    If first in first inquiry table is classified as the external key of first inquiry table, described first is determined The fact that inquiry table is second inquiry table table.
  5. According to the method described in claim 4, it is characterized in that, first inquiry request corresponds to a first correlation inquiry condition;
    The incidence relation according between first inquiry table and second inquiry table determines the target query table from first inquiry table and second inquiry table, comprising:
    If the fact that second inquiry table is first inquiry table table, it is determined that second inquiry table is the target query table;
    If the fact that first inquiry table is second inquiry table table, it is determined that first inquiry table is the target query table.
  6. The method according to claim 3 or 4, which is characterized in that first inquiry request corresponds to multiple first correlation inquiry conditions;
    The incidence relation according between first inquiry table and second inquiry table determines the target query table from first inquiry table and second inquiry table, comprising:
    According to the incidence relation between first inquiry table and second inquiry table, incidence relation tree is established, wherein if the fact that second inquiry table is first inquiry table table, second inquiry table is the father node of first inquiry table;
    The root node of the incidence relation tree is determined as the target query table.
  7. Method according to any one of claim 1 to 6, which is characterized in that it is described according to the target query table, determine the major key of first table, comprising:
    Determine the non-joint major key that whether there is the target query table in the corresponding multiple column of the query result;
    If the non-joint major key of the target query table to be determined as to the major key of first table there are the non-joint major key of the target query table in the multiple column.
  8. The method according to the description of claim 7 is characterized in that it is described according to the target query table, determine the major key of first table, further includes:
    If the non-joint major key of the target query table is not present in the multiple column, determine that the second inquiry request corresponding with first inquiry request, second inquiry request are associated inquiry to first table and the second table for requesting;
    According to second inquiry request, the major key of first table is determined.
  9. According to the method described in claim 8, determining the major key of first table it is characterized in that, described according to second inquiry request, comprising:
    Determine at least one corresponding second correlation inquiry condition of second inquiry request, wherein the second correlation inquiry condition is made of the 4th column of the third of first table column and second table;
    The second target association querying condition is determined from least one described second correlation inquiry condition, the second target association querying condition includes the major key of second table;
    The third column for first table for including in the second target association querying condition are determined as to the major key of first table.
  10. A kind of device storing query result characterized by comprising
    First determination unit, for determining the corresponding multiple queries table of the first inquiry request, wherein first inquiry request is associated inquiry to the multiple inquiry table for requesting;
    Second determination unit, for determining target query table from the multiple inquiry table that first determination unit determines, wherein, the fact that the target query table is not present in the multiple inquiry table table, and the fact that the target query table is at least one inquiry table in addition to the target query table in the multiple inquiry table table;
    Third determination unit, the target query table for being determined according to second determination unit, determines the major key of the first table, wherein first table is for storing the corresponding query result of first inquiry request;
    Storage unit, the major key of first table for being determined according to the third determination unit, the query result is stored to first table.
  11. Device according to claim 10, which is characterized in that the storage unit is specifically used for:
    According to the major key for first table that the third determination unit determines, the query result is stored to first table in a manner of column cluster.
  12. Device described in 0 or 11 according to claim 1, which is characterized in that second determination unit includes:
    First determines subelement, for determining at least one corresponding first correlation inquiry condition of first inquiry request, wherein, the first correlation inquiry condition is made of the secondary series in the first row and the second inquiry table in the first inquiry table, and the multiple inquiry table includes first inquiry table and second inquiry table different from first inquiry table;
    Second determination subelement, for determining that described first determines the incidence relation described in subelement determination between corresponding first inquiry table of at least one correlation inquiry condition and second inquiry table;
    Third determines subelement, for determining determining first inquiry table of subelement according to described second With the incidence relation between second inquiry table, the target query table is determined from first inquiry table and second inquiry table.
  13. Device according to claim 12, which is characterized in that described second determines that subelement is specifically used for:
    Determine the first row in first inquiry table whether be first inquiry table major key;
    If first in first inquiry table is classified as the major key of first inquiry table, the fact that second inquiry table is first inquiry table table is determined;
    If first in first inquiry table is classified as the external key of first inquiry table, the fact that first inquiry table is second inquiry table table is determined.
  14. Device according to claim 13, which is characterized in that the corresponding first correlation inquiry condition of first inquiry request;
    The third determines that subelement is specifically used for:
    If described second determines that subelement determines the fact that second inquiry table is first inquiry table table, it is determined that second inquiry table is the target query table;
    If described second determines that subelement determines the fact that first inquiry table is second inquiry table table, it is determined that first inquiry table is the target query table.
  15. Device according to claim 12 or 13, which is characterized in that first inquiry request corresponds to multiple first correlation inquiry conditions;
    The third determines that subelement is specifically used for:
    The incidence relation between subelement determining first inquiry table and second inquiry table is determined according to described second, establish incidence relation tree, wherein, if the fact that second inquiry table is first inquiry table table, second inquiry table is the father node of first inquiry table;
    The root node of the incidence relation tree is determined as the target query table.
  16. Device described in any one of 0 to 15 according to claim 1, which is characterized in that the third determination unit includes:
    4th determines subelement, for determining the non-joint major key that whether there is the target query table in the corresponding multiple column of the query result;
    5th determines subelement, if determining that subelement determines the non-joint major key in the multiple column there are the target query table for the described 4th, the non-joint major key of the target query table is determined as to the major key of first table.
  17. Device according to claim 16, which is characterized in that the third determination unit is also Include:
    6th determines subelement, if determining that subelement determines the non-joint major key in the multiple column there is no the target query table for the described 4th, determine that the second inquiry request corresponding with first inquiry request, second inquiry request are associated inquiry to first table and the second table for requesting;
    7th determines subelement, for determining determining second inquiry request of subelement according to the described 6th, determines the major key of first table.
  18. Device according to claim 17, which is characterized in that the described 7th determines that subelement is specifically used for:
    Determine at least one corresponding second correlation inquiry condition of second inquiry request, wherein the second correlation inquiry condition is made of the 4th column of the third of first table column and second table;
    The second target association querying condition is determined from least one described second correlation inquiry condition, the second target association querying condition includes the major key of second table;
    The third column for first table for including in the second target association querying condition are determined as to the major key of first table.
  19. A kind of calculating equipment characterized by comprising processor, memory and bus;
    The memory is for storing computer executed instructions, the processor is connect with the memory by the bus, when calculating equipment operation, the processor reads the computer executed instructions of the memory storage, in method described in any one of perform claim requirement 1 to 9.
CN201580001205.4A 2015-01-14 2015-01-14 Method and device for storing query result and computing equipment Active CN107735781B (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2015/070656 WO2016112502A1 (en) 2015-01-14 2015-01-14 Method, apparatus and computing device for storing query result

Publications (2)

Publication Number Publication Date
CN107735781A true CN107735781A (en) 2018-02-23
CN107735781B CN107735781B (en) 2020-03-10

Family

ID=56405107

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201580001205.4A Active CN107735781B (en) 2015-01-14 2015-01-14 Method and device for storing query result and computing equipment

Country Status (2)

Country Link
CN (1) CN107735781B (en)
WO (1) WO2016112502A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109683987A (en) * 2018-12-19 2019-04-26 珠海港联科技有限公司 A kind of configurable load of software dynamic interface and data processing method
CN111143481A (en) * 2019-12-20 2020-05-12 中国建设银行股份有限公司 Method, device and equipment for connecting unassociated look-up table and storage medium

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110597849B (en) * 2018-05-25 2022-03-22 北京国双科技有限公司 Data query method and device
CN112699149B (en) * 2020-12-31 2023-09-19 青岛海尔科技有限公司 Target data acquisition method and device, storage medium and electronic device
CN114896280B (en) * 2022-03-22 2024-06-18 杭州未名信科科技有限公司 Data query method and system

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060026199A1 (en) * 2004-07-15 2006-02-02 Mariano Crea Method and system to load information in a general purpose data warehouse database
US20070027860A1 (en) * 2005-07-28 2007-02-01 International Business Machines Corporation Method and apparatus for eliminating partitions of a database table from a join query using implicit limitations on a partition key value
CN101197876A (en) * 2006-12-06 2008-06-11 中兴通讯股份有限公司 Method and system for multi-dimensional analysis of message service data
US20100280991A1 (en) * 2009-05-01 2010-11-04 International Business Machines Corporation Method and system for versioning data warehouses
US20100293135A1 (en) * 2009-05-12 2010-11-18 Aster Data Systems, Inc. Highconcurrency query operator and method
CN101916261A (en) * 2010-07-28 2010-12-15 北京播思软件技术有限公司 Data partitioning method for distributed parallel database system
CN102521416A (en) * 2011-12-28 2012-06-27 用友软件股份有限公司 Data correlation query method and data correlation query device
CN102968420A (en) * 2011-08-31 2013-03-13 国际商业机器公司 Database query method and system
CN103473267A (en) * 2013-08-09 2013-12-25 深圳市中科新业信息科技发展有限公司 Data storage query method and system
CN104166740A (en) * 2014-09-10 2014-11-26 税友软件集团股份有限公司 Data inquiry method and device

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060026199A1 (en) * 2004-07-15 2006-02-02 Mariano Crea Method and system to load information in a general purpose data warehouse database
US20070027860A1 (en) * 2005-07-28 2007-02-01 International Business Machines Corporation Method and apparatus for eliminating partitions of a database table from a join query using implicit limitations on a partition key value
CN101197876A (en) * 2006-12-06 2008-06-11 中兴通讯股份有限公司 Method and system for multi-dimensional analysis of message service data
US20100280991A1 (en) * 2009-05-01 2010-11-04 International Business Machines Corporation Method and system for versioning data warehouses
US20100293135A1 (en) * 2009-05-12 2010-11-18 Aster Data Systems, Inc. Highconcurrency query operator and method
CN101916261A (en) * 2010-07-28 2010-12-15 北京播思软件技术有限公司 Data partitioning method for distributed parallel database system
CN102968420A (en) * 2011-08-31 2013-03-13 国际商业机器公司 Database query method and system
CN102521416A (en) * 2011-12-28 2012-06-27 用友软件股份有限公司 Data correlation query method and data correlation query device
CN103473267A (en) * 2013-08-09 2013-12-25 深圳市中科新业信息科技发展有限公司 Data storage query method and system
CN104166740A (en) * 2014-09-10 2014-11-26 税友软件集团股份有限公司 Data inquiry method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109683987A (en) * 2018-12-19 2019-04-26 珠海港联科技有限公司 A kind of configurable load of software dynamic interface and data processing method
CN111143481A (en) * 2019-12-20 2020-05-12 中国建设银行股份有限公司 Method, device and equipment for connecting unassociated look-up table and storage medium

Also Published As

Publication number Publication date
CN107735781B (en) 2020-03-10
WO2016112502A1 (en) 2016-07-21

Similar Documents

Publication Publication Date Title
US9672272B2 (en) Method, apparatus, and computer-readable medium for efficiently performing operations on distinct data values
US9600507B2 (en) Index structure for a relational database table
CN104123374B (en) The method and device of aggregate query in distributed data base
KR102134494B1 (en) Profiling data with location information
US9507875B2 (en) Symbolic hyper-graph database
WO2021068549A1 (en) Data processing method, platform and system
US20160103877A1 (en) Joining data across a parallel database and a distributed processing system
US7181460B2 (en) User-defined aggregate functions in database systems without native support
US10223388B2 (en) Avoid double counting of mapped database data
CN107735781A (en) Store method and apparatus, the computing device of Query Result
WO2016134580A1 (en) Data query method and apparatus
KR20160132941A (en) Mapping attributes of keyed entities
CN109791543B (en) Control method for executing multi-table connection operation and corresponding device
CN107251013A (en) Method, device and the Database Systems of data query
WO2016191995A1 (en) Method and device for partitioning association table in distributed database
CN110322318B (en) Client grouping method, device and computer storage medium
CN108959381B (en) Data management method and device and electronic equipment
CN110019341B (en) Data query method and device
CN109471874A (en) Data analysis method, device and storage medium
WO2020215830A1 (en) Method for outer join of table of database, and system
CN109344169B (en) Data processing method and device
CN108874873B (en) Data query method, device, storage medium and processor
US11531706B2 (en) Graph search using index vertices
CN110297858B (en) Optimization method and device for execution plan, computer equipment and storage medium
US10223421B2 (en) Virtual Aggregation

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
GR01 Patent grant
GR01 Patent grant