CN106570039A - Database counting method and device - Google Patents

Database counting method and device Download PDF

Info

Publication number
CN106570039A
CN106570039A CN201510659546.2A CN201510659546A CN106570039A CN 106570039 A CN106570039 A CN 106570039A CN 201510659546 A CN201510659546 A CN 201510659546A CN 106570039 A CN106570039 A CN 106570039A
Authority
CN
China
Prior art keywords
counting
total amount
point
data
data total
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.)
Pending
Application number
CN201510659546.2A
Other languages
Chinese (zh)
Inventor
石岱曦
李可欣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Gridsum Technology Co Ltd
Original Assignee
Beijing Gridsum Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Gridsum Technology Co Ltd filed Critical Beijing Gridsum Technology Co Ltd
Priority to CN201510659546.2A priority Critical patent/CN106570039A/en
Publication of CN106570039A publication Critical patent/CN106570039A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2462Approximate or statistical queries

Landscapes

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

Abstract

The application discloses a database counting method and device. The method comprises the following steps: determining a counting starting point and a counting ending point of a target range, and ensuring that the target range is the range in which the data in a database is counted; querying the total amount of data corresponding to the counting starting point and the total amount of data corresponding to the counting ending point, wherein the database records the total amount of data of each counting point in advance, and each counting point includes the counting starting point and the counting ending point; and obtaining the amount of data in the target range according to the total amount of data corresponding to the counting starting point and the total amount of data corresponding to the counting ending point. According to the database counting method and device disclosed by the application, the technical problem of low counting speed of the data in the database can be solved.

Description

Data base's method of counting and device
Technical field
The application is related to database field, in particular to a kind of data base's method of counting and device.
Background technology
In data base, it is often necessary to which certain table is totalized according to certain field, the operation is in converging operationJu Hecaozuo Modal count operations.For example, according to certain time field (from beginTime to endTime), ask at this The a range of data count of field, the Count methods for typically being carried using data base, according to time field Time, obtains the data count in from beginTime to endTime, performs sentence as follows:
use db1
db.col1.count({time:{$gte:beginTime,$lt:endTime}})。
However, existing method of counting needs the query context according to Aggregation field, all numbers in the range of this are found According to, then add up and obtain a result, if selected scope is very big, the data in the range of this are again very more, this The speed of method can be very slow.
For above-mentioned problem, effective solution is not yet proposed at present.
The content of the invention
The embodiment of the present application provides a kind of data base's method of counting and device, at least to solve in terms of data in data base The slow technical problem of number.
According to the one side of the embodiment of the present application, there is provided a kind of data base's method of counting, including:Determine target model The counting starting point enclosed and counting terminating point, the target zone is the scope counted to the data in data base; The inquiry counting corresponding data total amount of starting point and the corresponding data total amount of the counting terminating point, wherein, it is described Data base is prerecorded with the data total amount of each timing point, and described each timing point includes the counting starting point With the counting terminating point;And it is corresponding with the counting terminating point according to the corresponding data total amount of the counting starting point The data total amount data volume that obtains in the target zone.
According to the another aspect of the embodiment of the present application, additionally providing a kind of data base's counting assembly includes:Determining unit, For determining the counting starting point of target zone and counting terminating point, the target zone is that the data in data base are entered The scope that row is counted;Query unit, terminates for inquiring about the counting corresponding data total amount of starting point and the counting The corresponding data total amount of point, wherein, the data base is prerecorded with the data total amount of each timing point, described every One timing point includes the counting starting point and the counting terminating point;And computing unit, by according to based on described The number corresponding data total amount of starting point and the corresponding data total amount of the counting terminating point obtain the number in the target zone According to amount.
According to the embodiment of the present application, determine the counting starting point of target zone and count terminating point, target zone is logarithm According to the scope that the data in storehouse are counted, the corresponding data total amount of query counts starting point and counting terminating point are corresponding Data total amount, wherein, data base is prerecorded with the data total amount of each timing point, and each timing point includes meter Count starting point and count terminating point, it is total with the corresponding data of counting terminating point according to the corresponding data total amount of starting point is counted The data volume in target zone is measured, so, when counting inquiry is carried out, two values need to be only searched and be counted starting point Corresponding data total amount and the corresponding data total amount of counting terminating point, you can the data total amount being calculated in target zone, The all data accumulations in the range of this need not be found to obtain a result, the speed of data base's counting is improve, solved to number in data base According to the technical problem that counting is slow.
Description of the drawings
Accompanying drawing described herein is used for providing further understanding of the present application, constitutes the part of the application, this Shen Schematic description and description please does not constitute the improper restriction to the application for explaining the application.In accompanying drawing In:
Fig. 1 is the flow chart of the data base's method of counting according to the embodiment of the present application;
Fig. 2 is the schematic diagram of the data base's counting assembly according to the embodiment of the present application.
Specific embodiment
In order that those skilled in the art more fully understand application scheme, below in conjunction with the embodiment of the present application Accompanying drawing, is clearly and completely described to the technical scheme in the embodiment of the present application, it is clear that described embodiment The only embodiment of the application part, rather than the embodiment of whole.Based on the embodiment in the application, ability The every other embodiment that domain those of ordinary skill is obtained under the premise of creative work is not made, all should belong to The scope of the application protection.
It should be noted that the description and claims of this application and the term " first " in above-mentioned accompanying drawing, " Two " it is etc. the object for distinguishing similar, without for describing specific order or precedence.It should be appreciated that this The data that sample is used can be exchanged in the appropriate case, so as to embodiments herein described herein can with except Here the order beyond those for illustrating or describing is implemented.Additionally, term " comprising " and " having " and they Any deformation, it is intended that covering is non-exclusive to be included, and for example, contains process, the side of series of steps or unit Method, system, product or equipment are not necessarily limited to those steps clearly listed or unit, but may include unclear List or other steps intrinsic for these processes, method, product or equipment or unit.
According to the embodiment of the present application, there is provided a kind of embodiment of the method for data base's method of counting, it should be noted that Can perform in the such as computer system of one group of computer executable instructions the step of the flow process of accompanying drawing is illustrated, And, although show logical order in flow charts, but in some cases, can be with suitable different from herein Sequence performs shown or described step.
Fig. 1 is the flow chart of the data base's method of counting according to the embodiment of the present application, as shown in figure 1, the method includes Following steps:
Step S102, determines the counting starting point of target zone and counts terminating point, target zone is in data base The scope that data are counted.
Step S104, the corresponding data total amount of query counts starting point and the corresponding data total amount of counting terminating point, wherein, Data base is prerecorded with the data total amount of each timing point, and each timing point includes counting starting point and counts eventually Stop.
Step S106, according to counting the corresponding data total amount of starting point and counting the corresponding data total amount of terminating point mesh is obtained Data volume in the range of mark.
In the embodiment of the present application, data base is carrying out data processing (including but not limited to data storage, renewal, deletion) During, statistical counting is carried out to the data total amount of each timing point, the data for obtaining each timing point are total Amount.Timing point can, using time point as timing point, for example, be counted once every preset time period;Or with number According to other nodes in table as timing point, data statisticss are carried out.So, when the data for needing to inquire about in target zone During total amount, the counting starting point of target zone directly from the timing point of record, can be determined and terminating point is counted, And inquire the corresponding data total amount of counting starting point and count the corresponding data total amount of terminating point, then by the two countings The data total amount of point obtains the data total amount in target zone.
For example, using time point as timing point, when being inquired about, rising for the i.e. target time section of target zone is determined Time beginning and termination time, the data total amount of the two time points records is found out, if the time of termination corresponding data are total Amount is more than the corresponding data total amount of initial time, then the two subtracts each other, that is, obtain the data total amount in target time section.
According to the embodiment of the present application, determine the counting starting point of target zone and count terminating point, target zone is logarithm According to the scope that the data in storehouse are counted, the corresponding data total amount of query counts starting point and counting terminating point are corresponding Data total amount, wherein, data base is prerecorded with the data total amount of each timing point, and each timing point includes meter Count starting point and count terminating point, it is total with the corresponding data of counting terminating point according to the corresponding data total amount of starting point is counted The data volume in target zone is measured, so, when counting inquiry is carried out, two values need to be only searched and be counted starting point Corresponding data total amount and the corresponding data total amount of counting terminating point, you can the data total amount being calculated in target zone, The all data accumulations in the range of this need not be found to obtain a result, the speed of data base's counting is improve, logarithm is solved According to the technical problem that data counts in storehouse are slow.
Preferably, the corresponding data total amount of query counts starting point and the corresponding data total amount of counting terminating point include:From The corresponding data total amount of query counts starting point and the corresponding data total amount of counting terminating point in the count table for pre-building, Wherein, count table is used to record the data total amount of each timing point.
In the present embodiment, the count table for recording the data total amount of each timing point is pre-build in data base, number According to storehouse when data processing (including but not limited to data storage, renewal, deletion) is carried out, in each timing point pair Data total amount in the range of it is counted, and the data total amount of each timing point statistics is recorded in count table. So, when counting inquiry is carried out, only from query counts starting point in the count table and the corresponding number of terminating point need to be counted According to total amount, its query context is little, therefore, the speed of query counts is fast.
Further, each tables of data is provided with a count table in data base.These tables of data can be that Jing is often needed The tables of data for being counted, sets up a corresponding count table, in each timing point pair to each tables of data Tables of data is counted, and is recorded on corresponding count table.
Further, method also includes:Using time point as timing point, in preset time period staqtistical data base The data total amount of tables of data;The data total amount of the current point in time of statistics and statistics be recorded into the corresponding meter of the tables of data On number table.
In the present embodiment, the data total amount of tables of data in preset time period staqtistical data base, can be with minute Granularity, counts data total amount per minute.The data total amount of the current point in time of statistics and statistics associatedly recorded On the corresponding count table of the tables of data.So, during the data total amount inquired about in certain time, from corresponding count table The corresponding data total amount of starting point and ending point of the time period is inquired about, the data total amount in the time period is obtained.
Preferably, target zone is the scope that counted of data of the object table to data base, query counts starting point Corresponding data total amount and the corresponding data total amount of counting terminating point include:The corresponding time point of determines counting starting point and Count the corresponding time point of terminating point;From the corresponding time point note of query counts starting point on the corresponding count table of object table The data total amount of the corresponding time point record of data total amount and counting terminating point of record.
When statistical query is carried out, because the starting point and ending point of the time period to be inquired about is not gate time point, In this case, then need first to determine the time point corresponding to starting point and ending point, then to inquire about corresponding data total Amount.Determine that the time point corresponding to starting point and ending point can round starting point and ending point correspondence, Ke Yishi Round forward or while rounding backward simultaneously so that starting point and ending point can correspond to gate time point.
According to the embodiment of the present application, by determining the time point corresponding to starting point and ending point, it is ensured that data query is united The accuracy of meter, it is to avoid inquiry error.
Preferably, target is obtained according to the corresponding data total amount of counting starting point and the corresponding data total amount of counting terminating point In the range of data volume include:The corresponding data total amount of starting point data total amount corresponding with terminating point is counted will be counted to enter Row compares;In the corresponding data total amount of counting starting point data total amount corresponding more than or equal to counting terminating point, target In the range of data volume be zero;The corresponding data total amount of starting point is being counted less than the corresponding data total amount of counting terminating point When, the corresponding data total amount of counting starting point is deducted by the corresponding data total amount of counting terminating point and is obtained in target zone Data volume.
Because the data in data base can increase, update or delete, therefore, the data volume for counting then may go out Now increase or reduce.In the embodiment of the present application, terminate inquiring to count the corresponding data total amount of starting point and count After the corresponding data total amount of point, first compare magnitude relationship therebetween, if it is total to count the corresponding data of starting point Amount is less than and counts the corresponding data total amount of terminating point, then during showing from counting starting point to counting terminating point, number It is to increase according to the data in storehouse or constant, so the data total amount in target zone is the difference between the two;, whereas if The corresponding data total amount of starting point is counted more than or equal to the corresponding data total amount of terminating point is counted, is then shown, shown from meter To during counting terminating point, the data of data base are reductions to number starting points, so the data in target zone are total Amount is zero.
Below, so that timing point is as time point as an example, to the embodiment of the present application in a kind of optional embodiment be described. Wherein, for data base db1, table col1 therein, it is often necessary to according to time fields is calculated a range of Data count, method is specifically included:
(1) after table col1 is set up, a new count table col1_count is set up;
(2) timing cycle is set, such as with minute as minimum interval;
(3) every one minute, the data count total of col1 tables is calculated using db.col1.count () method, The method can obtain the total data volume of col1 tables, and speed is very fast;
(4) current time now and total are recorded in table col1_count;
(5) so, when need calculate from beginTime to endTime in data volume when, by beginTime with EndTime is rounded in the granularity of minute, and using following methods result count is obtained:
use col1_count
Total1=db.col1_count.findOne ({ time:beginTime})
Total2=db.col1_count.findOne ({ time:endTime})
Count=total2-total1
The method of counting of this enforcement can apply to the data base of such as MongoDB, wherein, every table of data store internal There is an enumerator, understand the current data total amount of real time record, therefore, the total amount of data for obtaining col1 tables is very Fast;And in table col1_count, index if set up in time fields, according to beginTime and endTime Only need to find 2 values, speed is very fast.
The embodiment of the present application additionally provides a kind of data base's counting assembly, and the device can be used for performing the application enforcement Data base's method of counting of example.As shown in Fig. 2 the device includes:Determining unit 10, query unit 20 and calculating Unit 30.
Determining unit 10 is used to determine the counting starting point of target zone and counts terminating point, and target zone is to data base The scope that interior data are counted.
Query unit 20 is used for the corresponding data total amount of query counts starting point and counts the corresponding data total amount of terminating point, Wherein, data base is prerecorded with the data total amount of each timing point, each timing point include counting starting point and Count terminating point.
Computing unit 30 is used for according to the corresponding data total amount of counting starting point and counts the corresponding data total amount of terminating point Obtain the data volume in target zone.
In the embodiment of the present application, data base is carrying out data processing (including but not limited to data storage, renewal, deletion) During, statistical counting is carried out to the data total amount of each timing point, the data for obtaining each timing point are total Amount.Timing point can, using time point as timing point, for example, be counted once every preset time period;Or with number According to other nodes in table as timing point, data statisticss are carried out.So, when the data for needing to inquire about in target zone During total amount, the counting starting point of target zone directly from the timing point of record, can be determined and terminating point is counted, And inquire the corresponding data total amount of counting starting point and count the corresponding data total amount of terminating point, then by the two countings The data total amount of point obtains the data total amount in target zone.
For example, using time point as timing point, when being inquired about, rising for the i.e. target time section of target zone is determined Time beginning and termination time, the data total amount of the two time points records is found out, if the time of termination corresponding data are total Amount is more than the corresponding data total amount of initial time, then the two subtracts each other, that is, obtain the data total amount in target time section.
According to the embodiment of the present application, determine the counting starting point of target zone and count terminating point, target zone is logarithm According to the scope that the data in storehouse are counted, the corresponding data total amount of query counts starting point and counting terminating point are corresponding Data total amount, wherein, data base is prerecorded with the data total amount of each timing point, and each timing point includes meter Count starting point and count terminating point, it is total with the corresponding data of counting terminating point according to the corresponding data total amount of starting point is counted The data volume in target zone is measured, so, when counting inquiry is carried out, two values need to be only searched and be counted starting point Corresponding data total amount and the corresponding data total amount of counting terminating point, you can the data total amount being calculated in target zone, The all data accumulations in the range of this need not be found to obtain a result, the speed of data base's counting is improve, solved to number in data base According to the technical problem that counting is slow.
Preferably, query unit is specifically for total from the corresponding data of query counts starting point in the count table for pre-building Amount and the corresponding data total amount of counting terminating point, wherein, count table is used to record the data total amount of each timing point.
In the present embodiment, the count table for recording the data total amount of each timing point is pre-build in data base, number According to storehouse when data processing (including but not limited to data storage, renewal, deletion) is carried out, in each timing point pair Data total amount in the range of it is counted, and the data total amount of each timing point statistics is recorded in count table. So, when counting inquiry is carried out, only from query counts starting point in the count table and the corresponding number of terminating point need to be counted According to total amount, its query context is little, therefore, the speed of query counts is fast.
Further, each tables of data is provided with a count table in data base.These tables of data can be that Jing is often needed The tables of data for being counted, sets up a corresponding count table, in each timing point pair to each tables of data Tables of data is counted, and is recorded on corresponding count table.
Further, device also includes:Statistic unit, for using time point as timing point, every preset time period The data total amount of the tables of data in staqtistical data base;Recording unit, for the current point in time that will be counted and the number for counting Recorded on the corresponding count table of the tables of data according to total amount.
In the present embodiment, the data total amount of tables of data in preset time period staqtistical data base, can be with minute Granularity, counts data total amount per minute.The data total amount of the current point in time of statistics and statistics associatedly recorded On the corresponding count table of the tables of data.So, during the data total amount inquired about in certain time, from corresponding count table The corresponding data total amount of starting point and ending point of the time period is inquired about, the data total amount in the time period is obtained.
Preferably, target zone is the scope that counted of data of the object table to data base, and query unit includes: Determining module, for the corresponding time point of determines counting starting point and the corresponding time point of counting terminating point;Enquiry module, It is whole for the data total amount and counting from the corresponding time point record of query counts starting point on the corresponding count table of object table The data total amount of the corresponding time point record of stop.
When statistical query is carried out, because the starting point and ending point of the time period to be inquired about is not gate time point, In this case, then need first to determine the time point corresponding to starting point and ending point, then to inquire about corresponding data total Amount.Determine that the time point corresponding to starting point and ending point can round starting point and ending point correspondence, Ke Yishi Round forward or while rounding backward simultaneously so that starting point and ending point can correspond to gate time point.
According to the embodiment of the present application, by determining the time point corresponding to starting point and ending point, it is ensured that data query is united The accuracy of meter, it is to avoid inquiry error.
Preferably, computing unit includes:Comparison module, for counting the corresponding data total amount of starting point and count eventually The corresponding data total amount of stop is compared;Computing module, for count the corresponding data total amount of starting point more than etc. When counting terminating point corresponding data total amount, the data volume in target zone is zero;Counting the corresponding number of starting point During data total amount corresponding less than counting terminating point according to total amount, deducted by the corresponding data total amount of counting terminating point and counted The corresponding data total amount of initial point obtains the data volume in target zone.
Because the data in data base can increase, update or delete, therefore, the data volume for counting then may go out Now increase or reduce.In the embodiment of the present application, count the corresponding data total amount of starting point and count eventually inquiring After the corresponding data total amount of stop, first compare magnitude relationship therebetween, if counting the corresponding data of starting point Total amount is less than and counts the corresponding data total amount of terminating point, then during showing from counting starting point to counting terminating point, The data of data base are to increase or constant, so the data total amount in target zone is the difference between the two;Conversely, such as Fruit counts the corresponding data total amount of starting point more than or equal to the corresponding data total amount of terminating point is counted, then show, show from Starting point is counted to during counting terminating point, the data of data base are reductions, so the data in target zone Total amount is zero.
Above-mentioned the embodiment of the present application sequence number is for illustration only, does not represent the quality of embodiment.
In above-described embodiment of the application, the description to each embodiment all emphasizes particularly on different fields, and does not have in certain embodiment The part of detailed description, may refer to the associated description of other embodiment.
In several embodiments provided herein, it should be understood that disclosed technology contents, other can be passed through Mode realize.Wherein, device embodiment described above is only schematic, such as division of described unit, Can be a kind of division of logic function, can there is other dividing mode, such as multiple units or component when actually realizing Can with reference to or be desirably integrated into another system, or some features can be ignored, or not perform.It is another, institute The coupling each other for showing or discussing or direct-coupling or communication connection can be by some interfaces, unit or mould The INDIRECT COUPLING of block or communication connection, can be electrical or other forms.
The unit as separating component explanation can be or may not be it is physically separate, it is aobvious as unit The part for showing can be or may not be physical location, you can with positioned at a place, or can also be distributed to On multiple units.Some or all of unit therein can be according to the actual needs selected to realize this embodiment scheme Purpose.
In addition, each functional unit in the application each embodiment can be integrated in a processing unit, it is also possible to It is that unit is individually physically present, it is also possible to which two or more units are integrated in a unit.It is above-mentioned integrated Unit both can be realized in the form of hardware, it would however also be possible to employ the form of SFU software functional unit is realized.
If the integrated unit is realized and as independent production marketing or when using using in the form of SFU software functional unit, During a computer read/write memory medium can be stored in.Based on such understanding, the technical scheme essence of the application On all or part of prior art is contributed part in other words or the technical scheme can be with software product Form is embodied, and the computer software product is stored in a storage medium, including some instructions are used so that one Platform computer equipment (can be personal computer, server or network equipment etc.) performs each embodiment of the application The all or part of step of methods described.And aforesaid storage medium includes:USB flash disk, read only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), portable hard drive, magnetic Dish or CD etc. are various can be with the medium of store program codes.
The above is only the preferred implementation of the application, it is noted that for the ordinary skill people of the art For member, on the premise of without departing from the application principle, some improvements and modifications can also be made, these improve and moisten Decorations also should be regarded as the protection domain of the application.

Claims (10)

1. a kind of data base's method of counting, it is characterised in that include:
Determine the counting starting point of target zone and count terminating point, the target zone is to the number in data base According to the scope for being counted;
The inquiry counting corresponding data total amount of starting point and the corresponding data total amount of the counting terminating point, its In, the data base is prerecorded with the data total amount of each timing point, and described each timing point includes institute State counting starting point and the counting terminating point;And
Obtained according to the counting corresponding data total amount of starting point and the corresponding data total amount of the counting terminating point Data volume in the target zone.
2. method according to claim 1, it is characterised in that the corresponding data total amount of the inquiry counting starting point Include with the corresponding data total amount of the counting terminating point:
The counting corresponding data total amount of starting point is inquired about from the count table for pre-building and the counting terminates The corresponding data total amount of point, wherein, the count table is used to record the data total amount of each timing point.
3. method according to claim 2, it is characterised in that each tables of data is provided with the data base Zhang Suoshu count tables, methods described also includes:
Using time point as timing point, the data total amount of the tables of data in preset time period staqtistical data base;
The data total amount of the current point in time of statistics and statistics recorded on the corresponding count table of the tables of data.
4. method according to claim 3, it is characterised in that the target zone is the target to the data base The scope that the data of table are counted, inquires about the counting corresponding data total amount of starting point and the counting terminates The corresponding data total amount of point includes:
Determine the counting corresponding time point of starting point and the corresponding time point of the counting terminating point;
The data of the corresponding time point record of the counting starting point are inquired about from the corresponding count table of the object table The data total amount of total amount and the corresponding time point record of the counting terminating point.
5. method according to claim 3, it is characterised in that according to the corresponding data total amount of the counting starting point Obtaining the data volume in the target zone with the corresponding data total amount of the counting terminating point includes:
The corresponding data total amount of counting starting point data total amount corresponding with the counting terminating point is compared Compared with;
In the corresponding data total amount of the counting starting point more than or equal to the corresponding data total amount of the counting terminating point When, the data volume in the target zone is zero;
In the corresponding data total amount of counting starting point data total amount corresponding less than the counting terminating point, The corresponding data total amount of the counting starting point is deducted by the corresponding data total amount of the counting terminating point and obtains described Data volume in target zone.
6. a kind of data base's counting assembly, it is characterised in that include:
Determining unit, for determining the counting starting point of target zone and counting terminating point, the target zone is The scope that data in data base are counted;
Query unit, it is corresponding with the counting terminating point for inquiring about the corresponding data total amount of the counting starting point Data total amount, wherein, the data base is prerecorded with the data total amount of each timing point, described each Individual timing point includes the counting starting point and the counting terminating point;And
Computing unit, for corresponding with the counting terminating point according to the corresponding data total amount of the counting starting point The data total amount data volume that obtains in the target zone.
7. device according to claim 6, it is characterised in that the query unit is specifically for from pre-building The counting corresponding data total amount of starting point and the corresponding data total amount of the counting terminating point are inquired about in count table, Wherein, the count table is used to record the data total amount of each timing point.
8. device according to claim 7, it is characterised in that each tables of data is provided with the data base Zhang Suoshu count tables, described device also includes:
Statistic unit, for using time point as timing point, the data in preset time period staqtistical data base The data total amount of table;
Recording unit, it is corresponding for the current point in time of statistics and the data total amount of statistics to recorded into the tables of data Count table on.
9. device according to claim 8, it is characterised in that the target zone is the target to the data base The scope that the data of table are counted, the query unit includes:
Determining module, it is corresponding for determining the counting corresponding time point of starting point and the counting terminating point Time point;
Enquiry module, for inquire about from the corresponding count table of the object table it is described counting starting point it is corresponding when Between put record data total amount and the counting terminating point corresponding time point record data total amount.
10. device according to claim 8, it is characterised in that the computing unit includes:
Comparison module, for the corresponding data total amount of the counting starting point is corresponding with the counting terminating point Data total amount is compared;
Computing module, for being more than or equal to the counting terminating point in the corresponding data total amount of the counting starting point During corresponding data total amount, the data volume in the target zone is zero;In the corresponding number of the counting starting point It is total by the corresponding data of the counting terminating point during data total amount corresponding less than the counting terminating point according to total amount Amount deducts the data volume that the corresponding data total amount of the counting starting point is obtained in the target zone.
CN201510659546.2A 2015-10-13 2015-10-13 Database counting method and device Pending CN106570039A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510659546.2A CN106570039A (en) 2015-10-13 2015-10-13 Database counting method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510659546.2A CN106570039A (en) 2015-10-13 2015-10-13 Database counting method and device

Publications (1)

Publication Number Publication Date
CN106570039A true CN106570039A (en) 2017-04-19

Family

ID=58508526

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510659546.2A Pending CN106570039A (en) 2015-10-13 2015-10-13 Database counting method and device

Country Status (1)

Country Link
CN (1) CN106570039A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110321373A (en) * 2019-07-12 2019-10-11 中国农业银行股份有限公司 A kind of query statistic method, apparatus and system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6314386B1 (en) * 1997-10-15 2001-11-06 Venture Union Inc. Site access log analyzing method and method of displaying the same
CN102385620A (en) * 2011-10-25 2012-03-21 深圳市赛格导航科技股份有限公司 Mileage data statistics processing method and system based on document database
CN103500170A (en) * 2013-09-02 2014-01-08 上海淼云文化传播有限公司 Statement generating method and system
CN104268293A (en) * 2014-10-23 2015-01-07 北京国双科技有限公司 Processing method and device for index cannot accumulated in database

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6314386B1 (en) * 1997-10-15 2001-11-06 Venture Union Inc. Site access log analyzing method and method of displaying the same
CN102385620A (en) * 2011-10-25 2012-03-21 深圳市赛格导航科技股份有限公司 Mileage data statistics processing method and system based on document database
CN103500170A (en) * 2013-09-02 2014-01-08 上海淼云文化传播有限公司 Statement generating method and system
CN104268293A (en) * 2014-10-23 2015-01-07 北京国双科技有限公司 Processing method and device for index cannot accumulated in database

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110321373A (en) * 2019-07-12 2019-10-11 中国农业银行股份有限公司 A kind of query statistic method, apparatus and system

Similar Documents

Publication Publication Date Title
EP3117347B1 (en) Systems and methods for rapid data analysis
US10229129B2 (en) Method and apparatus for managing time series database
CN106202280B (en) Information processing method and server
CN107689008A (en) A kind of user insures the method and device of behavior prediction
CN109146301B (en) Sectional type cigarette tobacco distribution uniformity evaluation method and system
CN105654201B (en) Advertisement traffic prediction method and device
CN104484282B (en) A kind of method for recovering internal storage and device
CN107392667A (en) The determination method, apparatus and the network equipment of acceptance of the users
CN108009261A (en) A kind of method of data synchronization, device and electronic equipment
CN112052394A (en) Method, system, terminal device and storage medium for recommending professional content information
CN109672936A (en) A kind of the determination method, apparatus and electronic equipment of video evaluations collection
CN107748739A (en) A kind of extracting method and relevant apparatus of short message text masterplate
CN105468699B (en) Duplicate removal data statistical approach and equipment
CN111737555A (en) Method and device for selecting hot keywords and storage medium
CN110147353B (en) MongoDB data migration monitoring method and device based on log analysis
CN106934679A (en) information matching method and device
CN105429792A (en) User behavior flow obtaining method and device and user behavior analysis method and system
CN106570039A (en) Database counting method and device
CN106933918A (en) The querying method and device of tables of data
CN105408883A (en) Database table column annotation
CN107193839A (en) Data aggregation method and device
CN112598353A (en) Material substitution method, device, storage medium and equipment
CN104484357A (en) Data processing method and device and access frequency information processing method and device
CN105573999A (en) Method and device for recognizing intelligent equipment users
CN105681097A (en) Method and device for obtaining replacing cycle of terminal device

Legal Events

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

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

Applicant after: Beijing Guoshuang Technology Co.,Ltd.

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

Applicant before: Beijing Guoshuang Technology Co.,Ltd.

CB02 Change of applicant information
RJ01 Rejection of invention patent application after publication

Application publication date: 20170419

RJ01 Rejection of invention patent application after publication