CN105745642B - Inquire the treating method and apparatus of data - Google Patents

Inquire the treating method and apparatus of data Download PDF

Info

Publication number
CN105745642B
CN105745642B CN201480000224.0A CN201480000224A CN105745642B CN 105745642 B CN105745642 B CN 105745642B CN 201480000224 A CN201480000224 A CN 201480000224A CN 105745642 B CN105745642 B CN 105745642B
Authority
CN
China
Prior art keywords
default
data
major key
tables
list item
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201480000224.0A
Other languages
Chinese (zh)
Other versions
CN105745642A (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 CN105745642A publication Critical patent/CN105745642A/en
Application granted granted Critical
Publication of CN105745642B publication Critical patent/CN105745642B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/283Multi-dimensional databases or data warehouses, e.g. MOLAP or ROLAP
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24553Query execution of query operations
    • G06F16/24558Binary matching operations
    • G06F16/2456Join operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24564Applying rules; Deductive queries

Abstract

The embodiment of the present invention provides a kind for the treatment of method and apparatus for inquiring data, comprising: receives the first attended operation sentence, the second alternative condition for the first choice condition of the first tables of data and for the second tables of data is carried in the first attended operation sentence;At least one first Major key is determined according to the data information in first choice condition and the first tables of data;And according to the first Major key of each of at least one first Major key, successively obtain the project of corresponding each candidate of each first Major key in the inquiry table of preset rules instruction, in each project including in the first tables of data the first tabular value and with the second tabular value in associated second tables of data of first tabular value;According to the second alternative condition, the final project of first choice condition and the second alternative condition is determined for compliance in the project of each candidate;By inquiring the treating method and apparatus of data, query process is simplified, inquiry velocity is improved.

Description

Inquire the treating method and apparatus of data
Technical field
The present embodiments relate to information technology field more particularly to a kind for the treatment of method and apparatus for inquiring data.
Background technique
In data warehouse and online analysis process processing (On-Line Analytical Processing, abbreviation OLAP) Field is even more important to the quick response of query statement.In the field OLAP, inquiry needs to handle the data of G grades, T grades even P grades Amount, in the case where such big data quantity, it is desirable that the quick response of inquiry proposes very big challenge to Database Performace.? In common query statement, it will usually including connection (join) operation being related between two tables of data, therefore promote tables of data Between attended operation speed it is extremely important to data base querying performance.
By taking following tables of data Tables 1 and 2 as an example, it is illustrated:
Table 1
Table 2
sid c_custkey o_orderdate
0 2 2012-9-02
1 5 2012-9-07
2 4 2012-9-10
3 3 2012-8-21
4 3 2012-8-02
5 1 2012-9-26
6 2 2012-8-20
7 4 2012-8-09
8 2 2012-9-15
With reference to above-mentioned Tables 1 and 2 it is found that passing through each c_custkey value in table 1 and each o_ in table 2 There are incidence relation, existing query statement " the select o_orderkey for above-mentioned Tables 1 and 2 between orderdate From orders, customer where c_name in { " Xiao Wang ", " Xiao Zhang " } and o_orderdate > " 2012-9- 01 " and o_custkey=c_custkey;The query statement be for inquire include name information " Xiao Wang " and/or " it is small " and query result of the date after 2012-9-01, wherein include name information " Xiao Wang ", " Xiao Zhang " it is choosing for table 1 Condition is selected, the date is the alternative condition for table 2 after 2012-9-01;When executing above-mentioned query statement, key step is such as Under:
Step 1: according to alternative condition " comprising name information " Xiao Wang " and/or " Xiao Zhang it " " selects, selects in table 1 C_custkey value to the condition that meets is (2,3), and the tabular value of corresponding table 1 is " rid=1 " and " rid=2 ";
Step 2: doing attended operation using c_custkey=2 and c_custkey=3 and table 2, found in table 2 and c_ The corresponding tabular value of custkey=2 and c_custkey=3 (sid) value is respectively 0,3,4,6,8;
Step 3: according to alternative condition " date is after 2012-9-01 ", being looked into (0,3,4,6,8) obtained to step 2 Finding qualified tabular value (sid) is respectively 0,8;
Step 4: join operation being carried out according to " rid=1, rid=2 " and " sid=0, sid=8 ", is met simultaneously State the set of condition " including name information ' Xiao Wang ' and/or ' Xiao Zhang ' " and the rid value of " date is after 2012-9-01 " only Including 2, and the set of sid value includes 0 and 8, that is to say, that it " includes surname that rid value, which is that data information corresponding to 2 met, Name information " Xiao Wang " and/or " Xiao Zhang ", and pass through c_custkey and the associated sid value of rid=2, i.e., 0 and 8 corresponding numbers It is believed that breath has met " date is after 2012-9-01 ".
It by above-mentioned implementation procedure, needs repeatedly to be attached operation to Tables 1 and 2, just can get while meeting needle The query result of alternative condition to table 1 and the alternative condition for table 2, the very complicated time-consuming of process, makes the inquiry of database Performance is poor.
Summary of the invention
The treating method and apparatus that the embodiment of the present invention provides a kind of inquiry data is mentioned for optimizing data query process High inquiry velocity, to promote the query performance of database.
In a first aspect, the embodiment of the present invention provides a kind of processing method for inquiring data, comprising:
The first attended operation sentence is received, the first choosing for the first tables of data is carried in the first attended operation sentence Condition and the second alternative condition for the second tables of data are selected, each single item data information in first tables of data and described the There are incidence relation between at least one data information in two tables of data, each of described tables of data data information is corresponding In a tabular value;
According to the data information in the first choice condition and first tables of data, it is being configured with the first Major key At least one first Major key is found in first tables of data;
According to the first Major key of each of at least one first Major key, successively being looked into what preset rules indicated It carries out search operation in inquiry table, obtains the project of the corresponding each candidate of each first Major key, in each project Including in first tables of data the first tabular value and with the second tabular value in associated second tables of data of first tabular value;
According to second alternative condition, be determined for compliance in the project of each candidate the first choice condition and The final project of second alternative condition.
With reference to first aspect, in the first embodiment, before the first attended operation sentence of the reception, the processing Method further include:
First Major key is configured to each of first tables of data data information, obtains described being configured with the First tables of data of one Major key;
Inquiry table is established according to the first tables of data and the second tables of data;
It is described to establish the inquiry table and include:
According to each single item data information being configured in the first tables of data of the first Major key and second data The incidence relation between at least one data information in table, establishes default first table;Each table of default first table It include second tabular value and the first Major key corresponding with second tabular value in.
First embodiment with reference to first aspect is established after default first table in this second embodiment, described Processing method further include:
According to the size of each first Major key in default first table, according to sequence from small to large or from big to small Each list item of default first table is ranked up, is configured with each position-order for each list item in default first table Number;Wherein, big when the first Major key in the first Major key and the second list item in the first list item of default first table Small equal, then the position number of first list item is different with the position number of second list item;
According in each list item of the position number of each list item of default first table and default first table First Major key establishes default second table, in default second table in each list item, a position number and is configured with this The first Major key in the list item of position number is associated;
It establishes according to default first table and default second table and presets third table, it is each in the default third table The first data in a list item are first Major key, and the second data are to be associated with first major key in default second table The first position number of value, third data are the last bit position number that first Major key is associated in default second table, 4th data are to be configured with the first tabular value corresponding to the data information of first Major key;
Default 4th table is established according to default first table and default second table, it is every in default 4th table It is to the associated position number of first Major key and related with the second tabular value of first Major key is corresponded in one list item Connection.
Second embodiment with reference to first aspect, in the third embodiment, after establishing the default third table, institute State processing method further include:
B-tree indexed is established according to the default third table, then the first digit in the default third table in each list item According to the keyword as each node in the b-tree indexed;
Second data, the third data and the 4th data in the default third table in each list item are made Corresponding each node is associated with for satellite information.
First embodiment with reference to first aspect, in the fourth embodiment, the inquiry table of the preset rules instruction is Default first table, the then search operation include:
First Major key of current operation is A, and being configured with the first tabular value corresponding to the data information of A is a,
Each list item in default first table is then searched according to the first Major key A, acquisition with A associated each the Two tabular values are respectively M1、M2……Mn, n is the positive integer not less than 1;
In conjunction with a and with associated each second tabular value of A, the project of each candidate corresponding with A of acquisition is respectively (M1, a)、(M2, a) ... (Mn, a).
Second embodiment with reference to first aspect, in the 5th embodiment, the inquiry table packet of the preset rules instruction The default third table and default 4th table are included, the search operation includes:
First Major key of current operation is A, and being configured with the first tabular value corresponding to the data information of A is a,
Searched in the default third table according to A, obtain the list item in the default third table where A be (A, N1、Nn,a);
According to N1And NnIt is extended, the corresponding position number sequence of the A of acquisition is [N1、N2……Nn];
According to position number each in the corresponding position number sequence of A inquiry default 4th table, acquisition and A Associated each second tabular value is respectively M1、M2、……Mn
In conjunction with a and with associated each second tabular value of A, obtaining the corresponding each candidate items of A is respectively (M1, a), (M2, a)……(Mn, a);
Wherein A corresponding position number in default second table is respectively N1、N2……Nn, n is just not less than 1 Integer, and being ranked up when according to each list item of the sequence from small to large to default first table, then described default the N in two tables1<N2……<Nn
It is ranked up when according to each list item of the sequence from big to small to default first table, then described default the N in two tables1>N2……>Nn
Third embodiment with reference to first aspect, in sixth embodiment, the inquiry table packet of the preset rules instruction The b-tree indexed and default 4th table are included, the search operation includes:
First Major key of current operation is A, and being configured with the first tabular value corresponding to the data information of A is a,
It is searched in the b-tree indexed using A as the keyword, obtaining the corresponding satellite information of A is (N1、Nn、 a);
According to N1And NnIt is extended, the corresponding position number sequence of the A of acquisition is [N1、N2……Nn];
According to position number each in the corresponding position number sequence of A inquiry default 4th table, acquisition and A Associated each second tabular value is respectively M1、M2... ... Mn
In conjunction with a and with associated each second tabular value of A, each candidate items corresponding with A of acquisition are respectively (M1, a), (M2, a) ... (Mn, a);
Wherein A corresponding position number in default second table is respectively N1、N2……Nn, n is just not less than 1 Integer, and being ranked up when according to each list item of the sequence from small to large to default first table, then described default the N in two tables1<N2……<Nn
It is ranked up when according to each list item of the sequence from big to small to default first table, then described default the N in two tables1>N2……>Nn
With reference to first aspect to any embodiment of first aspect sixth embodiment, in the 7th embodiment, when After carrying out the search operation, a candidate project is only obtained, it is determined that the project of the candidate is final project.
Second aspect, the embodiment of the present invention provide a kind of processing unit for inquiring data, comprising:
Receiving module carries in the first attended operation sentence for receiving the first attended operation sentence and is directed to first The first choice condition of tables of data and the second alternative condition for the second tables of data, each item number in first tables of data It is believed that in breath and second tables of data at least one of between data information there are incidence relation, it is each in the tables of data A data information corresponds to a tabular value;
First enquiry module, for according to the data information in the first choice condition and first tables of data, It is configured in the first tables of data of the first Major key and finds at least one first Major key;
Second enquiry module, for the first Major key of each of at least one the first Major key according to, successively Search operation is carried out in the inquiry table of preset rules instruction, obtains the item of the corresponding each candidate of each first Major key Mesh, include in each project the first tabular value in first tables of data and with associated second tables of data of first tabular value In the second tabular value;
Third enquiry module, for being determined for compliance in the project of each candidate according to second alternative condition The final project of the first choice condition and second alternative condition.
In conjunction with second aspect, in the first embodiment, the processing unit further include:
Module is established, for configuring first Major key to each of first tables of data data information, is obtained To first tables of data for being configured with the first Major key;
Inquiry table is established according to the first tables of data and the second tables of data;
It is described to establish the inquiry table and include:
According to each single item data information being configured in the first tables of data of the first Major key and second data The incidence relation between at least one data information in table, establishes default first table;Each table of default first table It include second tabular value and the first Major key corresponding with second tabular value in.
In conjunction with second aspect first embodiment, in this second embodiment, the module of establishing is also used to
According to the size of each first Major key in default first table, according to sequence from small to large or from big to small Each list item of default first table is ranked up, is configured with each position-order for each list item in default first table Number;Wherein, big when the first Major key in the first Major key and the second list item in the first list item of default first table Small equal, then the position number of first list item is different with the position number of second list item;
According in each list item of the position number of each list item of default first table and default first table First Major key establishes default second table, in default second table in each list item, a position number and is configured with this The first Major key in the list item of position number is associated;
It establishes according to default first table and default second table and presets third table, it is each in the default third table The first data in a list item are first Major key, and the second data are to be associated with first major key in default second table The first position number of value, third data are the last bit position number that first Major key is associated in default second table, 4th data are to be configured with the first tabular value corresponding to the data information of first Major key;
Default 4th table is established according to default first table and default second table, it is every in default 4th table It is to the associated position number of first Major key and related with the second tabular value of first Major key is corresponded in one list item Connection.
In conjunction with second aspect second embodiment, in the third embodiment, the module of establishing is also used to
B-tree indexed is established according to the default third table, then the first digit in the default third table in each list item According to the keyword as each node in the b-tree indexed;
Second data, the third data and the 4th data in the default third table in each list item are made Corresponding each node is associated with for satellite information.
In conjunction with second aspect first embodiment, in the fourth embodiment, the inquiry table of the preset rules instruction is Default first table, then second enquiry module is specifically used for
First Major key of current operation is A, and being configured with the first tabular value corresponding to the data information of A is a,
Each list item in default first table is then searched according to the first Major key A, acquisition with A associated each the Two tabular values are respectively M1、M2……Mn, n is the positive integer not less than 1;
In conjunction with a and with associated each second tabular value of A, the project of each candidate corresponding with A of acquisition is respectively (M1, a)、(M2, a) ... (Mn, a).
In conjunction with second aspect second embodiment, in the 5th embodiment, the inquiry table packet of the preset rules instruction The default third table and default 4th table are included, second enquiry module is specifically used for
First Major key of current operation is A, and being configured with the first tabular value corresponding to the data information of A is a,
Searched in the default third table according to A, obtain the list item in the default third table where A be (A, N1、Nn,a);
According to N1And NnIt is extended, the corresponding position number sequence of the A of acquisition is [N1、N2……Nn];
According to position number each in the corresponding position number sequence of A inquiry default 4th table, acquisition and A Associated each second tabular value is respectively M1、M2、……Mn
In conjunction with a and with associated each second tabular value of A, obtaining the corresponding each candidate items of A is respectively (M1, a), (M2, a)……(Mn, a);
Wherein A corresponding position number in default second table is respectively N1、N2……Nn, n is just not less than 1 Integer, and being ranked up when according to each list item of the sequence from small to large to default first table, then described default the N in two tables1<N2……<Nn
It is ranked up when according to each list item of the sequence from big to small to default first table, then described default the N in two tables1>N2……>Nn
In conjunction with second aspect third embodiment, in sixth embodiment, the inquiry table packet of the preset rules instruction The b-tree indexed and default 4th table are included, second enquiry module is specifically used for
First Major key of current operation is A, and being configured with the first tabular value corresponding to the data information of A is a,
It is searched in the b-tree indexed using A as the keyword, obtaining the corresponding satellite information of A is (N1、Nn、 a);
According to N1And NnIt is extended, the corresponding position number sequence of the A of acquisition is [N1、N2……Nn];
According to position number each in the corresponding position number sequence of A inquiry default 4th table, acquisition and A Associated each second tabular value is respectively M1、M2……Mn
In conjunction with a and with associated each second tabular value of A, each candidate items corresponding with A of acquisition are respectively (M1, a), (M2, a) ... (Mn, a);
Wherein A corresponding position number in default second table is respectively N1、N2……Nn, n is just not less than 1 Integer, and being ranked up when according to each list item of the sequence from small to large to default first table, then described default the N in two tables1<N2……<Nn
It is ranked up when according to each list item of the sequence from big to small to default first table, then described default the N in two tables1>N2……>Nn
In conjunction with second aspect to any embodiment of second aspect sixth embodiment, second enquiry module is carried out After the search operation, a candidate project is only obtained, it is determined that the project of the candidate is final project.
The treating method and apparatus of inquiry data provided in an embodiment of the present invention, passes through the inquiry table indicated in preset rules In inquired, include meeting each first tabular value of first choice condition and with each first in obtained candidate project Associated each second tabular value of tabular value, thus again by the second alternative condition can determine meet the first choice condition and First tabular value of second alternative condition and with associated second tabular value of first tabular value, compared with prior art, this implementation It does not need to carry out multiple attended operation to the first tables of data and the second tables of data in example, simplifies query process, improve and look into Ask speed.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is this hair Bright some embodiments for those of ordinary skill in the art without any creative labor, can be with It obtains other drawings based on these drawings.
Fig. 1 is the flow chart of the processing method embodiment one of present invention inquiry data;
Fig. 2 is the flow chart of the processing method embodiment two of present invention inquiry data;
Fig. 3 is the flow chart of the processing method embodiment three of present invention inquiry data;
Fig. 4 is the flow chart of the processing method example IV of present invention inquiry data;
Fig. 5 is the schematic diagram of b-tree indexed in the embodiment of the present invention four;
Fig. 6 is the structure chart of the processing device embodiment one of present invention inquiry data;
Fig. 7 is the structure chart of the processing device embodiment two of present invention inquiry data;
Fig. 8 is the structure chart of the processing device embodiment three of present invention inquiry data.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is A part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art Every other embodiment obtained without creative efforts, shall fall within the protection scope of the present invention.
Fig. 1 is the flow chart of the processing method embodiment one of present invention inquiry data.As shown in Figure 1, the present embodiment is held Row main body is to inquire the processing unit of data, which can be realized by the way of software and/or hardware, it is preferred that The device can integrate in the equipment for providing data query service, specifically, the implementation process of the present embodiment is as follows:
S101, the first attended operation sentence is received.
The first choice condition for the first tables of data is carried in above-mentioned first attended operation sentence and is directed to the second data Second alternative condition of table, in each single item data information and the second tables of data in the first tables of data at least one of data information Between there are incidence relation, each of described tables of data data information corresponds to a tabular value.
For example, it regard table 1 as the first tables of data, regard table 2 as the second tables of data, the data information of table 1 is each C_name value, i.e. " Xiao Ming " " Xiao Wang " etc., each data information is each o_orderdate value in table 2, i.e., each date letter Breath;Table 1 is by each c_custkey value, so that each data information in table 1 and at least one data information phase in table 2 Association, such as c_custkey value corresponding with date " 2012-9-02 ", " 2012-8-20 " and " 2012-9-15 " they are 2, and The corresponding data information of c_custkey=2 is " Xiao Wang " in table 1, i.e., three in data information " Xiao Wang " and table 2 in table 1 Data information " 2012-9-02 ", " 2012-8-20 " and " 2012-9-15 " is associated;Further, for table 1, each item number It is believed that ceasing corresponding tabular value is each rid value, when table 1 is as the first tables of data, each tabular value of the table 1 is the first table Value;The corresponding tabular value of each data information is each sid value in table 2, when table 1 is as the second tables of data, each table of the table 1 Value is the second tabular value.
Above-mentioned Tables 1 and 2 is only used for illustrating the first tables of data and the second tables of data, in practical applications, the first number According to table and the second tables of data structure and between incidence relation can make flexible variation as needed.
S102, according to the data information in first choice condition and the first tables of data, be configured with the of the first Major key At least one first Major key is found in one tables of data.
Above-mentioned the first tables of data for being configured with the first Major key specifically refers to following Table 3:
Table 3
First tabular value (rid) First Major key (PK)
0 10
1 11
2 12
3 13
4 14
Above-mentioned table 3 is to regard table 1 as the first tables of data, configures first major key to each of table 1 data information What value obtained, for ease of description, the corresponding data information of rid value each in table 1 (Xiao Wang, Xiao Zhang in such as table 1) is existed It is not shown in table 3;It should be understood that, according to table 1, being configured to each of table 1 data information before carrying out the present embodiment First Major key, each first tabular value as shown in table 3 can be obtained has corresponding first Major key (can use PK It indicates);For example, the first choice condition carried in current attended operation sentence is " including Xiao Wang and/or Xiao Zhang ", The rid value for meeting the condition is 1 and 2, corresponding, and the first Major key is 11 and 12;
S103, according to the first Major key of each of at least one first Major key, successively preset rules instruction Search operation is carried out in inquiry table, obtains the project of the corresponding each candidate of each first Major key.
It include the first tabular value and associated with first tabular value in first tables of data in above-mentioned each project The second tabular value in second tables of data;That is, just the first tables of data has been associated with the second tables of data in inquiry table Come, therefore can be found in the inquiry table that preset rules indicate according to the Major key in S102 and meet above-mentioned first choice item First tabular value of part and the second tabular value associated with first tabular value.
S104, according to the second alternative condition, first choice condition and the second choosing are determined for compliance in the project of each candidate Select the final project of condition.
Due in S103 by carrying out search operation in the inquiry table that preset rules indicate, acquisition it is each candidate Include in project meet first choice condition each first tabular value and with associated each second tabular value of each first tabular value, Then the second alternative condition can be used to determine final project in above-mentioned candidate items in S104, that is to say, that determine and met First tabular value of the first choice condition and second alternative condition and with associated second tabular value of first tabular value.
In the present embodiment, by being inquired in the inquiry table that preset rules indicate, the item of obtained preset candidate Include in mesh meet first choice condition each first tabular value and with associated each second tabular value of each first tabular value, from And the first table for meeting the first choice condition and second alternative condition can be determined by the second alternative condition again Value and with associated second tabular value of first tabular value, do not need compared with prior art, in the present embodiment to the first tables of data and Second tables of data carries out multiple attended operation, simplifies query process, improves inquiry velocity.
Fig. 2 is the flow chart of the processing method embodiment two of present invention inquiry data.As shown in Fig. 2, the present embodiment be Further description is made on the basis of embodiment shown in FIG. 1, detailed process is as follows:
S201, first Major key is configured to each of the first tables of data data information, obtains being configured with first First tables of data of Major key.
By S201, available aforementioned table 3, that is to say, that table 3 is first data for being configured with the first Major key (corresponding data information in table 1 is not shown) in table in table 3.
S202, each single item data information being configured with according in the first tables of data of the first Major key and described second The incidence relation between at least one data information in tables of data, establishes default first table.
Include in each list item of above-mentioned default first table second tabular value and with second tabular value corresponding first Major key.
Be the first tables of data with table 1, with table 2 be the second tables of data, table 3 is obtained by S201, then further, according to S202 can obtain default first table, the default first table such as table 4:
Table 4
Second tabular value (sid) First Major key
0 11
1 13
2 14
3 12
4 12
5 10
6 11
7 13
8 11
For ease of description, the corresponding data information of second tabular value is not shown in above-mentioned table 4;From the foregoing, it will be observed that passing through first Major key associates the first tabular value and the second tabular value.
S203, the first attended operation sentence is received.
S204, according to the data information in first choice condition and first tables of data, be configured with the first Major key The first tables of data in find at least one first Major key.
For example, according to first choice condition query table 3, the first obtained Major key is 11 and 12.
The first Major key of each of S205, at least one the first Major key according to, successively refers in preset rules Search operation is carried out in the inquiry table shown, obtains the project of the corresponding each candidate of each first Major key.
In the present embodiment, the inquiry table of preset rules instruction is default first table, then above-mentioned search operation includes:
First Major key of current operation is A, and being configured with the first tabular value corresponding to the data information of A is a,
Each list item in default first table is then searched according to the first Major key A, acquisition with A associated each the Two tabular values are respectively M1、M2……Mn, n is the positive integer not less than 1;
In conjunction with a and with associated each second tabular value of A, the project of each candidate corresponding with A of acquisition is respectively (M1, a)、(M2, a) ... (Mn, a).
Using in S204 as exemplary 11 and 12, when the first Major key of current operation is 11, then it is configured with 11 First tabular value corresponding to data information is 1, and searching default first table to obtain each second tabular value according to 11 is 0,6 and 8, then In conjunction with the first tabular value 1 and with 11 associated each second tabular values, obtained candidate project be respectively (0,1), (6,1) and (8, 1);Correspondingly, continue the first Major key using 12 as the current operation, obtained candidate project respectively (3,2) and (4,2) are (0,1), (6,1), (8,1) (3,2) and (4,2) by the candidate project that S205 is obtained.
S206, according to the second alternative condition, the first choice condition and institute are determined for compliance in the project of each candidate State the final project of the second alternative condition.
Each second tabular value in the project of each candidate has the data information of corresponding second tables of data, then according to Two alternative conditions screen data information corresponding to each second tabular value in the project of each candidate, so that it is determined that Final project out;Such as according to the second alternative condition to the number of the second tables of data corresponding to above-mentioned second tabular value 0,3,4,6 and 8 It is believed that breath is screened, the data information for being determined for compliance with the second tables of data of second condition is that the second tabular value 3 and 6 is corresponding Data information, it is determined that final project be (3,2) and (6,1), that is to say, that pass through above-mentioned each step, it is determined that meet Corresponding first tabular value of the data information of first choice condition is respectively 1 and 2, and the second tabular value 3 and 6 being respectively associated with 1 and 2 Corresponding data information also complies with the second alternative condition.
Default first table is established by above-mentioned S201~S202, then when then receiving attended operation sentence every time, no S201~S202 is executed again, is directly executed by S203.
It include satisfaction the by being inquired in default first table, in obtained candidate project in the present embodiment Each first tabular value of one alternative condition and with associated each second tabular value of each first tabular value, thus again by second selection Condition can determine the first tabular value for meeting the first choice condition and second alternative condition and with first tabular value Associated second tabular value does not need to carry out the first tables of data and the second tables of data compared with prior art, in the present embodiment more Secondary attended operation, simplifies query process, improves inquiry velocity.
Fig. 3 is the flow chart of the processing method embodiment three of present invention inquiry data.As shown in figure 3, the present embodiment is one The optional embodiment of kind, specific as follows:
S301, first Major key is configured to each of the first tables of data data information, obtains being configured with first First tables of data of Major key.
S302, basis obtain each single item data information being configured in the first tables of data of the first Major key and described second The incidence relation between at least one data information in tables of data, establishes default first table.
Above-mentioned S301 and S302 is identical as aforementioned S201 and S302.
S303, according to the size for presetting each first Major key in the first table, it is suitable according to from small to large or from big to small Each list item that the first table is preset described in ordered pair is ranked up, and is configured with each position-order for each list item in default first table Number.
Wherein, when the first Major key in the first Major key and the second list item in the first list item of default first table It is equal in magnitude, then the position number of the position number of first list item and second list item is different;
Specifically, as shown in table 5 for the signal that each list item in default first table is configured with each position number:
Table 5
Second tabular value (sid) First Major key Position number
5 10 1
0 11 2
6 11 3
8 11 4
3 12 5
4 12 6
1 13 7
7 13 8
2 14 9
Above-mentioned table 5 is to be ranked up to table 4 using sequence from small to large, since there are 3 11,2 in table 4 12 and two 13, then when sorting, whens 3 11 position numbers, is different, that is, is followed successively by 2,3,4, similar, for 2 12 Say that position number is followed successively by 5,6, for 2 13, position number is followed successively by 7,8, due to only having 1 10 and 1 in table 4 14, then 10 position number is 1 after sorting, and 14 position number is 9;Above-mentioned table 5 is used to illustrate the realization effect of S303, It can not be established in practical application, i.e. the processing unit of inquiry data only needs to determine each list item in default first table by S303 Position number.
S304, basis preset first in the position number of each list item of the first table and each list item of default first table Major key establishes default second table.
In default second table in each list item, a position number and be configured in the list item of the position number first Major key is associated, and default second table is as shown in table 6:
Table 6
First Major key Position number
10 1
11 2
11 3
11 4
12 5
12 6
13 7
13 8
14 9
S305, default third table is established according to default first table and default second table.
The first data in default third table in each list item are first Major key, and the second data are described default Be associated with the first position number of first Major key in second table, third data be associated in default second table this The last bit position number of one Major key, the 4th data are to be configured with the first table corresponding to the data information of first Major key Value, referring in particular to table 6, when S301 is with from small to large along being sorted, the corresponding position number of the first Major key 11 is 2,3 With 4, then in the position number sequence that constitutes 2,3 and 4, the first position number is 2, and last bit position number is 4;And for first For Major key 10, position number only has unique 1, it can be understood as the first Major key 10, position number sequence In only include 1, then the first position number is 1, and last bit position number is also 1.
It should be noted that above-mentioned first data, the second data, third data and the 4th data are only used for distinguishing default the The difference of four item datas in each list item of three tables, the position where not limiting four item data put in order.
S306, default 4th table is established according to default first table and default second table.
In each of default 4th table list item, with the associated position number of first Major key and with it is corresponding It is associated in the second tabular value of first Major key;Referring to table 4 and table 6, then default 4th table established is as shown in table 7:
Table 7
Second tabular value (sid) Position number
5 1
0 2
6 3
8 4
3 5
4 6
1 7
7 8
2 9
For example, first Major key, the 10 relative position serial number 1 in table 6, and it is right with the first Major key 10 in table 4 The second tabular value answered is 5, then in the table 7 established, position number 1 and the second tabular value 5 are associated.
S307, the first attended operation sentence is received.
S308, according to the data information in first choice condition and first tables of data, be configured with the first Major key The first tables of data in find at least one first Major key.
For example, according to first choice condition query table 3, the first obtained Major key is 11 and 12.
S309, according to the first Major key of each of at least one first Major key, successively preset rules instruction Search operation is carried out in inquiry table, obtains the project of the corresponding each candidate of each first Major key.
The inquiry table of above-mentioned preset rules instruction includes the default third table and default 4th table, then above-mentioned lookup Operation includes:
Searched in the default third table according to A, obtain the list item in the default third table where A be (A, N1、Nn,a);
According to N1And NnIt is extended, the corresponding position number sequence of the A of acquisition is [N1、N2……Nn];
According to position number each in the corresponding position number sequence of A inquiry default 4th table, acquisition and A Associated each second tabular value is respectively M1、M2、……Mn
In conjunction with a and with associated each second tabular value of A, obtaining the corresponding each candidate items of A is respectively (M1, a), (M2, a)……(Mn, a);
Wherein A corresponding position number in default second table is respectively N1、N2……Nn, n is just not less than 1 Integer, and being ranked up when according to each list item of the sequence from small to large to default first table, then described default the N in two tables1<N2……<Nn
It is ranked up when according to each list item of the sequence from big to small to default first table, then described default the N in two tables1>N2……>Nn
Using in S204 as exemplary first Major key 11 and 12, when the first Major key of current operation is 11, then It is inquired in default third table according to the first Major key 11, obtains the list item in default third table where the first Major key 11 For (11,2,4,1), be extended further according to 2 and 4, the corresponding position number sequence of the first Major key 11 of acquisition be [2,3, 4];Inquire default 4th table further according to position number each in the corresponding position number sequence of the first Major key, acquisition with the Associated each second tabular value of one Major key is respectively 0,6,8, then combine the first tabular value 1 and with 11 associated each second tables Value, obtained candidate project are respectively (0,1), (6,1) and (8,1);Correspondingly, continuing using 12 as the current operation First Major key, using the inquiry operation in S307, obtained candidate project is respectively (3,2) and (4,2), that is, passes through S307 Obtained candidate project is (0,1), (6,1), (8,1) (3,2) and (4,2).
It since the present embodiment is when executing search operation, is searched default third table, then it is main for one first For key assignments, the first position number and last bit position-order that can directly know that first Major key is related to by presetting third table Number the two position numbers can be derived each in the position number sequence constituted with the first position number and last bit position number A position number further can determine corresponding each second tabular value by default 4th table, it is possible to understand that, derive position The process for setting sequence number sequence can be unified into the behavior of default 4th table of inquiry, such as the first position-order of the first Major key 11 It number is 2, last bit position number is 4, then can directly be gone to inquire default 4th table according to position number 2 and position number 4, and looking into When looking for, the list item that position is 2 and position is 4 can be found in default 4th table, natural, being located at position is 2 and position List item between 4 list item includes position number 3, then directly acquires the second tabular value in continuous three list items;Also It is to say, in the present embodiment, the processing unit for inquiring data does not need successively each of second table of access preset list item, can be straight It can be obtained and the associated institute of the first Major key when connecing according to the first position number and last bit position number four table of access preset The second tabular value having, largely saves query time.
S310, according to the second alternative condition, the first choice condition and institute are determined for compliance in the project of each candidate State the final project of the second alternative condition
Specifically refer to above-mentioned S206.
Default first table, default second table, default third table and default 4th table are established by above-mentioned S301~S306, When then then receiving attended operation sentence every time, no longer execution S301~S306 is directly executed by S307.
In the present embodiment, default first table, default second table are successively established, default third table and default 4th table are obtained, So that the processing unit of inquiry data carries out inquiry operation according to attended operation sentence and default third table and default 4th table, obtain To candidate project in include meet each first tabular value of first choice condition and with each first tabular value it is associated each A second tabular value meets the first choice condition and second selection to can determine by the second alternative condition again First tabular value of condition and with associated second tabular value of first tabular value, do not need compared with prior art, in the present embodiment pair First tables of data and the second tables of data carry out multiple attended operation, simplify query process, improve inquiry velocity.
Fig. 4 is the flow chart of the processing method example IV of present invention inquiry data.As shown in figure 4, the present embodiment is another A kind of optional embodiment, specific as follows:
S401, first Major key is configured to each of the first tables of data data information, obtains being configured with first First tables of data of Major key.
S402, basis are configured with each single item data information and second data in the first tables of data of the first Major key The incidence relation between at least one data information in table, establishes default first table.
S403, according to the size for presetting each first Major key in the first table, it is suitable according to from small to large or from big to small Each list item that the first table is preset described in ordered pair is ranked up, and is configured with each position-order for each list item in default first table Number.
S404, basis preset first in the position number of each list item of the first table and each list item of default first table Major key establishes default second table.
S405, default third table is established according to default first table and default second table.
S406, default 4th table is established according to default first table and default second table.
Above-mentioned S401~S406 is identical as aforementioned S301 and S306.
S407, b-tree indexed is established according to default third table.
Key of first data as each node in the b-tree indexed in the default third table in each list item Word, second data, the third data and the 4th data in the default third table in each list item are as attached Belong to information association in corresponding each node.Fig. 5 is the schematic diagram of b-tree indexed in the embodiment of the present invention four.As shown in figure 5, with Make exemplary first Major key and only have 10~14, is then root node by 12 according to the left-right balance of b-tree indexed, and for every For one node, in two paths for moving towards next stage node, keyword is directed toward less than this node key in path to the right Node, to the left path be directed toward keyword be greater than this node key node, i.e., for root node 12, root node connection Two next stage nodes in, positioned at be greater than 12 13 in left side, positioned at be less than 12 11 on right side;For node 13 It says, the 14 of 13 is only greater than in next stage node, the node less than 13, then be not sky;For node 11, next stage section Only have 10 less than 11 in point, is then sky without the node for being greater than 11;Wherein each node is associated with corresponding satellite information.
S408, the first attended operation sentence is received.
S409, according to the data information in first choice condition and first tables of data, be configured with the first Major key The first tables of data in find at least one first Major key.
For example, according to first choice condition query table 3, the first obtained Major key is 11 and 12.
S410, according to the first Major key of each of at least one first Major key, successively preset rules instruction Search operation is carried out in inquiry table, obtains the project of the corresponding each candidate of each first Major key.
When the inquiry table of preset rules instruction includes above-mentioned b-tree indexed and default four table, above-mentioned search operation includes:
When first Major key of current operation is A, and being configured with the first tabular value corresponding to the data information of A is a,
It is searched in the b-tree indexed using A as the keyword, obtaining the corresponding satellite information of A is (N1、Nn、 a);
According to N1And NnIt is extended, the corresponding position number sequence of the A of acquisition is [N1、N2……Nn];
According to position number each in the corresponding position number sequence of A inquiry default 4th table, acquisition and A Associated each second tabular value is respectively M1、M2... ... Mn
In conjunction with a and with associated each second tabular value of A, each candidate items corresponding with A of acquisition are respectively (M1, a), (M2, a) ... (Mn, a);
Wherein A corresponding position number in default second table is respectively N1、N2……Nn, n is just not less than 1 Integer, and being ranked up when according to each list item of the sequence from small to large to default first table, then described default the N in two tables1<N2……<Nn
It is ranked up when according to each list item of the sequence from big to small to default first table, then described default the N in two tables1>N2……>Nn
It since the present embodiment is when executing search operation, is searched b-tree indexed, then for first Major key For, first Major key can be quickly found out by b-tree indexed, specifically, 11 keyword as a node, then with section In the node of the connected next stage of point 11, less than 11 when positioned at the keyword of the node in left side, and the key of the node on right side Word is greater than 11, if the first Major key of current operation is 12, the processing unit for inquiring data is based on the b-tree indexed, is The above-mentioned node positioned at left side will not be accessed, directly access can be located at the node on right side, and obtain the additional of first Major key Information further can determine corresponding each second tabular value by default 4th table, that is to say, that by b-tree indexed, no It needs to access to each of default third table list item to filter out the first Major key of current operation, passes through B-tree rope Draw the first Major key that can be quickly found out current operation.Further save query time.
S411, according to the second alternative condition, the first choice condition and institute are determined for compliance in the project of each candidate State the final project of the second alternative condition.
Default first table, default second table, default third table, the default 4th are successively established by above-mentioned S401~S407 Table, and establish b-tree indexed according to default third table, then when then receiving attended operation sentence every time, no longer execution S401~ S407 is directly executed by S408.
In the present embodiment, by successively establishing default first table, default second table, preset third table and default 4th table and According to the b-tree indexed for presetting the foundation of third table, so that the processing unit of inquiry data can quickly find satisfaction in b-tree indexed First Major key of first choice condition, and it is corresponding with the first Major key according to the corresponding additional information determination of the first Major key First tabular value and the second tabular value to get to candidate project in include meet first choice condition each first tabular value and With associated each second tabular value of each first tabular value, meet described first to can determine by the second alternative condition again First tabular value of alternative condition and second alternative condition and with associated second tabular value of first tabular value, with prior art phase Than, it does not need to carry out multiple attended operation to the first tables of data and the second tables of data in the present embodiment, simplifies query process, Improve inquiry velocity.
In addition, it is necessary to explanation, in any embodiment shown in FIG. 1 to FIG. 4, when carry out the search operation it Afterwards, a candidate project is only obtained, it is determined that the project of the candidate is final project.
Fig. 6 is the structure chart of the processing device embodiment one of present invention inquiry data.As shown in fig. 6, the processing unit packet It includes:
Receiving module 51 is carried for receiving the first attended operation sentence, in the first attended operation sentence for the The first choice condition of one tables of data and the second alternative condition for the second tables of data, each single item in first tables of data In data information and second tables of data at least one of between data information there are incidence relation, it is every in the tables of data One data information corresponds to a tabular value;
First enquiry module 52, for according to the data information in the first choice condition and first tables of data, At least one first Major key is found in the first tables of data for being configured with the first Major key;
Second enquiry module 53 is used for the first Major key of each of at least one the first Major key according to, according to It is secondary that search operation is carried out in the inquiry table of preset rules instruction, obtain the corresponding each candidate's of each first Major key Project, include in each project the first tabular value in first tables of data and with associated second data of first tabular value The second tabular value in table;
Third enquiry module 54, for determining symbol in the project of each candidate according to second alternative condition Close the final project of the first choice condition and second alternative condition.
In the present embodiment, by being inquired in the inquiry table that preset rules indicate, the item of obtained preset candidate Include in mesh meet first choice condition each first tabular value and with associated each second tabular value of each first tabular value, from And the first table for meeting the first choice condition and second alternative condition can be determined by the second alternative condition again Value and with associated second tabular value of first tabular value, do not need compared with prior art, in the present embodiment to the first tables of data and Second tables of data carries out multiple attended operation, simplifies query process, improves inquiry velocity.
Fig. 7 is the structure chart of the processing device embodiment two of present invention inquiry data.As shown in fig. 7, the processing unit is also Include:
Module 55 is established, for configuring first Major key to each of first tables of data data information, Obtain first tables of data for being configured with the first Major key;
Inquiry table is established according to the first tables of data and the second tables of data;
It is described to establish the inquiry table and include:
According to each single item data information being configured in the first tables of data of the first Major key and second data The incidence relation between at least one data information in table, establishes default first table;Each table of default first table It include second tabular value and the first Major key corresponding with second tabular value in.
Further, the module of establishing is also used to:
According to the size of each first Major key in default first table, according to sequence from small to large or from big to small Each list item of default first table is ranked up, is configured with each position-order for each list item in default first table Number;Wherein, big when the first Major key in the first Major key and the second list item in the first list item of default first table Small equal, then the position number of first list item is different with the position number of second list item;
According in each list item of the position number of each list item of default first table and default first table First Major key establishes default second table, in default second table in each list item, a position number and is configured with this The first Major key in the list item of position number is associated;
It establishes according to default first table and default second table and presets third table, it is each in the default third table The first data in a list item are first Major key, and the second data are to be associated with first major key in default second table The first position number of value, third data are the last bit position number that first Major key is associated in default second table, 4th data are to be configured with the first tabular value corresponding to the data information of first Major key;
Default 4th table is established according to default first table and default second table, it is every in default 4th table It is to the associated position number of first Major key and related with the second tabular value of first Major key is corresponded in one list item Connection.
Further, the module of establishing is also used to:
B-tree indexed is established according to the default third table, then the first digit in the default third table in each list item According to the keyword as each node in the b-tree indexed;
Second data, the third data and the 4th data in the default third table in each list item are made Corresponding each node is associated with for satellite information.
Flexibly, when the inquiry table of preset rules instruction is default first table, then second enquiry module It is specifically used for
First Major key of current operation is A, and being configured with the first tabular value corresponding to the data information of A is a,
Each list item in default first table is then searched according to the first Major key A, acquisition with A associated each the Two tabular values are respectively M1、M2……Mn, n is the positive integer not less than 1;
In conjunction with a and with associated each second tabular value of A, the project of each candidate corresponding with A of acquisition is respectively (M1, a)、(M2, a) ... (Mn, a).
Flexibly, when the inquiry table of preset rules instruction includes the default third table and default 4th table, Second enquiry module is specifically used for
First Major key of current operation is A, and being configured with the first tabular value corresponding to the data information of A is a,
Searched in the default third table according to A, obtain the list item in the default third table where A be (A, N1、Nn,a);
According to N1And NnIt is extended, the corresponding position number sequence of the A of acquisition is [N1、N2……Nn];
According to position number each in the corresponding position number sequence of A inquiry default 4th table, acquisition and A Associated each second tabular value is respectively M1、M2、……Mn
In conjunction with a and with associated each second tabular value of A, obtaining the corresponding each candidate items of A is respectively (M1, a), (M2, a)……(Mn, a);
Wherein A corresponding position number in default second table is respectively N1、N2……Nn, n is just not less than 1 Integer, and being ranked up when according to each list item of the sequence from small to large to default first table, then described default the N in two tables1<N2……<Nn
It is ranked up when according to each list item of the sequence from big to small to default first table, then described default the N in two tables1>N2……>Nn
Flexibly, described when the inquiry table of preset rules instruction includes the b-tree indexed and default 4th table Second enquiry module is specifically used for
First Major key of current operation is A, and being configured with the first tabular value corresponding to the data information of A is a,
It is searched in the b-tree indexed using A as the keyword, obtaining the corresponding satellite information of A is (N1、Nn、 a);
According to N1And NnIt is extended, the corresponding position number sequence of the A of acquisition is [N1、N2……Nn];
According to position number each in the corresponding position number sequence of A inquiry default 4th table, acquisition and A Associated each second tabular value is respectively M1、M2... ... Mn
In conjunction with a and with associated each second tabular value of A, each candidate items corresponding with A of acquisition are respectively (M1, a), (M2, a) ... (Mn, a);
Wherein A corresponding position number in default second table is respectively N1、N2……Nn, n is just not less than 1 Integer, and being ranked up when according to each list item of the sequence from small to large to default first table, then described default the N in two tables1<N2……<Nn
It is ranked up when according to each list item of the sequence from big to small to default first table, then described default the N in two tables1>N2……>Nn
You need to add is that only obtaining a candidate item after second enquiry module carries out the search operation Mesh, it is determined that the project of the candidate is final project.
In the present embodiment, by successively establishing default first table, default second table, preset third table and default 4th table and According to the b-tree indexed presetting third table and establishing so that the processing unit of inquiry data can flexible selection gist preset the first table, Or default third table and default 4th table, or quickly find candidate project according to b-tree indexed and default 4th table, then into One step need to only be determined according to the second alternative condition final project to get to candidate project in include meeting first choice Each first tabular value of condition and with associated each second tabular value of each first tabular value, thus again by the second alternative condition just The first tabular value for meeting the first choice condition and second alternative condition and associated with first tabular value is can determine Second tabular value does not need to carry out multiple company to the first tables of data and the second tables of data compared with prior art, in the present embodiment Operation is connect, query process is simplified, improves inquiry velocity.
It should be noted that the modules in above-mentioned each Installation practice correspond in aforementioned each embodiment of the method Each step, specific implementation steps and technical effect can refer to aforementioned each embodiment of the method.
Fig. 8 is the structure chart of the processing device embodiment three of present invention inquiry data.As shown in figure 8, the processing unit packet It includes:
Processor 60 carries in the first attended operation sentence for receiving the first attended operation sentence and is directed to first The first choice condition of tables of data and the second alternative condition for the second tables of data, each item number in first tables of data It is believed that in breath and second tables of data at least one of between data information there are incidence relation, it is each in the tables of data A data information corresponds to a tabular value;
According to the data information in the first choice condition and first tables of data, it is being configured with the first Major key At least one first Major key is found in first tables of data;
According to the first Major key of each of at least one first Major key, successively being looked into what preset rules indicated It carries out search operation in inquiry table, obtains the project of the corresponding each candidate of each first Major key, in each project Including in first tables of data the first tabular value and with the second tabular value in associated second tables of data of first tabular value;
According to second alternative condition, be determined for compliance in the project of each candidate the first choice condition and The final project of second alternative condition.
Further, processor 60 is also used to configure one first to each of first tables of data data information Major key obtains first tables of data for being configured with the first Major key;
Inquiry table is established according to the first tables of data and the second tables of data;
It is described to establish the inquiry table and include:
According to each single item data information being configured in the first tables of data of the first Major key and second data The incidence relation between at least one data information in table, establishes default first table;Each table of default first table It include second tabular value and the first Major key corresponding with second tabular value in.
According to the size of each first Major key in default first table, according to sequence from small to large or from big to small Each list item of default first table is ranked up, is configured with each position-order for each list item in default first table Number;Wherein, big when the first Major key in the first Major key and the second list item in the first list item of default first table Small equal, then the position number of first list item is different with the position number of second list item;
According in each list item of the position number of each list item of default first table and default first table First Major key establishes default second table, in default second table in each list item, a position number and is configured with this The first Major key in the list item of position number is associated;
It establishes according to default first table and default second table and presets third table, it is each in the default third table The first data in a list item are first Major key, and the second data are to be associated with first major key in default second table The first position number of value, third data are the last bit position number that first Major key is associated in default second table, 4th data are to be configured with the first tabular value corresponding to the data information of first Major key;
Default 4th table is established according to default first table and default second table, it is every in default 4th table It is to the associated position number of first Major key and related with the second tabular value of first Major key is corresponded in one list item Connection.
Further, processor 60 is also used to:
B-tree indexed is established according to the default third table, then the first digit in the default third table in each list item According to the keyword as each node in the b-tree indexed;
Second data, the third data and the 4th data in the default third table in each list item are made Corresponding each node is associated with for satellite information.
Flexibly, when the inquiry table of preset rules instruction is default first table, then the processor 60 is specific For
First Major key of current operation is A, and being configured with the first tabular value corresponding to the data information of A is a,
Each list item in default first table is then searched according to the first Major key A, acquisition with A associated each the Two tabular values are respectively M1、M2……Mn, n is the positive integer not less than 1;
In conjunction with a and with associated each second tabular value of A, the project of each candidate corresponding with A of acquisition is respectively (M1, a)、(M2, a) ... (Mn, a).
Flexibly, when the inquiry table of preset rules instruction includes the default third table and default 4th table, The processor 60 is specifically used for
First Major key of current operation is A, and being configured with the first tabular value corresponding to the data information of A is a,
Searched in the default third table according to A, obtain the list item in the default third table where A be (A, N1、Nn,a);
According to N1And NnIt is extended, the corresponding position number sequence of the A of acquisition is [N1、N2……Nn];
According to position number each in the corresponding position number sequence of A inquiry default 4th table, acquisition and A Associated each second tabular value is respectively M1、M2、……Mn
In conjunction with a and with associated each second tabular value of A, obtaining the corresponding each candidate items of A is respectively (M1, a), (M2, a)……(Mn, a);
Wherein A corresponding position number in default second table is respectively N1、N2……Nn, n is just not less than 1 Integer, and being ranked up when according to each list item of the sequence from small to large to default first table, then described default the N in two tables1<N2……<Nn
It is ranked up when according to each list item of the sequence from big to small to default first table, then described default the N in two tables1>N2……>Nn
Flexibly, described when the inquiry table of preset rules instruction includes the b-tree indexed and default 4th table Processor 60 is specifically used for
First Major key of current operation is A, and being configured with the first tabular value corresponding to the data information of A is a,
It is searched in the b-tree indexed using A as the keyword, obtaining the corresponding satellite information of A is (N1、Nn、 a);
According to N1And NnIt is extended, the corresponding position number sequence of the A of acquisition is [N1、N2……Nn];
According to position number each in the corresponding position number sequence of A inquiry default 4th table, acquisition and A Associated each second tabular value is respectively M1、M2、……Mn
In conjunction with a and with associated each second tabular value of A, each candidate items corresponding with A of acquisition are respectively (M1, a), (M2, a) ... (Mn, a);
Wherein A corresponding position number in default second table is respectively N1、N2……Nn, n is just not less than 1 Integer, and being ranked up when according to each list item of the sequence from small to large to default first table, then described default the N in two tables1<N2……<Nn
It is ranked up when according to each list item of the sequence from big to small to default first table, then described default the N in two tables1>N2……>Nn
You need to add is that only obtaining a candidate project, then really after the processor carries out the search operation The project of the fixed candidate is final project.
In the present embodiment, by successively establishing default first table, default second table, preset third table and default 4th table and According to the b-tree indexed presetting third table and establishing so that the processing unit of inquiry data can flexible selection gist preset the first table, Or default third table and default 4th table, or quickly find candidate project according to b-tree indexed and default 4th table, then into One step need to only be determined according to the second alternative condition final project to get to candidate project in include meeting first choice Each first tabular value of condition and with associated each second tabular value of each first tabular value, thus again by the second alternative condition just The first tabular value for meeting the first choice condition and second alternative condition and associated with first tabular value is can determine Second tabular value does not need to carry out multiple company to the first tables of data and the second tables of data compared with prior art, in the present embodiment Operation is connect, query process is simplified, improves inquiry velocity.
It should be noted that the corresponding each step implemented in aforementioned each embodiment of the method for above-mentioned processor, specifically Implementation steps and technical effect can refer to aforementioned each embodiment of the method.
Those of ordinary skill in the art will appreciate that: realize that all or part of the steps of above method embodiment can pass through The relevant hardware of program instruction is completed, and program above-mentioned can be stored in a computer readable storage medium, the program When being executed, step including the steps of the foregoing method embodiments is executed;And storage medium above-mentioned includes: ROM, RAM, magnetic disk or light The various media that can store program code such as disk.
Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention., rather than its limitations;To the greatest extent Pipe present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that: its according to So be possible to modify the technical solutions described in the foregoing embodiments, or to some or all of the technical features into Row equivalent replacement;And these are modified or replaceed, various embodiments of the present invention technology that it does not separate the essence of the corresponding technical solution The range of scheme.

Claims (16)

1. a kind of processing method for inquiring data characterized by comprising
The first attended operation sentence is received, carries the first choice item for being directed to the first tables of data in the first attended operation sentence Part and the second alternative condition for the second tables of data, each single item data information and second number in first tables of data According to, there are incidence relation, each of described tables of data data information corresponds to one between at least one data information in table A tabular value;
According to the data information in the first choice condition and first tables of data, found at least in the first tables of data One the first Major key;First tables of data includes corresponding first Major key of each single item data information;
According to the first Major key of each of at least one first Major key, successively in the inquiry table of preset rules instruction Middle carry out search operation obtains the project of the corresponding each candidate of each first Major key, includes in each project The first tabular value in first tables of data and with the second tabular value in associated second tables of data of first tabular value;
According to second alternative condition, the first choice condition and described is determined for compliance in the project of each candidate The final project of second alternative condition.
2. processing method according to claim 1, which is characterized in that before the first attended operation sentence of the reception, The processing method further include:
First Major key is configured to each of first tables of data data information, obtains that described to be configured with first main First tables of data of key assignments;
Inquiry table is established according to the first tables of data and the second tables of data;
It is described to establish the inquiry table and include:
According in each single item data information being configured in the first tables of data of the first Major key and second tables of data At least one of incidence relation between data information, establish default first table;In each list item of default first table Including second tabular value and the first Major key corresponding with second tabular value.
3. processing method according to claim 2, which is characterized in that establish after default first table, the processing Method further include:
According to the size of each first Major key in default first table, according to sequence from small to large or from big to small to institute The each list item for stating default first table is ranked up, and is configured with each position number for each list item in default first table; Wherein, when the size phase of the first Major key in the first Major key and the second list item in the first list item of default first table Deng then the position number of the position number of first list item and second list item is different;
According to first in each list item of the position number of each list item of default first table and default first table Major key establishes default second table, in default second table in each list item, a position number and is configured with the position The first Major key in the list item of serial number is associated;
Default third table, each table in the default third table are established according to default first table and default second table The first data in are first Major key, and the second data are to be associated with first Major key in default second table The first position number, third data are the last bit position number that first Major key is associated in default second table, the 4th Data are to be configured with the first tabular value corresponding to the data information of first Major key;
Each of default 4th table, default 4th table are established according to default first table and default second table It is with the associated position number of first Major key and associated with the second tabular value of first Major key is corresponded in list item.
4. processing method according to claim 3, which is characterized in that after establishing the default third table, the place Reason method further include:
B-tree indexed is established according to the default third table, then a data in the default third table in each list item is made For the keyword of each node in the b-tree indexed;
Second data, the third data and the 4th data in the default third table in each list item are as attached Belong to information association in corresponding each node.
5. processing method according to claim 2, which is characterized in that the inquiry table of the preset rules instruction is described pre- If the first table, then the search operation includes:
First Major key of current operation is A, and being configured with the first tabular value corresponding to the data information of A is a,
Each list item in default first table is then searched according to the first Major key A, acquisition with associated each second table of A Value is respectively M1、M2……Mn, n is the positive integer not less than 1;
In conjunction with a and with associated each second tabular value of A, the project of each candidate corresponding with A of acquisition is respectively (M1, a), (M2, a) ... (Mn, a).
6. processing method according to claim 3, which is characterized in that the inquiry table of the preset rules instruction includes described Default third table and default 4th table, the search operation include:
First Major key of current operation is A, and being configured with the first tabular value corresponding to the data information of A is a,
It is searched in the default third table according to A, obtaining the list item in the default third table where A is (A, N1、Nn、 a);
According to N1And NnIt is extended, the corresponding position number sequence of the A of acquisition is [N1、N2……Nn];
According to position number each in the corresponding position number sequence of A inquiry default 4th table, acquisition is associated with A Each second tabular value be respectively M1、M2、……Mn
In conjunction with a and with associated each second tabular value of A, obtaining the corresponding each candidate items of A is respectively (M1, a), (M2, a)……(Mn, a);
Wherein A corresponding position number in default second table is respectively N1、N2……Nn, n is the positive integer not less than 1, And be ranked up when according to each list item of the sequence from small to large to default first table, then in default second table N1<N2……<Nn
It is ranked up when according to each list item of the sequence from big to small to default first table, then in default second table Middle N1>N2……>Nn
7. processing method according to claim 4, which is characterized in that the inquiry table of the preset rules instruction includes described B-tree indexed and default 4th table, the search operation include:
First Major key of current operation is A, and being configured with the first tabular value corresponding to the data information of A is a,
It is searched in the b-tree indexed using A as the keyword, obtaining the corresponding satellite information of A is (N1、Nn,a);
According to N1And NnIt is extended, the corresponding position number sequence of the A of acquisition is [N1、N2……Nn];
According to position number each in the corresponding position number sequence of A inquiry default 4th table, acquisition is associated with A Each second tabular value be respectively M1、M2……Mn
In conjunction with a and with associated each second tabular value of A, each candidate items corresponding with A of acquisition are respectively (M1, a), (M2, a)……(Mn, a);
Wherein A corresponding position number in default second table is respectively N1、N2……Nn, n is the positive integer not less than 1, And be ranked up when according to each list item of the sequence from small to large to default first table, then in default second table N1<N2……<Nn
It is ranked up when according to each list item of the sequence from big to small to default first table, then in default second table Middle N1>N2……>Nn
8. described in any item processing methods according to claim 1~7, which is characterized in that after carrying out the search operation, Only obtain a candidate project, it is determined that the project of the candidate is final project.
9. a kind of processing unit for inquiring data characterized by comprising
Receiving module carries in the first attended operation sentence for receiving the first attended operation sentence and is directed to the first data The first choice condition of table and the second alternative condition for the second tables of data, each item data letter in first tables of data There are incidence relation, each of described tables of data numbers between at least one data information in breath and second tables of data It is believed that breath corresponds to a tabular value;
First enquiry module, for according to the data information in the first choice condition and first tables of data, first At least one first Major key is found in tables of data;First tables of data includes corresponding first master of each single item data information Key assignments;
Second enquiry module, for the first Major key of each of at least one the first Major key according to, successively pre- If carrying out search operation in the inquiry table of rule instruction, the project of the corresponding each candidate of each first Major key is obtained, In each project include first tables of data in the first tabular value and in associated second tables of data of first tabular value The second tabular value;
Third enquiry module, it is described for being determined for compliance in the project of each candidate according to second alternative condition The final project of first choice condition and second alternative condition.
10. processing unit according to claim 9, which is characterized in that the processing unit further include:
Module is established, for configuring first Major key to each of first tables of data data information, obtains institute State the first tables of data for being configured with the first Major key;
Inquiry table is established according to the first tables of data and the second tables of data;
It is described to establish the inquiry table and include:
According in each single item data information being configured in the first tables of data of the first Major key and second tables of data At least one of incidence relation between data information, establish default first table;In each list item of default first table Including second tabular value and the first Major key corresponding with second tabular value.
11. processing unit according to claim 10, which is characterized in that the module of establishing is also used to
According to the size of each first Major key in default first table, according to sequence from small to large or from big to small to institute The each list item for stating default first table is ranked up, and is configured with each position number for each list item in default first table; Wherein, when the size phase of the first Major key in the first Major key and the second list item in the first list item of default first table Deng then the position number of the position number of first list item and second list item is different;
According to first in each list item of the position number of each list item of default first table and default first table Major key establishes default second table, in default second table in each list item, a position number and is configured with the position The first Major key in the list item of serial number is associated;
Default third table, each table in the default third table are established according to default first table and default second table The first data in are first Major key, and the second data are to be associated with first Major key in default second table The first position number, third data are the last bit position number that first Major key is associated in default second table, the 4th Data are to be configured with the first tabular value corresponding to the data information of first Major key;
Each of default 4th table, default 4th table are established according to default first table and default second table It is with the associated position number of first Major key and associated with the second tabular value of first Major key is corresponded in list item.
12. processing unit according to claim 11, which is characterized in that the module of establishing is also used to
B-tree indexed is established according to the default third table, then a data in the default third table in each list item is made For the keyword of each node in the b-tree indexed;
Second data, the third data and the 4th data in the default third table in each list item are as attached Belong to information association in corresponding each node.
13. processing unit according to claim 10, which is characterized in that the inquiry table of the preset rules instruction is described Default first table, then second enquiry module is specifically used for
First Major key of current operation is A, and being configured with the first tabular value corresponding to the data information of A is a,
Each list item in default first table is then searched according to the first Major key A, acquisition with associated each second table of A Value is respectively M1、M2……Mn, n is the positive integer not less than 1;
In conjunction with a and with associated each second tabular value of A, the project of each candidate corresponding with A of acquisition is respectively (M1, a), (M2, a) ... (Mn, a).
14. processing unit according to claim 11, which is characterized in that the inquiry table of the preset rules instruction includes institute Default third table and default 4th table are stated, second enquiry module is specifically used for
First Major key of current operation is A, and being configured with the first tabular value corresponding to the data information of A is a,
It is searched in the default third table according to A, obtaining the list item in the default third table where A is (A, N1、Nn、 a);
According to N1And NnIt is extended, the corresponding position number sequence of the A of acquisition is [N1、N2……Nn];
According to position number each in the corresponding position number sequence of A inquiry default 4th table, acquisition is associated with A Each second tabular value be respectively M1、M2、……Mn
In conjunction with a and with associated each second tabular value of A, obtaining the corresponding each candidate items of A is respectively (M1, a), (M2, a)……(Mn, a);
Wherein A corresponding position number in default second table is respectively N1、N2……Nn, n is the positive integer not less than 1, And be ranked up when according to each list item of the sequence from small to large to default first table, then in default second table N1<N2……<Nn
It is ranked up when according to each list item of the sequence from big to small to default first table, then in default second table Middle N1>N2……>Nn
15. processing unit according to claim 12, which is characterized in that the inquiry table of the preset rules instruction includes institute B-tree indexed and default 4th table are stated, the first Major key that second enquiry module is specifically used for current operation is A, and Being configured with the first tabular value corresponding to the data information of A is a,
It is searched in the b-tree indexed using A as the keyword, obtaining the corresponding satellite information of A is (N1、Nn,a);
According to N1And NnIt is extended, the corresponding position number sequence of the A of acquisition is [N1、N2……Nn];
According to position number each in the corresponding position number sequence of A inquiry default 4th table, acquisition is associated with A Each second tabular value be respectively M1、M2... ... Mn
In conjunction with a and with associated each second tabular value of A, each candidate items corresponding with A of acquisition are respectively (M1, a), (M2, a)……(Mn, a);
Wherein A corresponding position number in default second table is respectively N1、N2……Nn, n is the positive integer not less than 1, And be ranked up when according to each list item of the sequence from small to large to default first table, then in default second table N1<N2……<Nn
It is ranked up when according to each list item of the sequence from big to small to default first table, then in default second table Middle N1>N2……>Nn
16. according to the described in any item processing units of claim 9~15, which is characterized in that second enquiry module carries out After the search operation, a candidate project is only obtained, it is determined that the project of the candidate is final project.
CN201480000224.0A 2014-03-31 2014-03-31 Inquire the treating method and apparatus of data Active CN105745642B (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2014074424 2014-03-31

Publications (2)

Publication Number Publication Date
CN105745642A CN105745642A (en) 2016-07-06
CN105745642B true CN105745642B (en) 2019-08-16

Family

ID=56240997

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201480000224.0A Active CN105745642B (en) 2014-03-31 2014-03-31 Inquire the treating method and apparatus of data

Country Status (1)

Country Link
CN (1) CN105745642B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107341238B (en) * 2017-07-04 2020-12-22 北京京东尚科信息技术有限公司 Data processing method and system
CN107330094B (en) * 2017-07-05 2020-06-16 湖南大学 Bloom filter tree structure for dynamically storing key value pairs and key value pair storage method
CN110019212B (en) * 2017-11-29 2021-06-18 杭州海康威视数字技术股份有限公司 Data processing method and device and database server
CN110019985B (en) * 2017-12-29 2021-09-24 阿里巴巴(中国)有限公司 Index file establishing and inquiring methods and devices
CN108280226B (en) * 2018-02-12 2022-04-12 中国银行股份有限公司 Data processing method and related equipment
CN109739855B (en) * 2018-12-28 2022-03-01 第四范式(北京)技术有限公司 Method and system for realizing data sheet splicing and automatically training machine learning model

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101840430A (en) * 2010-04-28 2010-09-22 北京握奇数据系统有限公司 Intelligent card database multi-list operation method and device
CN102945242A (en) * 2006-11-01 2013-02-27 起元技术有限责任公司 Managing storage method, system, and computer system
CN103164514A (en) * 2013-02-25 2013-06-19 用友软件股份有限公司 Detection device and detection method for data reference relationship
CN103577590A (en) * 2013-11-12 2014-02-12 北京润乾信息系统技术有限公司 Data query method and system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7885932B2 (en) * 2006-11-01 2011-02-08 Ab Initio Technology Llc Managing storage of individually accessible data units

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102945242A (en) * 2006-11-01 2013-02-27 起元技术有限责任公司 Managing storage method, system, and computer system
CN101840430A (en) * 2010-04-28 2010-09-22 北京握奇数据系统有限公司 Intelligent card database multi-list operation method and device
CN103164514A (en) * 2013-02-25 2013-06-19 用友软件股份有限公司 Detection device and detection method for data reference relationship
CN103577590A (en) * 2013-11-12 2014-02-12 北京润乾信息系统技术有限公司 Data query method and system

Also Published As

Publication number Publication date
CN105745642A (en) 2016-07-06

Similar Documents

Publication Publication Date Title
CN105745642B (en) Inquire the treating method and apparatus of data
CN106326429A (en) Hbase second-level query scheme based on solr
US20120078940A1 (en) Analysis of object structures such as benefits and provider contracts
CN104182392B (en) The method and apparatus of service recommendation processing
CN107016019B (en) Database index creation method and device
CN104462429B (en) The generation method and device of query sentence of database
CN108681603B (en) Method for rapidly searching tree structure data in database and storage medium
CN107291964B (en) A method of fuzzy query is realized based on HBase
CN104794130B (en) Relation query method and device between a kind of table
US9870394B2 (en) Query routing method, query routing server performing the same and storage medium storing the same
CN106227788A (en) Database query method based on Lucene
CN106095863A (en) A kind of multidimensional data query and storage system and method
CN108228657B (en) Method and device for realizing keyword retrieval
CN110019308A (en) Data query method, apparatus, equipment and storage medium
CN105893427A (en) Resource searching method and server
CN103440249A (en) System and method for rapidly searching unstructured data
CN102957617A (en) Method and device for superimposing multiple services
US20170220650A1 (en) Patent searching method in connection to matching degree
CN104408189B (en) The methods of exhibiting and device of keyword ranking
CN105447135B (en) Data search method and device
CN110532282A (en) Data query method and device
CN104463460B (en) Processing method and processing device for the waiting information that network data is launched
WO2019048879A1 (en) System for detecting data relationships based on sample data
CN108197310A (en) Industrial part management method and device based on big data
CN105740365B (en) A kind of data warehouse method for quickly querying and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant