Embodiment
Owing to carrying out paging query in prior art under minute scene of storehouse submeter, client need to be obtained from each minute all data interior between condition portion storehouse, and between the condition portion of storing in storehouse for each minute in all data a large amount of often, therefore client is obtained these a large amount of data and will inevitably be produced a large amount of network service, causes the increase of network pressure.The core concept of the embodiment of the present application is: can meet under the condition that its data that will inquire about are provided to user, reduce the quantity of the data of obtaining storehouse from each minute as far as possible, thereby reach, reduce the object obtain the network service that data produce, to alleviate the pressure of network.
Below in conjunction with Figure of description, the embodiment of the present application is described in detail.
The process of the data query that Fig. 1 provides for the embodiment of the present application, comprises the following steps:
S101: client, according to the quantity of the data that comprise in the inquiry page number of input and default every page, is determined the quantity N of the data that will obtain storehouse from each minute.
In the embodiment of the present application, when the method for employing paging query is inquired about the data of certain one page, [S between the condition portion that user still needs will inquire about to client input, E], ordering rule, inquiry page number p, wherein, S is the interval starting point between this condition portion of input, and E is the interval end point between this condition portion of input.Between this condition portion of input, [S, E], ordering rule, inquiry page number p represent: the data that inquire about are the p page data after sorting according to this ordering rule in [S, E] between condition portion.
The quantity of the data that comprise due to every one page is fixed, and the quantity of the data that comprise in therefore can presetting every page in client, for example, be set to n, represents that every page comprises n bar data.Client, first according to the quantity n of the data that comprise in the inquiry page number p of user's input and default every page, is determined the quantity N of the data that will obtain storehouse from each minute.Wherein, can by the inquiry page number p of user input with default every page in the product p * n of quantity n of the data that comprise, be defined as the quantity N of the data that will obtain storehouse from each minute, be also that N is p * n.
S102: according between the condition portion of input and ordering rule, within each minute, obtaining between this condition portion storehouse according to the front N bar data after this ordering rule sequence.
Having determined will be after the quantity N of the data obtained storehouse for each minute, and client was obtained storehouse from each minute between this condition portion in [S, E] according to the front N bar data after this ordering rule sequence.Concrete, client can be by [S between this condition portion, E], ordering rule, and the quantity N determining sends to each minute storehouse, in order to notify each minute storehouse [S between this condition portion to self storage respectively, E] in all data according to the sequence of this ordering rule, and the front N bar data after sequence are returned to client.Client receives respectively the N bar data that each minute storehouse returned.
S103: according to this ordering rule, the data that get are sorted, and provide corresponding data according to this inquiry page number.
Client got storehouse after N bar data from each minute, gathered all data that get, and the ordering rule according to user's input, sorts to all data that get, and according to the inquiry page number of user's input, to user, provided corresponding data.
In said process, client only need be obtained from each minute N bar data storehouse, and without obtaining [S between condition portion, E] interior all data, therefore reduce the quantity of the data of obtaining, thereby reduced the network service producing while obtaining data, effectively alleviated the pressure of network.
The concrete application scenarios of take is below example, and the data query method of dividing three kinds of situations to provide the embodiment of the present application is elaborated.
For example, suppose to have two minutes storehouses: A storehouse and B storehouse.Data for storing, if the serial number of these data is odd numbers, are stored in A storehouse, if the serial number of these data is even numbers, are stored in B storehouse.In current A storehouse, store the most in a couple of days in data serial number according to time order and function order respectively: 1,3,5,7 ..., 99.In current B storehouse, store the most in a couple of days in data serial number according to time order and function order respectively: 2,4,6,8 ..., 100.Also, the data in the most in a couple of days have 100, A library storage wherein serial number be odd number 50, B library storage wherein serial number be even number 50.
Under above-mentioned application scenarios, if the data that user will inquire about are that in the data (being also these 100 data) in the most in a couple of days, a certain page data after sorting according to time order and function order, is divided into following three kinds of situations.
Situation one, user have inputted [S between condition portion, E], after ordering rule, the inquiry page number, if client is determined [S between this condition portion based on input, E] and ordering rule do not inquire about any data, in above-mentioned steps S101, client by the inquiry page number p of input with default every page in the product p * n of quantity n of the data that comprise, be defined as the quantity N of the data that will obtain storehouse from each minute.
Then, client is carried out above-mentioned steps S102 again, that is, client is according between the condition portion of input and ordering rule, within each minute, obtaining storehouse between this condition portion in [S, E] according to the front N bar data after this ordering rule sequence.
Finally, client executing above-mentioned steps S103, that is, client, according to this ordering rule, sorts to the data that get, and according to the inquiry page number p of user's input, provides corresponding data.Wherein, client provides the method for corresponding data to be specially according to the inquiry page number p of user input: according to the quantity n of the data that comprise in inquiry page number p and default every page, determine interval [(p-1) n+1 of sequence number that inquiry page number p is corresponding, pn], and in the data after sequence, the data of sequence number in sequence number interval [(p-1) n+1, pn] corresponding to inquiry page number p are provided.
Continuation be take above-mentioned application scenarios and is described as example, supposes that data that user will inquire about are in the data in the most in a couple of days, according to the time order and function order data of the 2nd page afterwards that sorts:
Between the condition portion that user's input will be inquired about [S, E], between this condition portion, [S, E] is time interval the most in a couple of days.Suppose to be September 1 and September 2 the most in a couple of days, S is the interval starting point between this condition portion, is also 0 point on September 1, and E is the interval end point between this condition portion, is also 24 points (0 point on September 3 in other words) on September 2;
User's input sequencing rule is in chronological sequence sequentially;
The user input query page number is 2, is also p=2.
The quantity of the data that comprise in default every page is 10, also be n=10, that is every page comprise 10 data, if client is determined now not yet [S between the condition portion based on this user's input, E] and ordering rule (in chronological sequence order) inquired about any data, also be, determine that this inquiry is [S between this condition portion based on user's input, E] and the inquiry for the first time carried out of ordering rule (in chronological sequence order), by the inquiry page number of user input 2 with default every page in the product 20 of quantity 10 of the data that comprise, be defined as the quantity N of the data that will obtain storehouse from each minute, also be that N is 20.
Client is obtained in [S, E] between condition portion according to front 20 data after the sequence of time order and function order in A storehouse, obtains between condition portion in [S, E] according to front 20 data after the sequence of time order and function order in B storehouse.
Wherein, due in A storehouse, store the most in a couple of days in data serial number according to time order and function order be respectively 1,3,5,7 ..., 99, also be, [the S between condition portion storing in A storehouse, E] in data serial number according to time order and function order be respectively 1,3,5,7 ..., 99, therefore, between the condition portion that client is obtained from A storehouse in [S, E] according to the serial number of front 20 data after the sequence of time order and function order according to time order and function order respectively: 1,3,5,7 ..., 39.Similarly, between the condition portion that client is obtained from B storehouse in [S, E] according to the serial number of front 20 data after the sequence of time order and function order according to time order and function order respectively: 2,4,6,8 ... 40.Visible, client has been obtained altogether serial number and has been respectively 40 data of 1 ~ 40.
Client has all been obtained after 20 data from A storehouse and B storehouse,, according to the ordering rule of user's input, also according to time order and function order, all data that get is sorted.
1,2,3,4 suppose that serial number that client gets is respectively 40 data of 1 ~ 40 and is respectively according to time order and function order: ... 40, client, according to the quantity 10 of the data that comprise in the inquiry page number 2 of user input and default every page, is determined the sequence number interval of these inquiry page number 2 correspondences
1,2,3,4 the serial number getting due to client is respectively 40 data of 1 ~ 40 and is respectively according to time order and function order: ... 40, therefore, after these 40 data are sorted according to time order and function order, the data of sequence number in the sequence number interval [11,20] of these inquiry page number 2 correspondences are: serial number is respectively 11,12,13 ... 20 data.Thereby, client to user provide serial number be respectively 11,12,13 ... 20 data, as this user, to inquire about the most in a couple of days in, according to the 2nd page data after time order and function order sequence.
As can be seen here, in situation one, also when client is determined between the condition portion based on user's input and when ordering rule did not inquire about any data, only need to from A storehouse and B storehouse, obtain totally 40 data (obtaining respectively 20 data from A storehouse and B storehouse), can provide that it will inquire about to user the most in a couple of days in, the 2nd page data after sorting according to time order and function order.In prior art, need to from A storehouse and B storehouse, obtain altogether [S between condition portion, E] 100 interior data, the method of the data query that the embodiment of the present application provides has reduced the quantity of the data that client obtained storehouse from each minute, therefore reduce the network service producing when client is obtained data, effectively alleviated network pressure.
Further, in order further to alleviate network pressure in the process in subsequent query data, client [S between the condition portion based on user's input in the embodiment of the present application, E], ordering rule, inquiry page number p, after user provides corresponding data, also will be for the page number p-i that is not more than this inquiry page number p, determine interval [(p-i-1) n+1 of sequence number that page number p-i is corresponding, (p-i) n], wherein, i is 0 to p-1 positive integer; According to the data after sequence and sequence number interval [(p-i-1) n+1, (p-i) n] corresponding to page number p-i, adopt designation method to determine condition sub-range the record that page number p-i is corresponding; Wherein, this designation method comprises: in the data after sequence, the condition of the data that are (p-i-1) n+1 by sequence number is defined as the interval starting point in the condition sub-range that page number p-i is corresponding, and the condition of the data that are (p-i) n by sequence number is defined as the interval end point in the condition sub-range that page number p-i is corresponding.
Continue along using example, client to user, provide that this user will inquire about the most in a couple of days in, according to after the 2nd page data after the sequence of time order and function order, determine that the page number that is not more than this inquiry page number p=2 comprises the page number
therefore, determine interval [(p-i-1) n+1, (p-i) n]=[1,10] of sequence number of this page number 1 correspondence.
The serial number getting due to client is respectively 40 data of 1 ~ 40 and is respectively according to time order and function order: 1, 2, 3, 4, 40, therefore, after these 40 data are sorted according to time order and function order, sequence number is 1 data for the data of (p-i-1) n+1=1 are serial number, sequence number is 10 data for the data of (p-i) n=10 are serial number, suppose that this serial number is that time corresponding to data of 1 is R1S, serial number is that time corresponding to data of 10 is R1E, the condition sub-range of this page number 1 correspondence is [R1S, R1E], condition sub-range [the R1S of this page number 1 correspondence, R1E] represent: by [S between condition portion, E] in all data of (the most in a couple of days in) according to the sequence of time order and function order after, condition sub-range [R1S, R1E] in data be exactly the 1st page data.
Similarly, suppose that serial number is that time corresponding to data of 11 is R2S, time corresponding to data that serial number is 20 is R2E, and the condition sub-range of inquiring about the page number 2 correspondences is [R2S, R2E].
Recorded behind the condition sub-range that each page number that is not more than this inquiry page number is corresponding, the data that if follow-up this user continues to adopt between identical condition portion and ordering rule is inquired about other page numbers, can inquire about according to the condition sub-range corresponding to each page number of record situation about stating two specific as follows and situation three.
Situation two, user have inputted [S between condition portion, E], after ordering rule, inquiry page number p, if client is determined [S between this condition portion based on input, E] and ordering rule inquired about the data that the page number is less than this inquiry page number,, in above-mentioned steps S101, client determines that the method for the quantity N of the data that will obtain storehouse from each minute is: in each page number p-i inquiring about and be less than inquiry page number p, determine maximum page number max (p-i), wherein, i is 0 to p-1 positive integer; Determine the inquiry page number p of input and the difference p-max (p-i) of maximum page number max (p-i), by definite difference p-max (p-i) with default every page in product (p-max (p-i)) * n of quantity n of the data that comprise, be defined as the quantity N of the data that will obtain storehouse from each minute.
Then, client is when carrying out above-mentioned steps S102, according to [S between the condition portion of input, E] and ordering rule, from each minute, storehouse, obtain [S between condition portion, E] according to the method for the front N bar data after the sequence of this ordering rule, be specially: the condition sub-range corresponding to this maximum page number max (p-i) of recording while determining the data based on [S, E] and this ordering rule are inquired about this maximum page number max (p-i) between this condition portion; According to the condition sub-range of this maximum page number max (p-i) correspondence, the interval starting point of [S, E] between the condition portion of input is adjusted into the interval end point in the condition sub-range that this maximum page number max (p-i) is corresponding; Front N bar data after sorting according to this ordering rule in between the condition portion obtaining storehouse after adjustment for each minute.
Finally, client executing above-mentioned steps S103, that is, client, according to this ordering rule, sorts to the data that get, and according to the inquiry page number p of user's input, provides corresponding data.Wherein, client provides the method for corresponding data to be specially according to the inquiry page number p of user input: the quantity n of the data that comprise according to inquiry page number p, maximum page number max (p-i), in default every page, determine interval [(p-max (p-i)-1) n+1 of sequence number that this inquiry page number p is corresponding, (p-max (p-i)) n], and in the data after sequence, the data of sequence number in sequence number interval [(p-max (p-i)-1) n+1, (p-max (p-i)) n] corresponding to this inquiry page number p are provided.
Continuation be take above-mentioned application scenarios and is described as example, suppose in the data of user in having inquired about the most in a couple of days, the data of the 2nd page after sorting according to time order and function order, to continue now in the data in inquiry the most in a couple of days, the data of the 5th page after sorting according to time order and function order:
Between the condition portion that user's input will be inquired about, be still [S, E], between this condition portion, [S, E] is time interval the most in a couple of days;
User's input sequencing rule is still in chronological sequence order;
The user input query page number is 5, is also p=5.
Now, between the definite condition portion based on this user's input of client, [S, E] and ordering rule (in chronological sequence order) were inquired about the data that the page number is less than the current inquiry page number 5, and the page number that is less than the current inquiry page number 5 of inquiring about is the page number 2.Therefore, client is in each page number of inquiring about and be less than the current inquiry page number 5, and the maximum page number of determining is the page number 2, is also max (p-i)=2.The inquiry page number 5 of current input is p-max (p-i)=3 with the difference of the maximum page number 2.This difference 3 with default every page in the product of quantity 10 of the data that comprise be (p-max (p-i)) * n=30.The quantity N of the data that will obtain storehouse from each minute that therefore, client is determined is 30.
Due in above-mentioned situation one, client had been inquired about the data of the page number 2, therefore now client has recorded the condition sub-range [R2S of these page number 2 correspondences, R2E], thereby client is adjusted into the interval starting point S of [S, E] between the condition portion of input the interval end point R2E in the condition sub-range of these page number 2 correspondences, between the condition portion after adjustment, be (R2E, E].After having adjusted between condition portion, client is obtained (R2E between the condition portion after adjustment from A storehouse, E] according to front 30 data after time order and function order sequence, from B storehouse, obtain between condition portion (R2E, E] according to front 30 data after the sequence of time order and function order.
Wherein, due in A storehouse, by [S between condition portion, E] (serial number is respectively 1 to interior all data, 3, 5, 7 ... 99 data) according to after the sequence of time order and function order, condition sub-range [the R1S of the page number 1 correspondence, R1E] in data be that serial number is respectively 1, 3, 5, 7, 9 data, condition sub-range [the R2S of the page number 2 correspondences, R2E] in data be that serial number is respectively 11, 13, 15, 17, 19 data, therefore, (R2E between the condition portion after the adjustment that client is obtained from A storehouse, E] according to front 30 data after time order and function order sequence, be: serial number is respectively 21, 23, 25, 27, 79 data.Similarly, between the condition portion after the adjustment that client is obtained from B storehouse (R2E, E] according to front 30 data after the sequence of time order and function order, be: serial number is respectively 22,24,26,28 ... 80 data.Visible, client has been obtained altogether serial number and has been respectively 60 data of 21 ~ 80.
Client has all been obtained after 30 data from A storehouse and B storehouse,, according to the ordering rule of user's input, also according to time order and function order, all data that get is sorted.
21,22,23,24 suppose that serial number that client gets is respectively 60 data of 21 ~ 80 and is respectively according to time order and function order: ... 80, the quantity 10 of the data that client comprises according to the current inquiry page number 5, the maximum page number 2, in default every page, determine interval [(p-max (p-i)-1) n+1 of sequence number of current these inquiry page number 5 correspondences, (p-max (p-i)) n]=[21,30].
21,22,23,24 owing to the serial number obtaining being respectively to 60 data of 21 ~ 80, according to time order and function order, be respectively: ..., 80, therefore, after these 60 data are sorted according to time order and function order, the data of sequence number in the sequence number interval [21,30] of current these inquiry page number 5 correspondences are: serial number is respectively 41,42,43 ..., 50 data.Thereby, client to user provide serial number be respectively 41,42,43 ..., 50 data.
As can be seen here, in situation two, user was in the situation that inquiring about the 2nd page data, between the condition portion of continuation based on identical and when identical ordering rule inquires about the 5th page data, if the method according to situation one is inquired about, client need to all be obtained 50 data in A storehouse and B storehouse, also obtain altogether 100 data, if and inquired about according to the method for situation two, client can be according to the condition sub-range of the page number 2 correspondences that record when inquiring about the 2nd page data, dwindle the scope between the condition portion that will inquire about, and the quantity of the data that further minimizing is obtained from A storehouse and B storehouse, only need to from A storehouse and B storehouse, obtain respectively 30, obtain altogether 60 data, can provide that it will inquire about to user the most in a couple of days in, according to the 5th page data after the sequence of time order and function order, thereby further reduced the network service producing while obtaining data, further alleviated the pressure of network.
Certainly, in above-mentioned situation two, client provides after the 5th page data to user, also to determine respectively corresponding condition sub-range the record of each page number that is not more than the current inquiry page number 5, also determine respectively condition sub-range the record of the page number 1 ~ 5 correspondence, and the condition sub-range that in fact page number 1 and the page number 2 correspondences have been determined and recorded to client, therefore to user, provide after the 5th page data, as long as the condition sub-range of determining and recording the page number 3 ~ 5 correspondences, just repeats here no longer one by one.
Situation three, user have inputted [S between condition portion, E], after ordering rule, inquiry page number p, if client is determined [S between this condition portion based on input, E] and ordering rule inquired about the data that the page number is greater than this inquiry page number, in above-mentioned steps S101, client is determined: by the quantity n of the data that comprise in default every page, be defined as the quantity N of the data that will obtain storehouse from each minute.
Then, client is when carrying out above-mentioned steps S102, according to [S between the condition portion of input, E] and ordering rule, from each minute, storehouse, obtain [S between condition portion, E] according to the method for the front N bar data after the sequence of this ordering rule, be specially: determine condition sub-range corresponding to this inquiry page number that the data that the page number are greater than to this inquiry page number based on [S, E] and this ordering rule between this condition portion record while inquiring about; [S, E] between this condition portion of input is adjusted into the condition sub-range that this inquiry page number is corresponding; Front N bar data after sorting according to this ordering rule in between the condition portion obtaining storehouse after adjustment for each minute.
Finally, client executing above-mentioned steps S103, that is, client, according to this ordering rule, sorts to the data that get, and according to the inquiry page number p of user's input, provides corresponding data.Wherein, client provides the method for corresponding data to be specially according to this inquiry page number p of user's input: in the data after sequence, provide front n bar data.
Continuation be take above-mentioned application scenarios and is described as example, suppose in the data of user in having inquired about the most in a couple of days, the data of the 2nd page after sorting according to time order and function order, to continue now in the data in inquiry the most in a couple of days, the data of the 1st page after sorting according to time order and function order:
Between the condition portion that user's input will be inquired about, be still [S, E], between this condition portion, [S, E] is time interval the most in a couple of days;
User's input sequencing rule is still in chronological sequence order;
The user input query page number is 1, is also p=1.
Now, between the definite condition portion based on this user's input of client, [S, E] and ordering rule (in chronological sequence order) were inquired about the data that the page number is greater than the current inquiry page number 1, and the page number that is greater than the current inquiry page number 1 of inquiring about is the page number 2.Therefore, client is directly by the quantity 10 of the data that comprise in default every page, is defined as the quantity N of the data that will obtain storehouse from each minute, is also that N is 10.
Due in above-mentioned situation one, client had been inquired about the data of the page number 2, therefore now client has recorded the current inquiry page number of page number 1() corresponding condition sub-range [R1S, R1E], thereby client is directly adjusted into by [S, E] between the condition portion of input the condition sub-range that this current inquiry page number is corresponding, between the condition portion after adjustment, be the condition sub-range [R1S, R1E] of the page number 1 correspondence.
After having adjusted between condition portion, client is obtained [R1S between the condition portion after adjustment from A storehouse, R1E] according to front 10 data after the sequence of this ordering rule, from B storehouse, obtain between the condition portion after adjustment in [R1S, R1E] according to front 10 data after this ordering rule sequence.
Wherein, due in A storehouse, by [S between condition portion, E] (serial number is respectively 1,3,5,7 to interior all data ... 99 data) according to after the sequence of time order and function order, data in the condition sub-range of the page number 1 correspondence [R1S, R1E] are that serial number is respectively 1,3,5,7,9 data, therefore, between the condition portion after the adjustment that client is obtained from A storehouse, in [R1S, R1E], according to front 10 data after this ordering rule sequence, be: serial number is respectively 1,3,5,7,9 data.Similarly, between the condition portion after the adjustment that client is obtained from B storehouse, in [R1S, R1E], according to front 10 data after this ordering rule sequence, be: serial number is respectively 2,4,6,8,10 data.
It should be noted that, in fact between the condition portion of client after the adjustment getting storehouse for minute, the data in [R1S, R1E] are impossible surpass 10, as above in example, client has in fact only got 5 data from A storehouse, has also only got 5 data from B storehouse.Visible, client has been obtained altogether serial number and has been respectively 10 data of 1 ~ 10.
Client has all been obtained after 5 data from A storehouse and B storehouse,, according to the ordering rule of user's input, also according to time order and function order, all data that get is sorted.
1,2,3,4 suppose that serial number that client gets is respectively 10 data of 1 ~ 10 and is respectively according to time order and function order: ... 10, client directly provides front 10 data after sequence, and the data that also provide are exactly that serial number is respectively 10 data of 1 ~ 10.
As can be seen here, in situation three, user was in the situation that inquiring about the 2nd page data, between the condition portion of continuation based on identical and when identical ordering rule inquires about the 1st page data, if the method according to situation one is inquired about, client need to all be obtained 10 data in A storehouse and B storehouse, also obtain altogether 20 data, if and inquired about according to the method for situation three, client can be according to the condition sub-range of the page number 1 correspondence recording when inquiring about the 2nd page data, directly the scope between the condition portion of user's input is narrowed down to the scope in the condition sub-range of the page number 1 correspondence, and the quantity of the data that further minimizing is obtained from A storehouse and B storehouse, client reality has been obtained altogether 10 data from A storehouse and B storehouse, can provide that it will inquire about to user the most in a couple of days in, according to the 1st page data after the sequence of time order and function order, thereby further reduced the network service producing while obtaining data, further alleviated the pressure of network.
More than the detailed description that the method for minutes three kinds situations data query that the embodiment of the present application is provided is carried out, the thinking based on same, the embodiment of the present application also provides a kind of device of data query, as shown in Figure 2.
The apparatus structure schematic diagram of the data query that Fig. 2 provides for the embodiment of the present application, specifically comprises:
Determination module 201, for according to the quantity of the inquiry page number of input and default every page of data that comprise, determines the quantity N of the data that will obtain storehouse from each minute;
Acquisition module 202, for according between the condition portion of input and ordering rule, within each minute, obtaining between described condition portion storehouse according to the front N bar data after described ordering rule sequence;
Module 203 is provided, for according to described ordering rule, the data that get is sorted, and provide corresponding data according to the described inquiry page number.
Described determination module 201 specifically for, when between the condition portion of determining based on input and when ordering rule did not inquire about any data, by the described inquiry page number p of input with default every page in the product p * n of quantity n of the data that comprise, be defined as the quantity N of the data that will obtain storehouse from each minute;
Described provide module 203 specifically for, according to the quantity n of the data that comprise in described inquiry page number p and default every page, determine interval [(p-1) n+1 of sequence number that described inquiry page number p is corresponding, pn], and in the data after sequence, the data of sequence number in sequence number interval [(p-1) n+1, pn] corresponding to described inquiry page number p are provided.
Described device also comprises:
Logging modle 204, for the page number p-i for being not more than described inquiry page number p, determines the sequence number interval [(p-i-1) n+1, (p-i) n] that page number p-i is corresponding, and wherein, i is 0 to p-1 positive integer; According to the data after sequence and sequence number interval [(p-i-1) n+1, (p-i) n] corresponding to page number p-i, adopt designation method to determine condition sub-range the record that page number p-i is corresponding; Wherein, described designation method comprises: in the data after sequence, the condition of the data that are (p-i-1) n+1 by sequence number is defined as the interval starting point in the condition sub-range that page number p-i is corresponding, and the condition of the data that are (p-i) n by sequence number is defined as the interval end point in the condition sub-range that page number p-i is corresponding.
Described determination module 201 specifically for, when between the condition portion of determining based on input and when ordering rule inquired about the page number and is less than the data of the described inquiry page number, in each page number p-i inquiring about and be less than described inquiry page number p, determine maximum page number max (p-i), wherein, i is 0 to p-1 positive integer; Determine the described inquiry page number p of input and the difference p-max (p-i) of described maximum page number max (p-i), by the described difference p-max (p-i) determining with default every page in product (p-max (p-i)) * n of quantity n of the data that comprise, be defined as the quantity N of the data that will obtain storehouse from each minute;
Described acquisition module 202 specifically for, determine the condition sub-range corresponding to described maximum page number max (p-i) of recording based between described condition portion and during the data of the described ordering rule described maximum page number max of inquiry (p-i); According to the condition sub-range of described maximum page number max (p-i) correspondence, the interval starting point between the described condition portion of input is adjusted into the interval end point in the condition sub-range that described maximum page number max (p-i) is corresponding; Front N bar data after sorting according to described ordering rule in between the condition portion obtaining storehouse after adjustment for each minute;
Described provide module 203 specifically for, the quantity n of the data that comprise according to described inquiry page number p, described maximum page number max (p-i), in default every page, determine interval [(p-max (p-i)-1) n+1 of sequence number that described inquiry page number p is corresponding, (p-max (p-i)) n], and in the data after sequence, the data of sequence number in sequence number interval [(p-max (p-i)-1) n+1, (p-max (p-i)) n] corresponding to described inquiry page number p are provided.
Described determination module 201 specifically for, when between the condition portion of determining based on input and when ordering rule inquired about the page number and is greater than the data of the described inquiry page number, by the quantity n of the data that comprise in default every page, be defined as the quantity N of the data that will obtain storehouse from each minute;
Described acquisition module 202 specifically for, determine based between described condition portion and the condition sub-range corresponding to the described inquiry page number of recording when described ordering rule data that the page number is greater than to the described inquiry page number are inquired about; To between the described condition portion of input, be adjusted into the condition sub-range that the described inquiry page number is corresponding; Front N bar data after sorting according to described ordering rule in between the condition portion obtaining storehouse after adjustment for each minute;
Described provide module 203 specifically for, in the data after sequence, provide front n bar data.
The device of concrete above-mentioned data query can be arranged in client.
The embodiment of the present application provides a kind of method and device of data query, the method client is according to the quantity of the data that comprise in the inquiry page number of input and every page, determine the quantity N of the data that will obtain storehouse from each minute, again according to input condition portion between and ordering rule, front N bar data after sorting according to this ordering rule in obtaining between this condition portion storehouse from each minute, last according to this ordering rule to the data sorting getting, and provide corresponding data according to the inquiry page number.Pass through said method, when client is carried out paging query under minute scene of storehouse submeter, without all data obtained between condition portion storehouse from each minute in, and a part of data in only need obtaining storehouse from each minute between condition portion, thereby can reduce the network service producing when client is obtained data, effectively alleviate the pressure of network.
Those skilled in the art should understand, the application's embodiment can be provided as method, system or computer program.Therefore, the application can adopt complete hardware implementation example, implement software example or in conjunction with the form of the embodiment of software and hardware aspect completely.And the application can adopt the form that wherein includes the upper computer program of implementing of computer-usable storage medium (including but not limited to magnetic disk memory, CD-ROM, optical memory etc.) of computer usable program code one or more.
The application is with reference to describing according to process flow diagram and/or the block scheme of the method for the embodiment of the present application, equipment (system) and computer program.Should understand can be in computer program instructions realization flow figure and/or block scheme each flow process and/or the flow process in square frame and process flow diagram and/or block scheme and/or the combination of square frame.Can provide these computer program instructions to the processor of multi-purpose computer, special purpose computer, Embedded Processor or other programmable data processing device to produce a machine, the instruction of carrying out by the processor of computing machine or other programmable data processing device is produced for realizing the device in the function of flow process of process flow diagram or a plurality of flow process and/or square frame of block scheme or a plurality of square frame appointments.
These computer program instructions also can be stored in energy vectoring computer or the computer-readable memory of other programmable data processing device with ad hoc fashion work, the instruction that makes to be stored in this computer-readable memory produces the manufacture that comprises command device, and this command device is realized the function of appointment in flow process of process flow diagram or a plurality of flow process and/or square frame of block scheme or a plurality of square frame.
These computer program instructions also can be loaded in computing machine or other programmable data processing device, make to carry out sequence of operations step to produce computer implemented processing on computing machine or other programmable devices, thereby the instruction of carrying out is provided for realizing the step of the function of appointment in flow process of process flow diagram or a plurality of flow process and/or square frame of block scheme or a plurality of square frame on computing machine or other programmable devices.
Although described the application's preferred embodiment, once those skilled in the art obtain the basic creative concept of cicada, can make other change and modification to these embodiment.So claims are intended to all changes and the modification that are interpreted as comprising preferred embodiment and fall into the application's scope.
Obviously, those skilled in the art can carry out various changes and modification and the spirit and scope that do not depart from the application to the application.Like this, if within these of the application are revised and modification belongs to the scope of the application's claim and equivalent technologies thereof, the application is also intended to comprise these changes and modification interior.