CN104268277A - Data reading method and device for database - Google Patents

Data reading method and device for database Download PDF

Info

Publication number
CN104268277A
CN104268277A CN201410545964.4A CN201410545964A CN104268277A CN 104268277 A CN104268277 A CN 104268277A CN 201410545964 A CN201410545964 A CN 201410545964A CN 104268277 A CN104268277 A CN 104268277A
Authority
CN
China
Prior art keywords
data
database
identification information
reading
batch
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
CN201410545964.4A
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 CN201410545964.4A priority Critical patent/CN104268277A/en
Publication of CN104268277A publication Critical patent/CN104268277A/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/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • G06F16/1815Journaling file systems

Abstract

The invention discloses a data reading method and device for a database. The data reading method of the database includes: receiving a reading instruction, wherein the reading instruction is used for instructing data reading from the database, data inserted into the database at multiple batches are stored in the database and correspond to different identification information, and the reading instruction comprises the identification information corresponding to the data needed to be read from the database; seeking data corresponding to the identification information in the reading instruction from the database; reading the found data from the database. The data reading method and device solve the problem of the relative techniques of incapability of accurately reading the data inserted at any batch from the database, and further achieves the effect of reading the data inserted at any batch from the database.

Description

For method for reading data and the device of database
Technical field
The present invention relates to data processing field, in particular to a kind of method for reading data for database and device.
Background technology
In the flow process of data processing, data processing is usually by batch to carry out, such as, a flow chart of data processing comprises steps A and step B, wherein, steps A for reading one or several journal file, and extracts data from journal file, and total data extraction obtained is as in same batch of data inserting storehouse.Step B is that the data obtaining this batch of data inserting storehouse process.Whether the data being difficult in stepb determine to get are the nearest batch of data inserted of steps A.In addition, when the execution efficiency of step B is higher, need setting to perform repeatedly steps A, in database, insert the data (number of times is uncertain) of multiple batches, then perform a step B.Therefore, what will obtain in stepb is not only the data of in steps A one batch, but before last step B performs to this step B after performing, the data of all batches that steps A is inserted, prior art is difficult to get these data accurately.
Prior art often adopts from adding ID or line number to draw a circle to approve data area, certainly to add ID: data handling procedure to be divided into steps A (by data data inserting storehouse) and step B (namely reading some or several lot data from database).Steps A before by this lot data data inserting storehouse, records current maximum ID value, is set to M, behind this lot data data inserting storehouse, record new maximum ID value, be set to N.When performing step B, obtain the value of data ID between M and N as the data needing to obtain.Use this scheme, for steps A, step B successively perform can Obtaining Accurate to needing data to be processed, but for performing repeatedly steps A, when performing a step B, the data of database that last steps A is inserted can only be obtained.In addition, cannot the data of certain batch in Obtaining Accurate database.
For cannot any batch of Obtaining Accurate inserts from database the problem of data in correlation technique, at present effective solution be not yet proposed.
Summary of the invention
Fundamental purpose of the present invention is to provide a kind of method for reading data for database and device, with to solve in correlation technique cannot from database the problem of the data that any batch of Obtaining Accurate inserts.
To achieve these goals, according to an aspect of the present invention, a kind of method for reading data for database is provided.
Method for reading data for database according to the present invention comprises: receive reading command, wherein, reading command is used to indicate and reads data from database, store the multiple batches of data inserted in a database, the data that in the multiple batches of data inserted, different batches inserts correspond to different identification information, and reading command comprises identification information corresponding to data that needs read from database; The data that identification information in reading command is corresponding are searched from database; And from database, read the data found.
Further, before reception reading command, method comprises: read the data that multiple batches are inserted into database, obtain the data of multiple batches; Obtain the multiple identification informations corresponding with the data of multiple batches, wherein, in the data of multiple batches, the data of different batches correspond to different identification informations, and in the data of multiple batches, the data of same batch correspond to identical identification information; By in the data of multiple batches and corresponding identification information data inserting storehouse.
Further, obtain the multiple identification informations corresponding with the data of multiple batches and comprise identification information corresponding to the data of acquisition first batch, wherein, the data of first batch are the data of any one batch in the data of multiple batches, and the identification information obtaining the data of first batch corresponding comprises: judge whether first batch of data being inserted into database reads complete; If judge that first batch of digital independent being inserted into database is complete, obtain the time that first batch is inserted into the digital independent of database; And using the time of reading as identification information.
Further, before reception reading command, method also comprises: create the first tables of data in a database, and wherein, the first tables of data is used for storaging mark information; By multiple identification information storage corresponding for the data of multiple batches in the data rows of the first tables of data; And the identification information that inquiry needs the data of reading corresponding from the data rows of the first tables of data is as reading command.
Further, reading command is used to indicate the data reading multiple batches from database, reception reading command comprises: multiple identification informations that in reception database, the data of multiple batches are corresponding, as reading command, the data of searching identification information in reading command corresponding from database comprise: from database, inquire about each identification information in multiple identification information respectively; And obtain corresponding data by inquiring about each identification information in multiple identification informations of obtaining in database respectively.
Further, after inserting in described database by the data of multiple batches and corresponding identification information, the method comprises: judge whether the data needed in process database; And when judging the data needed in process database, obtain the identification information needing the data in database to be processed corresponding, as reading command.
To achieve these goals, according to a further aspect in the invention, a kind of data fetch device for database is provided.
Data fetch device for database according to the present invention comprises: receiving element, for receiving reading command, wherein, reading command is used to indicate and reads data from database, store the multiple batches of data inserted in a database, the data that in the multiple batches of data inserted, different batches inserts correspond to different identification information, and reading command comprises identification information corresponding to data that needs read from database; Search unit, for searching data corresponding to identification information in reading command from database; And first reading unit, for reading the data found from database.
Further, before reception reading command, device comprises: the second reading unit, for reading the data that multiple batches are inserted into database, obtains the data of multiple batches; First acquiring unit, for obtaining the multiple identification informations corresponding with the data of multiple batches, wherein, in the data of multiple batches, the data of different batches correspond to different identification informations, and in the data of multiple batches, the data of same batch correspond to identical identification information; Plug-in unit, for by the data of multiple batches and corresponding identification information data inserting storehouse.
Further, acquiring unit is also for identification information that the data obtaining in multiple identification informations corresponding with the data of multiple batches first batch are corresponding, wherein, the data of first batch are the data of any one batch in the data of multiple batches, acquiring unit comprises: judge module, for judging whether first batch of data being inserted into database reads complete; Acquisition module, for when judging that first batch of digital independent being inserted into database is complete, obtains the time that first batch is inserted into the digital independent of database; And generation module, for will read time as identification information.
Further, before reception reading command, this device also comprises: creating unit, and for creating the first tables of data in a database, wherein, the first tables of data is used for storaging mark information; Storage unit, for by multiple identification information storage corresponding for the data of multiple batches in the data rows of the first tables of data; And query unit, need identification information corresponding to data read as reading command for inquiry in the data rows from the first tables of data.
Further, reading command is used to indicate the data reading multiple batches from database, receiving element is also for multiple identification informations that the data receiving in database multiple batches are corresponding, as reading command, search unit to comprise: enquiry module, for inquiring about each identification information in multiple identification information from database respectively; And acquisition module, for obtaining corresponding data by inquiring about each identification information in multiple identification informations of obtaining in database respectively.
Further, by after in the data of multiple batches and corresponding identification information data inserting storehouse, this device also comprises: judging unit, for judging whether the data needed in process database; And second acquisition unit, for when judging the data needed in process database, the identification information that acquisition needs the data in database to be processed corresponding is as reading command.
Pass through the present invention, the data adopting different batches to insert correspond to different identification informations, identification information corresponding to the data of reading is needed to read corresponding data by searching from database, to solve in correlation technique cannot from database the problem of the data that any batch of Obtaining Accurate inserts, and then reach the effect of the data that any batch of Obtaining Accurate from database inserts.
Accompanying drawing explanation
The accompanying drawing forming a application's part is used to provide a further understanding of the present invention, and schematic description and description of the present invention, for explaining the present invention, does not form inappropriate limitation of the present invention.In the accompanying drawings:
Fig. 1 is the process flow diagram of the method for reading data for database according to a first embodiment of the present invention;
Fig. 2 is the process flow diagram of the method for reading data for database according to a second embodiment of the present invention;
Fig. 3 is the process flow diagram of the method for reading data for database according to a third embodiment of the present invention; And
Fig. 4 is the schematic diagram of the data fetch device for database according to the embodiment of the present invention.
Embodiment
It should be noted that, when not conflicting, the embodiment in the application and the feature in embodiment can combine mutually.Below with reference to the accompanying drawings and describe the present invention in detail in conjunction with the embodiments.
The present invention program is understood better in order to make those skilled in the art person, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the embodiment of a part of the present invention, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, should belong to the scope of protection of the invention.
It should be noted that, term " first ", " second " etc. in instructions of the present invention and claims and above-mentioned accompanying drawing are for distinguishing similar object, and need not be used for describing specific order or precedence.Should be appreciated that the data used like this can be exchanged, in the appropriate case so that embodiments of the invention described herein.In addition, term " comprises " and " having " and their any distortion, intention is to cover not exclusive comprising, such as, contain those components and parts that the system of multiple components and parts, product or equipment are not necessarily limited to clearly list, but can comprise clearly do not list or for these products or intrinsic other components and parts of equipment.
According to embodiments providing a kind of method for reading data for database, Fig. 1 is the process flow diagram of the method for reading data for database according to a first embodiment of the present invention.
As shown in Figure 1, the method comprises following step S102 to step S106:
Step S102: receive reading command, wherein, reading command is used to indicate and reads data from database, store the multiple batches of data inserted in a database, the data that in the multiple batches of data inserted, different batches inserts correspond to different identification information, and reading command comprises identification information corresponding to data that needs read from database.
When user needs the data of given batch in reading database, can by inputting data read command in the operation interface of database, if this database is the background data base of application program, user also by inputting data read command in the operation interface of this application program, can comprise the identification information that the data of this given batch are corresponding in reading command.Identification information is used for distinguishing the data in different batches data inserting storehouse, identification information can be any character that can mutually distinguish, it can be different time value, also can be Serial No., alphabetical sequence or numeral and letter combination etc., the identification information that user can specify any batch of data inserted corresponding in reading command, after receiving the data read command of user, corresponding data can be read according to the identification information comprised in this data read command from database.
In practical application, normally by batch by data data inserting storehouse, the data of a lot of batches can be stored in a database, in order to distinguish the data of different batches, can by identification informations different for the Data Identification in different batches data inserting storehouse, the data that different batches is inserted correspond to different identification informations.Such as, the waiting information of advertisement is daily stored in database to analyze the input strategy of advertisement by user, in order to distinguish the waiting information that not same date inserts, the date storing this waiting information data inserting storehouse in a database that can be corresponding, thus user conveniently can check the waiting information on any date.
Step S104: search the data that identification information in reading command is corresponding from database.
After receiving user data reading command, the identification information identical with the identification information in user data reading command is searched from database, due to data and the different identification information one_to_one corresponding of different batches insertion in a database, find the identification information identical with the identification information in user data reading command in a database and also just find corresponding data.
Step S106: read the data found from database.
Just can read these data after finding the data needing to read in a database, such as, after data processor reads given batch data, the operations such as such as data summation, data merging can be carried out to the data read.
The embodiment of the present invention reads corresponding data by the identification information that the data of the needs reading comprised in data read command are corresponding from database, the data inserted due to different batches in database correspond to different identification informations, and the identification information that the data of any batch can be specified in reading command corresponding, therefore from database, the data of corresponding batch of this identification information in the data of multiple batches, can be read accurately by the identification information that comprises in reading command, and to solve in correlation technique cannot from database the problem of the data that any batch of Obtaining Accurate inserts, and then reach the effect of the data that any batch of Obtaining Accurate from database inserts.
Preferably, in order to distinguish the data in different batches data inserting storehouse, as shown in Figure 2, before reception reading command, the method comprises following step S202 to step S212:
Step S202: read the data that multiple batches are inserted into database, obtain the data of multiple batches.
Can be read the data that multiple batches are inserted into each batch in the data of database successively, obtain the data of multiple batches, also can be obtain the data that multiple batches are inserted into database simultaneously, obtain the data of multiple batches, such as, daily can read the log information that application program is run, the log information of every day is as a collection of data being inserted into database, then once read the data of batch, also can be the log information reading an application program operation every 3 days, the log information of same every day is as a collection of data being inserted into database, so then once can read the data of 3 batches simultaneously, user can set the mode reading and be inserted into the data of database according to demand.
Step S204: obtain the multiple identification informations corresponding with the data of multiple batches, wherein, in the data of multiple batches, the data of different batches correspond to different identification informations, and in the data of multiple batches, the data of same batch correspond to identical identification information.
In the data of multiple batches, the data of different batches correspond to different identification informations, the data of same batch correspond to identical identification information, while the data distinguishing different batches data inserting storehouse, all data inserted to same batch by retrieving an identification information quick indexing can be guaranteed like this.As shown in table 1, at database with being used in the table of file data inserting, first batch of data inserted is data 1, data 2 and data 3, its identification information is all 1, second batch of data inserted is data 4, data 5 and data 6, and its identification information is all 2, the 3rd batch of data inserted are data 7 and data 8, its identification information is all 3, by that analogy, can find the corresponding batch of all data inserted rapidly by searching mark information.
The data of multiple batches and the tables of data of corresponding identification information is stored in table 1 database
Data message Identification information
Data 1 1
Data 2 1
Data 3 1
Data 4 2
Data 5 2
Data 6 2
Data 7 3
Data 8 3
Identification information can be any character that can mutually distinguish, and can be different time value, also can be Serial No., alphabetical sequence or numeral and letter combination etc., such as, be A1 by the Data Identification of first batch, the Data Identification of second batch is A2, by that analogy.Preferably, in order to can conveniently obtain the efficiency information in data data inserting storehouse, obtain the multiple identification informations corresponding with the data of multiple batches and comprise identification information corresponding to the data of acquisition first batch, wherein, the data of first batch are the data of any one batch in the data of multiple batches, and the identification information obtaining the data of first batch corresponding comprises: judge whether first batch of data being inserted into database reads complete; If judge that first batch of digital independent being inserted into database is complete, obtain the time that first batch is inserted into the digital independent of database; And using the time of reading as identification information.
The mode obtaining identification information corresponding to the data of each batch in the process obtaining multiple identification informations corresponding with the data of multiple batches is identical, and the identification information that the embodiment of the present invention obtains correspondence for the data of any one batch in the data of multiple batches (such as first secondary data) is described.Because the data of batch often comprise many data, reading first batch data as band data inserting storehouse data time, whether all data of first batch are read and completely to judge, can being that the last item data judge whether that digital independent is complete by detecting, also whether can reading data by detection and judging whether that digital independent is complete.When judging that first batch of data being inserted into database all reads complete, the time that record digital independent is complete, and using this time as identification information corresponding to first batch of data being inserted into database.
By using the time complete for the digital independent of different batches as identification information corresponding to the data of different batches, conveniently can obtain the efficiency of data inserting in database, the identification information that such as first secondary data is corresponding is 2013/10/10/10:05, identification information corresponding to second batch secondary data is 2013/10/10/10:10, identification information corresponding to the 3rd lot data is 2013/10/10/10:15, it can thus be appreciated that insert a batch data in 5 points of clockwise databases.
Step S206: by the data of multiple batches and corresponding identification information data inserting storehouse.
The data of multiple batches and corresponding identification information one_to_one corresponding in a database, all data of same batch are all designated identical identification information, and the Data Identification of different batches is different identification information.Can by a database for store multiple batches data tables of data in increase a data rows, for storaging mark information, as shown in table 1, in this tables of data, data message arranges the data for storing multiple batches, and identification information arranges multiple identification informations corresponding to data for storing multiple batches, had both comprised data message and also comprise identification information in the data line in this tables of data.
Step S208: with above-mentioned steps S102, does not repeat them here.
Step S210: with above-mentioned steps S104, does not repeat them here.
Step S212: with above-mentioned steps S106, does not repeat them here.
Preferably, the batch information of the data conveniently stored in user's Query Database, before reception reading command, method also comprises: create the first tables of data in a database, and wherein, the first tables of data is used for storaging mark information; By multiple identification information storage corresponding for the data of multiple batches in the data rows of the first tables of data; And the identification information that inquiry needs the data of reading corresponding from the data rows of the first tables of data is as reading command.
Multiple identification informations corresponding to the data of multiple batches that store in stored data base are carried out by creating a tables of data (such as the first tables of data) in a database, first tables of data is only for identification information that the data storing multiple batches are corresponding, identification information corresponding to the data of each batch only stores once in the first tables of data, and in the tables of data of the data for storing multiple batches all corresponding batch information of each data, check that when data volume is very large identification information corresponding to the data of different batches is then inconvenient, and can know by the identification information stored in the first tables of data the data known intuitively in database and store which batch, thus user can get the identification information needing the data of reading corresponding easily.
Preferably, from database, the efficiency of data is read in order to improve user, reading command is used to indicate the data reading multiple batches from database, reception reading command comprises: multiple identification informations that in reception database, the data of multiple batches are corresponding, as reading command, the data of searching identification information in reading command corresponding from database comprise: from database, inquire about each identification information in multiple identification information respectively; And obtain corresponding data by inquiring about each identification information in multiple identification informations of obtaining in database respectively.
When user needs to read the data of multiple batches from database simultaneously, multiple identification informations that the data of the plurality of batch are corresponding can be specified in reading command.After receiving the reading command comprising multiple identification information, each identification information in multiple identification information is inquired about respectively from database, because different identification informations is at the data one_to_one corresponding of database and different batches, therefore, the identification information inquired in reading command also just can obtain data corresponding to this identification information simultaneously.
Preferably, in order to the treatment scheme robotization of the data of multiple batches stored in fulfillment database, after inserting in described database by the data of multiple batches and corresponding identification information, the method comprises: judge whether the data needed in process database; And when judging the data needed in process database, the identification information that acquisition needs the data in database to be processed corresponding is as reading command.
After inserting in described database by the data of multiple batches and corresponding identification information, can process the data stored in database, such as data processor can carry out relevant treatment to the data of multiple batches that store in database.In order to realize the robotization for the treatment of scheme, can prejudge the need of the data in process database, user can arrange decision condition according to demand, such as, often can insert N batch data and then carry out a data processing in setting data storehouse, also can be set to then carry out a data processing every Preset Time.When judging to meet data handling conditions, then obtain identification information corresponding to need data to be processed as reading command.Needing data to be processed can the data of the not processed mistake of database, also can be the data that in database, process last time is failed.
According to the third embodiment of the invention the method for reading data for database provided, particularly, create TimeStap in a database and create TimeStamp table in a database, TimeStamp is table name, only can comprise the timestamp data rows of smalldatetime type in this table, Timestamp is field name, the identification information that the data of all batches being used for storing in stored data base are corresponding, in embodiments of the present invention, identification information is timestamp.In addition, create LastProcessTime table in a database, LastProcessTime is table name, this table only can comprise the lastprocesstime data rows of smalldatetime type, lastprocesstime is field name, be used for recording the timestamp that treated data are corresponding, timestamp is used for representing time value.Table data store T1 is the tables of data of data for storing multiple batches in database, increases timestamp data rows, for storing the identification information corresponding with the data of multiple batches in table data store T1.The implementation procedure of whole data processing as shown in Figure 4, comprises the steps that S302 is to step S323:
Step S302: read log information.Read log information as the data being inserted into database, with the log information that once reads as with a collection of data being inserted into database.Log information can be the data needing arbitrarily to be stored in database, can be the running log information of application program, can be the running log information etc. of equipment.Read the log information being inserted into database of batch each time.
Step S304: acquisition current time t1 is timestamp.Current time t1 refers to reading time of complete log information, and this time is designated as timestamp t1, and this timestamp t1 is as identification information corresponding to the above-mentioned data being inserted into database.
Write time stamp t1 in step S306:TimeStamp table.By identification information corresponding for the above-mentioned data being inserted into database, namely timestamp t1 writes in TimeStamp table.
Step S308: be t1 by data data inserting storehouse and by timestamp row assignment.In table data store T1 in the data write into Databasce of batch of above-mentioned reading timestamp t1 will be write in timestamp data rows.
Step S310: the data whether in process database.Judge whether the data of multiple batches that store in process database.When judging the data in process database, performing step S314, when judging the data in not process database, performing step S304, continue the log information reading next batch.
Step S312: obtain the processing time last time stamp tm in LastProcessTime table.
LastProcessTime table stores identification information corresponding to the data of all processed databases.The time in different batches data data inserting storehouse can be reflected as the identification information that the data in different batches data inserting storehouse are corresponding by different time stamp.Therefore the identification information that in the database stored during the identification information that the processed data stored in can showing according to LastProcessTime are corresponding and TimeStamp show, the data of all batches are corresponding obtains data not processed in database fast.Data processor reads data successively according to the sequencing in the data data inserting storehouse be stored in database and processes, thus the data of certain batch in database can be avoided to be missed and not processed.
Step S314: obtain the timestamp tn that in TimeStamp table, the time is maximum.
Stabbed tm by processing time last time in getting time maximum timestamp tn and LastProcessTime in TimeStamp table and showing and can know in database that to have the data of how many batches not processed.
Step S316: obtain from database in timestamp row and be greater than tm and be less than or equal to data corresponding to the timestamp of tn.
By the identification information that the need data to be processed found from database are corresponding, and obtain corresponding data according to the identification information found.Can realize once obtaining and in timestamp data rows, be greater than tm and the data of multiple batches being less than or equal to multiple timestamps of tn corresponding facilitate optimization data treatment scheme.
Step S318: the data that process obtains.
Step S320: the value upgrading LastProcessTime table is tn.
After the process completing the data got, by corresponding for the data be processed in database maximum time stamp and tn be updated in LastProcessTime table, obtain for convenient the identification information needing data to be processed corresponding next time, also can avoid the data in re-treatment database.
Above-mentioned flow chart of data processing can by arranging the automatic process realizing data, data can be realized repeatedly and insert a data processing, improve the efficiency of data processing, the data that also again can read this batch after the data processing failure of certain batch process, thus avoid the data of this batch not processed.
As can be seen from the above description, present invention achieves following technique effect:
The embodiment of the present invention is by being same identification information by the Data Identification in same batch of data inserting storehouse, and the Data Identification in different batches data inserting storehouse is different identification information.During data in reading database, receiving package containing the reading command of identification information corresponding to the data needing to read, and searches identification information that reading command comprises thus data corresponding to the identification information that comprises of reading command from database.By to the invention solves in correlation technique cannot from database the problem of the data that any batch of Obtaining Accurate inserts, and then reach the effect of the data that any batch of Obtaining Accurate from database inserts.
It should be noted that, can perform in the computer system of such as one group of computer executable instructions in the step shown in the process flow diagram of accompanying drawing, and, although show logical order in flow charts, but in some cases, can be different from the step shown or described by order execution herein.
According to the another aspect of the embodiment of the present invention, provide a kind of data fetch device for database, this data fetch device being used for database may be used for the method for reading data for database performing the embodiment of the present invention, and the method for reading data for database of the embodiment of the present invention also can be performed by the data fetch device for database of the embodiment of the present invention.
As shown in Figure 4, this device comprises: receiving element 10, searches unit 20 and the first reading unit 30.
Receiving element 10, for receiving reading command, wherein, reading command is used to indicate and reads data from database, store the multiple batches of data inserted in a database, the data that in the multiple batches of data inserted, different batches inserts correspond to different identification information, and reading command comprises identification information corresponding to data that needs read from database.
When user needs the data of given batch in reading database, can by inputting data read command in the operation interface of database, if this database is the background data base of application program, user also by inputting data read command in the operation interface of this application program, can comprise the identification information that the data of this given batch are corresponding in reading command.Identification information is used for distinguishing the data in different batches data inserting storehouse, identification information can be any character that can mutually distinguish, it can be different time value, also can be Serial No., alphabetical sequence or numeral and letter combination etc., the identification information that user can specify any batch of data inserted corresponding in reading command, after receiving the data read command of user, corresponding data can be read according to the identification information comprised in this data read command from database.
Search unit 20, for searching data corresponding to identification information in reading command from database.
After receiving user data reading command, the identification information identical with the identification information in user data reading command is searched from database, due to data and the different identification information one_to_one corresponding of different batches insertion in a database, find the identification information identical with the identification information in user data reading command in a database and also just find corresponding data.
First reading unit 30, for reading the data found from database.
Just can read these data after finding the data needing to read in a database, such as, after data processor reads given batch data, the operations such as such as data summation, data merging can be carried out to the data read.
The embodiment of the present invention receives data read command by receiving element 10, the identification information that the data that the needs that comprise in reading command read are corresponding, the data of searching identification information in reading command corresponding from database by searching unit 20 read for the first reading unit 30.The data inserted due to different batches in database correspond to different identification informations, therefore identification information corresponding to the data of any batch can be specified in reading command can to read data in database in any batch of data inserting storehouse, to solve in correlation technique cannot from database the problem of the data that any batch of Obtaining Accurate inserts, and then reach the effect of the data that any batch of Obtaining Accurate from database inserts.
Preferably, in order to distinguish the data in different batches data inserting storehouse, before reception reading command, this device also comprises: the second reading unit, for reading the data that multiple batches are inserted into database, obtains the data of multiple batches; First acquiring unit, for obtaining the multiple identification informations corresponding with the data of multiple batches, wherein, in the data of multiple batches, the data of different batches correspond to different identification informations, and in the data of multiple batches, the data of same batch correspond to identical identification information; Plug-in unit, for by the data of multiple batches and corresponding identification information data inserting storehouse.
In the data of multiple batches, the data of different batches correspond to different identification informations, the data of same batch correspond to identical identification information, while the data distinguishing different batches data inserting storehouse, all data inserted to same batch by retrieving an identification information quick indexing can be guaranteed like this.
Preferably, in order to can conveniently obtain the efficiency relevant information in data data inserting storehouse, acquiring unit is also for identification information that the data obtaining in multiple identification informations corresponding with the data of multiple batches first batch are corresponding, wherein, the data of first batch are the data of any one batch in the data of multiple batches, acquiring unit comprises: judge module, for judging whether first batch of data being inserted into database reads complete; Acquisition module, for when judging that first batch of digital independent being inserted into database is complete, obtains the time that first batch is inserted into the digital independent of database; And generation module, for will read time as identification information.
By using the time complete for the digital independent of different batches as identification information corresponding to the data of different batches, conveniently can obtain the efficiency of data inserting in database, the identification information that such as first secondary data is corresponding is 2013/10/10/10:05, identification information corresponding to second batch secondary data is 2013/10/10/10:10, identification information corresponding to the 3rd lot data is 2013/10/10/10:15, it can thus be appreciated that insert a batch data in 5 points of clockwise databases.
Preferably, the batch information of the data conveniently stored in user's Query Database, before reception reading command, this device also comprises: creating unit, for creating the first tables of data in a database, wherein, the first tables of data is used for storaging mark information; Storage unit, for by multiple identification information storage corresponding for the data of multiple batches in the data rows of the first tables of data; And query unit, need identification information corresponding to data read as reading command for inquiry in the data rows from the first tables of data.
Multiple identification informations corresponding to the data of multiple batches that store in stored data base are carried out by creating a tables of data (such as the first tables of data) in a database, first tables of data is only for identification information that the data storing multiple batches are corresponding, identification information corresponding to the data of each batch only stores once in the first tables of data, and in the tables of data of the data for storing multiple batches all corresponding batch information of each data, check that when data volume is very large identification information corresponding to the data of different batches is then inconvenient, and can know by the identification information stored in the first tables of data the data known intuitively in database and store which batch, thus user can get the identification information needing the data of reading corresponding easily.
Preferably, from database, the efficiency of data is read in order to improve user, reading command is used to indicate the data reading multiple batches from database, receiving element is also for multiple identification informations that the data receiving in database multiple batches are corresponding, as reading command, search unit to comprise: enquiry module, for inquiring about each identification information in multiple identification information from database respectively; And acquisition module, for obtaining corresponding data by inquiring about each identification information in multiple identification informations of obtaining in database respectively.
Preferably, in order to the treatment scheme robotization of the data of multiple batches stored in fulfillment database, by after in the data of multiple batches and corresponding identification information data inserting storehouse, this device also comprises: judging unit, for judging whether the data needed in process database; And second acquisition unit, for when judging the data needed in process database, the identification information that acquisition needs the data in database to be processed corresponding is as reading command.
After inserting in described database by the data of multiple batches and corresponding identification information, can process the data stored in database, such as data processor can carry out relevant treatment to the data of multiple batches that store in database.In order to realize the robotization for the treatment of scheme, can prejudge the need of the data in process database, user can arrange decision condition according to demand, such as, often can insert N batch data and then carry out a data processing in setting data storehouse, also can be set to then carry out a data processing every Preset Time.When judging to meet data handling conditions, then obtain identification information corresponding to need data to be processed as reading command.Needing data to be processed can the data of the not processed mistake of database, also can be the data that in database, process last time is failed.
Obviously, those skilled in the art should be understood that, above-mentioned of the present invention each module or each step can realize with general calculation element, they can concentrate on single calculation element, or be distributed on network that multiple calculation element forms, alternatively, they can realize with the executable program code of calculation element, thus, they can be stored and be performed by calculation element in the storage device, or they are made into each integrated circuit modules respectively, or the multiple module in them or step are made into single integrated circuit module to realize.Like this, the present invention is not restricted to any specific hardware and software combination.
The foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, for a person skilled in the art, the present invention can have various modifications and variations.Within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (10)

1. for a method for reading data for database, it is characterized in that, comprising:
Receive reading command, wherein, described reading command is used to indicate and reads data from database, store the multiple batches of data inserted in the database, the data that in the described multiple batches of data inserted, different batches inserts correspond to different identification information, and described reading command comprises identification information corresponding to data that needs read from described database;
The data that identification information in described reading command is corresponding are searched from described database; And
The data found are read from described database.
2. the method for reading data for database according to claim 1, is characterized in that, before reception reading command, described method comprises:
Read the data that multiple batches are inserted into described database, obtain the data of multiple batches;
Obtain the multiple identification informations corresponding with the data of described multiple batches, wherein, in the data of described multiple batches, the data of different batches correspond to different identification informations, and in the data of described multiple batches, the data of same batch correspond to identical identification information;
The data of described multiple batches and corresponding identification information are inserted in described database.
3. the method for reading data for database according to claim 2, it is characterized in that, obtain the multiple identification informations corresponding with the data of described multiple batches and comprise identification information corresponding to the data of acquisition first batch, wherein, the data of described first batch are the data of any one batch in the data of described multiple batches, and the identification information obtaining the data of first batch corresponding comprises:
Judge whether described first batch of data being inserted into described database read complete;
If judge that described first batch of digital independent being inserted into described database is complete, obtain described first batch of time being inserted into the digital independent of described database; And
Using the time of reading as described identification information.
4. the method for reading data for database according to claim 2, is characterized in that, before reception reading command, described method also comprises:
Create the first tables of data in the database, wherein, described first tables of data is for storing described identification information;
By multiple identification information storage corresponding for the data of described multiple batches in the data rows of described first tables of data; And
The identification information that inquiry needs the data of reading corresponding from the data rows of described first tables of data is as described reading command.
5. the method for reading data for database according to claim 1, is characterized in that,
Described reading command is used to indicate the data reading multiple batches from described database, receives reading command and comprises: receive multiple identification informations that the data of in described database multiple batches are corresponding, as reading command,
The data of searching identification information in described reading command corresponding from described database comprise:
Each identification information in described multiple identification information is inquired about respectively from described database; And
Corresponding data are obtained respectively by inquiring about each identification information in described multiple identification information of obtaining in described database.
6. the method for reading data for database according to claim 1, is characterized in that, after inserting in described database by the data of described multiple batches and corresponding identification information, described method comprises:
Judge whether to need the data in processing said data storehouse; And
When judging to need the data in processing said data storehouse, the identification information that acquisition needs the data in described database to be processed corresponding is as described reading command.
7. for a data fetch device for database, it is characterized in that, comprising:
Receiving element, for receiving reading command, wherein, described reading command is used to indicate and reads data from database, store the multiple batches of data inserted in the database, the data that in the described multiple batches of data inserted, different batches inserts correspond to different identification information, and described reading command comprises identification information corresponding to data that needs read from described database;
Search unit, for searching data corresponding to identification information in described reading command from described database; And
First reading unit, for reading the data found from described database.
8. the data fetch device for database according to claim 7, is characterized in that, before reception reading command, described device comprises:
Second reading unit, for reading the data that multiple batches are inserted into described database, obtains the data of multiple batches;
First acquiring unit, for obtaining the multiple identification informations corresponding with the data of described multiple batches, wherein, in the data of described multiple batches, the data of different batches correspond to different identification informations, and in the data of described multiple batches, the data of same batch correspond to identical identification information;
Plug-in unit, for inserting the data of described multiple batches and corresponding identification information in described database.
9. the data fetch device for database according to claim 8, it is characterized in that, described acquiring unit is also for identification information that the data obtaining in multiple identification informations corresponding with the data of described multiple batches first batch are corresponding, wherein, the data of described first batch are the data of any one batch in the data of described multiple batches, and described acquiring unit comprises:
Judge module, for judging whether described first batch of data being inserted into described database read complete;
Acquisition module, for when judging that described first batch of digital independent being inserted into described database is complete, obtains described first batch of time being inserted into the digital independent of described database; And
Generation module, for will read time as described identification information.
10. the data fetch device for database according to claim 8, is characterized in that, before reception reading command, described device also comprises:
Creating unit, for creating the first tables of data in the database, wherein, described first tables of data is for storing described identification information;
Storage unit, for by multiple identification information storage corresponding for the data of described multiple batches in the data rows of described first tables of data; And
Query unit, needs identification information corresponding to data read as described reading command for inquiry in the data rows from described first tables of data.
CN201410545964.4A 2014-10-15 2014-10-15 Data reading method and device for database Pending CN104268277A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410545964.4A CN104268277A (en) 2014-10-15 2014-10-15 Data reading method and device for database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410545964.4A CN104268277A (en) 2014-10-15 2014-10-15 Data reading method and device for database

Publications (1)

Publication Number Publication Date
CN104268277A true CN104268277A (en) 2015-01-07

Family

ID=52159798

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410545964.4A Pending CN104268277A (en) 2014-10-15 2014-10-15 Data reading method and device for database

Country Status (1)

Country Link
CN (1) CN104268277A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105868205A (en) * 2015-01-21 2016-08-17 阿里巴巴集团控股有限公司 Data reading method and apparatus
CN106055640A (en) * 2016-05-31 2016-10-26 乐视控股(北京)有限公司 Buffer memory management method and system
CN109325013A (en) * 2018-07-11 2019-02-12 中国银联股份有限公司 A kind of data managing method and device of distributed system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070038664A1 (en) * 2002-12-27 2007-02-15 Jonas Jeffrey J Real time data warehousing
CN102375825A (en) * 2010-08-13 2012-03-14 捷达世软件(深圳)有限公司 Process integration server and method for realizing system integration by utilizing same
CN102426579A (en) * 2011-08-25 2012-04-25 中兴通讯股份有限公司 Web mode-based method for importing/exporting file
CN103136222A (en) * 2011-11-23 2013-06-05 中国银联股份有限公司 Method achieving data base transaction flow list read-write synchronization
CN103778137A (en) * 2012-10-19 2014-05-07 腾讯科技(深圳)有限公司 Blog content searching method and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070038664A1 (en) * 2002-12-27 2007-02-15 Jonas Jeffrey J Real time data warehousing
CN102375825A (en) * 2010-08-13 2012-03-14 捷达世软件(深圳)有限公司 Process integration server and method for realizing system integration by utilizing same
CN102426579A (en) * 2011-08-25 2012-04-25 中兴通讯股份有限公司 Web mode-based method for importing/exporting file
CN103136222A (en) * 2011-11-23 2013-06-05 中国银联股份有限公司 Method achieving data base transaction flow list read-write synchronization
CN103778137A (en) * 2012-10-19 2014-05-07 腾讯科技(深圳)有限公司 Blog content searching method and system

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105868205A (en) * 2015-01-21 2016-08-17 阿里巴巴集团控股有限公司 Data reading method and apparatus
CN105868205B (en) * 2015-01-21 2019-08-27 阿里巴巴集团控股有限公司 Method for reading data and device
CN106055640A (en) * 2016-05-31 2016-10-26 乐视控股(北京)有限公司 Buffer memory management method and system
CN109325013A (en) * 2018-07-11 2019-02-12 中国银联股份有限公司 A kind of data managing method and device of distributed system
CN109325013B (en) * 2018-07-11 2022-07-08 中国银联股份有限公司 Data management method and device of distributed system

Similar Documents

Publication Publication Date Title
CN108536739B (en) Metadata sensitive information field identification method, device, equipment and storage medium
CN107291745B (en) Data index management method and device
CN106997431B (en) Data processing method and device
CN109636345B (en) Intelligent management method and system for business handling workflow
CN102541960A (en) Method and device of fuzzy retrieval
CN110427375B (en) Method and device for identifying field type
CN103473076A (en) Issuing method and issuing system for code version
CN109597834A (en) Mass data storage means, device, medium and equipment based on redis
CN106933919B (en) Data table connection method and device
CN104268277A (en) Data reading method and device for database
CN104462420A (en) Method and device for executing query tasks on database
US20190087470A1 (en) System and method for mining user cycle mode
CN111324781A (en) Data analysis method, device and equipment
CN104794130A (en) Inter-table correlation query method and device
CN104298570B (en) Data processing method and device
CN110888965A (en) Document data extraction method and device
CN110019762B (en) Problem positioning method, storage medium and server
CN105589873B (en) Data searching method, terminal and server
CN108170693B (en) Hot word pushing method and device
CN112035440B (en) Knowledge base management method, device, electronic equipment and storage medium
CN114741384A (en) Patient information processing method and device and computer readable storage medium
CN106570024B (en) Data increment processing method and device
CN110580243A (en) file comparison method and device, electronic equipment and storage medium
CN112579763A (en) Document pushing method and device
CN112835991B (en) System, method, device and storage medium for monitoring data

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20150107

RJ01 Rejection of invention patent application after publication