CN102200972A - Database maintenance method and database maintenance equipment - Google Patents
Database maintenance method and database maintenance equipment Download PDFInfo
- Publication number
- CN102200972A CN102200972A CN2010101314169A CN201010131416A CN102200972A CN 102200972 A CN102200972 A CN 102200972A CN 2010101314169 A CN2010101314169 A CN 2010101314169A CN 201010131416 A CN201010131416 A CN 201010131416A CN 102200972 A CN102200972 A CN 102200972A
- Authority
- CN
- China
- Prior art keywords
- data
- tables
- partition
- time interval
- current
- 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
Links
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a database maintenance method and database maintenance equipment. By the technical scheme of the invention, a partition is periodically switched to a backup data table, a query page of a user is divided into two classes of query pages on which recent data having higher query frequency and historical data having lower query frequency are queried by different data tables, the quantity of the recent data is controlled, the data quantity scale for high-frequency query is controlled, the speed and efficiency of data query are improved, and a user experience is improved.
Description
Technical field
The present invention relates to communication technical field, particularly a kind of database maintenance method and apparatus.
Background technology
For a little bigger website of visit capacity, it is quite necessary to separate independent picture servers and page server, for example: can move picture servers with lighttpd (a kind of Germany increase income program), move page server with apache (a kind of web server software), can certainly select other, even, can be extended to a lot of platform picture servers and a lot of platform page server, and associated dns name is set, for example: img.domain.com and www.domain.com, absolute path is all used in picture path in the page, as<img src=" http://img.domain.com/abc.gif "/, DNS (Domain NameSystem, domain name system) repeating query is set then, reaches the load balancing of initial stage.
Certainly, server is many just inevitably to relate to a synchronous problem, and this can use mirror back-up of data instrument (for example, rsync software) to handle.
Database server is the most important thing, because be on one's body database under a lot of situations of the bottleneck problem of website.MySQL database (a kind of small-sized Relational DBMS) is used in general medium and small website more now, but its clustering functionality does not also reach the stage of stable mostly.
Generally speaking, when using the MySQL database, should set up a principal and subordinate (main many from) structure, adopt different data list structures in principal and subordinate's database server, for example: main database server uses the innodb list structure, use the myisam list structure from data server, give full play to advantage separately, and such host-guest architecture separates read-write operation, reduced the pressure of read operation, even can also set one special in the server server that backups, convenient backup.
If not so have only a master server, under the situation of big data quantity, directly the copies data file must stop database service earlier and copy, otherwise backup file can be made mistakes.But for a lot of websites, also be unacceptable even database service has only stopped one second.If had one from database server, in Backup Data, can stop service (slave stop) earlier and back up again, restarting service (slave start) back can be automatically from the master server synchrodata from server, and all do not have influence.But host-guest architecture also has fatal shortcoming, and that is exactly the pressure that host-guest architecture has just reduced read operation, but can not reduce the pressure of write operation.
In order to adapt to bigger scale, may only be left a kind of processing mode: laterally/vertical partition data storehouse.
So-called horizontal partition database, exactly different tables is saved on the different database servers, such as subscriber's meter is kept on the A database server, the article table is kept on the B database server, certainly such cutting apart has cost, and the most basic can't carry out the operation of LEFT JOIN and so on exactly.
So-called vertically partition data storehouse, generally be meant the server that waits the dividing data storage according to user ID (user_id), such as: 5 database servers are arranged, " user_id%5+1 " server that just is saved in No. 1 of equaling 1 so, equal 2 just be saved in 2 good servers, by that analogy, the principle of longitudinal subdivision has a variety of, can select according to circumstances.
But the same with the horizontal partition database, vertically also there is cost in the partition data storehouse, and the most basic is carrying out exactly as COUNT, can bother a lot when SUM etc. gather operation.
In sum, the general scheme of a mixing often according to circumstances of the solution of database server is brought into play the advantage of various schemes with it, sometimes also need be by the third party software of memcached and so on, so that adapt to the requirement of bigger visit capacity.
In realizing process of the present invention, the inventor finds that there is following shortcoming at least in prior art:
Divided data table manual maintenance is got up pretty troublesome, and after layering too much, the process that reads of tables of data can become very complicated, thereby causes readwrite performance not promoted significantly.
Summary of the invention
The invention provides a kind of database maintenance method and apparatus, improve the data query speed in Large Volume Data storehouse, simplify later maintenance and improve user experience.
For achieving the above object, one aspect of the present invention provides a kind of database maintenance method, is applied to comprise in the Database Systems of one or more tables of data, wherein, a described tables of data comprises at least one data partition as current data table memory, said method comprising the steps of:
Pairing time interval of the rise time of recognition data;
With described data storage in the data partition of the pairing described current data table memory of described time interval;
When reaching default creation-time threshold value, in described current data table memory, create new data partition; When at least one data partition in the described current data table memory reaches default deletion time threshold, data storage in the described data partition to the Backup Data table in the corresponding data partition, and is deleted the described data partition that reaches default deletion time threshold.
Preferably, a described tables of data comprises at least one data partition as current data table memory, is specially:
When the tables of data of current existence in the described Database Systems does not comprise data partition, create a new tables of data, and in described tables of data, create the data partition in corresponding different time interval; Or,
When comprising data partition in the tables of data of current existence in the described Database Systems, the described tables of data that comprises data partition is defined as current data table memory, and determines the time interval that described data partition is corresponding different.
Preferably, when the tables of data of current existence in the described Database Systems does not comprise data partition, create a new tables of data, and in described tables of data, create after the data partition in corresponding different time interval, also comprise:
Set enabling the triggered time of described new tables of data, describedly enable the starting point that the triggered time is the pairing time interval of second data partition in the described tables of data;
Enable the triggered time when arriving when described, enable described new tables of data as current data table memory, in first data partition of the data storage in other tables of data to the described current data table memory, and discarded described other tables of data.
Preferably, when at least one data partition in the described current data table memory reaches default deletion time threshold, with the data storage in the described data partition to the Backup Data table in the corresponding data partition, and delete the described data partition that reaches default deletion time threshold, specifically comprise:
When at least one data partition in the described current data table memory reaches default deletion time threshold, judge the current Backup Data table that whether exists, if there is no, then create the Backup Data table, comprise in the described Backup Data table with described current data table memory in the data partition of corresponding identical time interval;
If existing Backup Data table or described Backup Data table to create finishes, then will reach data storage in the data partition of default deletion time threshold in the described current data table memory to the described Backup Data table in the corresponding data partition, and delete the described data partition that reaches default deletion time threshold.
Preferably, also comprise:
When receiving the data query request, discern the pairing time interval of described data query request;
If the pairing time interval of described data query request is contained in the pairing time interval of data partition in the described current data table memory, or described data query request do not carry the time corresponding interval, then the pairing data of the described data query request of inquiry in described current data table memory;
If the pairing time interval of described data query request is contained in the pairing time interval of data partition in the described historical storage tables of data, then in described historical storage tables of data, inquire about the pairing data of described data query request.
Preferably, when the pairing time interval of described data query request is contained in the different tables of data the pairing time interval of data partition, be specially:
By different query link, trigger described data query request.
On the other hand, the present invention also provides a kind of database maintenance equipment, is applied to comprise in the Database Systems of one or more tables of data, and wherein, a described tables of data comprises at least one data partition as current data table memory, specifically comprises:
Module is set, is used for being provided with the pairing time interval of each data partition of current data table memory, and pairing creation-time threshold value of described current data table memory and the pairing deletion time threshold of each data partition;
Identification module is used for the pairing time interval of rise time of recognition data;
Memory module is used for according to described the result that the set time interval of module and described identification module are discerned being set, with described data storage in the data partition of the pairing described current data table memory of described time interval;
Judge module is used to judge whether to reach described set creation-time threshold value of module or the deletion time threshold of being provided with;
Processing module is used for creating new data partition in described current data table memory when described judge module judgement reaches the creation-time threshold value; When described judge module judges that at least one data partition reaches the deletion time threshold in the described current data table memory, data storage in the described data partition to the Backup Data table in the corresponding data partition, and is deleted the described data partition that reaches default deletion time threshold.
Preferably, described identification module also is used for discerning in the tables of data of the current existence of described Database Systems whether comprise data partition,
When the tables of data of discerning current existence in the described Database Systems when described identification module does not comprise data partition, described new tables of data of module creation is set, and in described tables of data, creates the data partition in corresponding different time interval; Or,
When in described identification module is discerned the tables of data of current existence in the described Database Systems, comprising data partition, the described module that is provided with is defined as current data table memory with the described tables of data that comprises data partition, and determines the time interval that described data partition is corresponding different.
Preferably, when the tables of data of discerning current existence in the described Database Systems when described identification module does not comprise data partition, described new tables of data of module creation is set, and in described tables of data, creates after the data partition in corresponding different time interval, also comprise:
Described enabling the triggered time of the described new tables of data of module settings be set, describedly enable the starting point that the triggered time is the pairing time interval of second data partition in the described tables of data;
When described judge module judge described be provided with module set enable the triggered time when arriving, described processing module is enabled described new tables of data as current data table memory, in first data partition of the data storage in other tables of data to the described current data table memory, and discarded described other tables of data.
Preferably, described judge module also is used for further judging the current Backup Data table that whether exists when judging that described at least one data partition of current data table memory reaches default deletion time threshold;
Do not have the Backup Data table if described judge module is judged, then notify the described module creation Backup Data table that is provided with, comprise in the described Backup Data table with described current data table memory in the data partition of corresponding identical time interval;
If judging, described judge module exist Backup Data table or the described module that is provided with the Backup Data table is created to be finished, described processing module will reach data storage in the data partition of default deletion time threshold to the described Backup Data table in the corresponding data partition in the described current data table memory, and deletes the described data partition that reaches default deletion time threshold.
Preferably, also comprise enquiry module, be used for, in tables of data, carry out data query according to the data query request;
Described identification module also is used for when receiving the data query request, discerns the pairing time interval of described data query request;
If described identification module is discerned the pairing time interval of described data query request and is contained in the pairing time interval of data partition in the described current data table memory, or described data query request do not carry the time corresponding interval, and then described enquiry module is inquired about the pairing data of described data query request in described current data table memory;
If described identification module is discerned the pairing time interval of described data query request and is contained in the pairing time interval of data partition in the described historical storage tables of data, then described enquiry module is inquired about the pairing data of described data query request in described historical storage tables of data;
Wherein, when the pairing time interval of described data query request is contained in the different tables of data the pairing time interval of data partition,, trigger described data query request specifically by different query link.
Compared with prior art, the present invention has the following advantages:
By using technical scheme of the present invention, regularly change partitions is to the Backup Data table, user's query page is divided into two classes: the recent data that enquiry frequency is higher are inquired about by different tables of data respectively with the lower historical data of enquiry frequency, and control the data volume of recent data, control high frequency queries at the data volume scale, improve the speed and the efficient of carrying out data query, improve user's experience.
Description of drawings
Fig. 1 is the schematic flow sheet of a kind of database maintenance method proposed by the invention;
Fig. 2 is the schematic flow sheet of a kind of database maintenance method proposed by the invention;
Fig. 3 is the effect synoptic diagram of a kind of database maintenance method under the concrete application scenarios proposed by the invention;
Fig. 4 is the structural representation of a kind of database maintenance equipment proposed by the invention.
Embodiment
The present invention proposes a kind of database maintenance method, be applied to comprise in the Database Systems of one or more tables of data, wherein, a tables of data comprises at least one data partition as current data table memory.
As shown in Figure 1, the schematic flow sheet for a kind of database maintenance method proposed by the invention specifically may further comprise the steps:
Pairing time interval of the rise time of step S101, recognition data.
Before this step is carried out, at first need to carry out the judgement whether current data table memory exists, specifically be divided into following two kinds of situations:
Situation one, when the tables of data of current existence in the Database Systems does not comprise data partition, create a new tables of data, and in tables of data, create the data partition in corresponding different time interval.
Wherein, create a new tables of data, also comprise:
Set enabling the triggered time of new tables of data, enabling the triggered time is the starting point of the pairing time interval of second data partition in the tables of data;
When enabling the triggered time when arriving, enable new tables of data as current data table memory, in first data partition of the data storage in other tables of data to the current data table memory, and discarded other tables of data.
Situation two, when comprising data partition in the tables of data of current existence in the Database Systems, the tables of data that will comprise data partition is defined as current data table memory, and the corresponding different time interval of specified data subregion.
Step S102, with data storage in the data partition of the pairing current data table memory of time interval.
After this step is finished, if continue to receive new data, then return step S101, data storage is carried out in circulation;
When reaching default creation-time threshold value, execution in step S103;
When at least one data partition in the current data table memory reaches default deletion time threshold, execution in step S104.
Step S103, in current data table memory, create new data partition.
After finishing this step, the current data table memory that comprises new data partition is proceeded data storage, returns step S101.
Step S104, with the data storage in the data partition to the Backup Data table in the corresponding data partition, and deletion reaches the data partition of default deletion time threshold.
After finishing this step, current data table memory is proceeded data storage, returns step S101.
In concrete application scenarios, the realization flow of this step specifically comprises:
When at least one data partition in the current data table memory reaches default deletion time threshold, judge the current Backup Data table that whether exists, if there is no, then create the Backup Data table, comprise in the Backup Data table with current data table memory in the data partition of corresponding identical time interval;
If existing Backup Data table or Backup Data table to create finishes, then will reach data storage in the data partition of default deletion time threshold in the current data table memory to the Backup Data table in the corresponding data partition, and deletion reaches the data partition of default deletion time threshold.
After above-mentioned data storage flow process is finished, can further include the data query flow process:
When receiving the data query request, the pairing time interval of recognition data query requests;
If the pairing time interval of data query request is contained in the pairing time interval of data partition in the current data table memory, or the data query request do not carry the time corresponding interval, then the pairing data of data query query requests in current data table memory;
If the pairing time interval of data query request is contained in the pairing time interval of data partition in the historical storage tables of data, pairing data of data query query requests in the historical storage tables of data then.
Wherein, when the pairing time interval of data query request is contained in the different tables of data the pairing time interval of data partition, be specially:
By different query link, the trigger data query requests.
Compared with prior art, the present invention has the following advantages:
By using technical scheme of the present invention, regularly change partitions is to the Backup Data table, user's query page is divided into two classes: the recent data that enquiry frequency is higher are inquired about by different tables of data respectively with the lower historical data of enquiry frequency, and control the data volume of recent data, control high frequency queries at the data volume scale, improve the speed and the efficient of carrying out data query, improve user's experience.
Below, further combined with concrete example, technical scheme of the present invention is described.
It is to be noted, technical scheme proposed by the invention is specially a kind of technical scheme of horizontal partition database, according to the default rule of cutting apart, data table memory is divided into different subregions, and set discarded machine-processed, when reaching corresponding discarded time point, one or more subregions are transferred to the Backup Data table, separately storage.
For convenience of description, specifically paying logical transaction record with wealth is that the example of data is specifically described.
In present concrete application scenarios, wealth is paid logical transaction record every day all with hundreds thousand of speed increment, when reaching up to ten million even during more than one hundred million data, data query speed will be subjected to very big influence, thereby brings very bad user experience.
In order to solve such problem, the present invention proposes following database maintenance method, set up the database of being convenient to inquire about with this, thereby, improve data query speed.
For clearer explanation technical solution of the present invention, at tables of data current in Database Systems subregion whether, be divided into two kinds of situations and describe, concrete schematic flow sheet specifically may further comprise the steps respectively as shown in Figure 2:
If the current tables of data that is used for store transaction logs is a general data table (not being with data partition) in the situation one current database system, t1 by name
Step S201, set up a new tables of data that comprises data partition, wherein, the criteria for classifying of each data partition is specially exchange hour, and this tables of data is defined as t2.
Structure and the t1 of t2 are in full accord.Suppose that the current time is 2009-11-29, the time diacritical point of then setting each data partition of t2 is: 2010-1-1, and 2011-1-1,2012-1-1 promptly has four data subregions among the tables of data t2:
Data before the 2010-1-1 are put into first subregion,
Data between the 2010-1-1 to 2010-12-31 are put into second subregion,
Data between the 2011-1-1 to 2011-12-31 are put into the 3rd subregion,
Data after the 2012-1-1 are all put into the 4th subregion (can also expand later on 2013,2014 or the like).
Need to prove that the quantity of above-mentioned subregion standard and data partition all is a kind of preferred implementation of the present invention, specifically the variation that quantity is set of time diacritical point and the data partition of each data partition can not influence protection scope of the present invention.
Step S202, at 2010-1-1, in the time of 0, discarded tables of data t1 enables tables of data t2, and all data among the tables of data t1 is switched in first subregion of tables of data t2.
In step S201, in fact 0 of 2010-1-1 be enabling the triggered time of tables of data t2, data are before this stored by tables of data t1, only reach 0 of 2010-1-1 enable the triggered time after, tables of data t2 just can be activated, after this, the later data of 2010-1-1 can be inserted corresponding subregion automatically according to exchange hour.
On the other hand, though discarded tables of data t1, but for what save historical data, the data of being preserved among the tables of data t1 still need to store, so, the pairing time interval of each data partition among the contrasting data table t2, first subregion that the data among the tables of data t1 need be switched among the tables of data t2 is stored.
Concrete changing method is not a focus of the present invention, all has the ready-made method can the such operation of very fast realization in SQLServer2005 and Oracle10g, and the variation of concrete changing method can't influence protection scope of the present invention.
In order to realize better inquiring about effect, can on the user inquiring page, add a beginning and ending time section again, be defaulted as nearest one month, thereby, the clearer and more definite pairing time interval of definite query manipulation, thus the inquiry velocity of database is significantly promoted.
In follow-up operating process, at 2011-1-1,0 and 2012-1-1 in the time of 0, enable the 3rd subregion and the 4th subregion carries out data storage in turn.
Step S203, when 2012 arrive, first subregion reaches the deletion time threshold among the tables of data t2, creates Backup Data table t3, and first subregion of tables of data t2 is switched to first subregion of tables of data t3 and first subregion of deleted data table t2.
During 2012, because the data before 3 years are can not be concerned about basically again concerning the user, therefore, can determine random time in 2012,2012-1-1 for example, 0 is the deletion time threshold of first subregion, when arriving this deletion time threshold, build the new tables of data t3 of a band data partition again, as the Backup Data table, structure and t2 are in full accord, first subregion of t2 are switched to first subregion (concrete changing method is not done qualification equally) of t3, t2 only keep second and third, four subregions, i.e. 2010 later data.
That set the default user inquiry on the user inquiring page is t2, if the user need inquire about the data before 3 years, then clicks the link " inquire about data before in 2010 please click here " of appointment on the page, allows user inquiring t3, and concrete design sketch as shown in Figure 3.
Step S204, in Dec, 2012, tables of data t2 reaches the creation-time threshold value, and newly-built the 5th subregion on tables of data t2 (time interval is 2013-1-1 to 2013-12-31) and the 6th subregion (time interval is 2014-1-1 to 2014-12-31) are used to store later data.
In this step, the creation-time threshold value of tables of data t2 is 2012-12-1,0 point.
In the time of 2013, still can second subregion of t2 be switched to second subregion of t3 with the way among the step S203, link among above-mentioned Fig. 3 changes " inquiring about data before in 2011 please click here " into, in the t2 table, only keep 3 nearest subregions in a word, be defaulted as the table of the daily inquiry of user.Older subregion switches in the corresponding subregion of backup sheet t3 year by year, is used for the inquiry of old data.Make that like this inquiry reaches optimization.
It is pointed out that among the tables of data t2 that concrete data partition quantity that keeps and concrete creation-time can adjust according to concrete needs, such variation does not influence protection scope of the present invention.
On the other hand, the data partition among the backup sheet t3 need increase according to the passing of time equally, concrete increase mode can reference data table t2 in the increase mode of data partition, at this repeated description no longer.
If the current tables of data that is used for store transaction logs is the tables of data of band data partition in the situation two current database systems, then can be directly begin to operate, at this repeated description no longer from the step S203 of situation one.
Need further be pointed out that, it is to be that the subregion that unit carries out in the tables of data is divided with the year that above-mentioned technical scheme is described, in the application scenarios of reality, equally can be according to concrete needs, carrying out subregion with the other times interval divides, for example, with day, week, month, free periods such as season, the self-defined cycle that perhaps sets as required, as after March 9 17:00, certainly, too frequent subregion can be given system maintenance for one-period carries out subregion in per 100 hours, and the identification of data storage and inquiry brings more cost input, but it can increase the interval dirigibility of retrieval, therefore, in actual applications, can select the standard of subregion division according to concrete needs.
Simultaneously, the number of partitions of being preserved in each tables of data also can be adjusted as required, when the memory space in the Backup Data table reaches certain threshold value, also can be split as a plurality of Backup Data tables, and such defense belongs to protection scope of the present invention equally.
Compared with prior art, the present invention has the following advantages:
By using technical scheme of the present invention, regularly change partitions is to the Backup Data table, user's query page is divided into two classes: the recent data that enquiry frequency is higher are inquired about by different tables of data respectively with the lower historical data of enquiry frequency, and control the data volume of recent data, control high frequency queries at the data volume scale, improve the speed and the efficient of carrying out data query, improve user's experience.
In order to realize technical scheme of the present invention, the invention allows for a kind of transmission equipment.
As shown in Figure 4, be the structural representation of a kind of database maintenance equipment proposed by the invention, be applied to comprise in the Database Systems of one or more tables of data, wherein, a tables of data comprises at least one data partition as current data table memory, specifically comprises:
Module 41 is set, is used for being provided with the pairing time interval of each data partition of current data table memory, and pairing creation-time threshold value of current data table memory and the pairing deletion time threshold of each data partition;
Identification module 42 is used for the pairing time interval of rise time of recognition data;
Memory module 43 is used for according to the result that set time interval of module 41 and identification module 42 are discerned is set, with data storage in the data partition of the pairing current data table memory of time interval;
Judge module 44 is used to judge whether to reach module 41 set creation-time threshold value or deletion time threshold is set;
Processing module 45 is used for creating new data partition in current data table memory when judge module 44 judgements reach the creation-time threshold value; When judge module 44 judges that at least one data partition reaches the deletion time threshold in the current data table memory, to the Backup Data table in the corresponding data partition, and deletion reaches the data partition of default deletion time threshold with the data storage in the data partition.
In concrete application scenarios, identification module 42 also is used for whether comprising data partition in the tables of data of the current existence of identification database system,
On the one hand, when the tables of data of current existence in the identification module 42 identification database systems does not comprise data partition, module 41 is set creates a new tables of data, and in tables of data, create the data partition in corresponding different time interval.
After this visioning procedure is finished, also comprise:
Module 41 is set sets enabling the triggered time of new tables of data, enabling the triggered time is the starting point of the pairing time interval of second data partition in the tables of data;
When judge module 44 judge be provided with module 41 set enable the triggered time when arriving, processing module 45 is enabled new tables of data as current data table memory, in first data partition of the data storage in other tables of data to the current data table memory, and discarded other tables of data.
On the other hand, when comprising data partition in the tables of data of current existence in the identification module 42 identification database systems, the tables of data that module 41 will comprise data partition is set is defined as current data table memory, and the corresponding different time interval of specified data subregion.
Further, judge module 44 also is used for further judging the current Backup Data table that whether exists when judging that at least one data partition of current data table memory reaches default deletion time threshold;
Do not have the Backup Data table if judge module 44 is judged, then notice is provided with module 41 and creates the Backup Data tables, comprise in the Backup Data table with current data table memory in the data partition of corresponding identical time interval;
If judging to have the Backup Data table or 41 pairs of Backup Data tables establishments of module are set, judge module 44 finishes, processing module 45 will reach data storage in the data partition of default deletion time threshold to the Backup Data table in the corresponding data partition in the current data table memory, and deletion reaches the data partition of default deletion time threshold.
In order to realize the inquiry of data, also comprise enquiry module 46 in the above-mentioned equipment, be used in the tables of data of memory module 43 data of storing, carrying out data query according to the data query request;
Identification module 42 also is used for when receiving the data query request, the pairing time interval of recognition data query requests;
If the pairing time interval of identification module 42 recognition data query requests is contained in the pairing time interval of data partition in the current data table memory, or the data query request do not carry the time corresponding interval, then enquiry module 46 pairing data of data query query requests in current data table memory;
If the pairing time interval of identification module 42 recognition data query requests is contained in the pairing time interval of data partition in the historical storage tables of data, enquiry module 46 pairing data of data query query requests in the historical storage tables of data then;
Wherein, when the pairing time interval of data query request is contained in the different tables of data the pairing time interval of data partition, specifically by different query link, the trigger data query requests.
Compared with prior art, the present invention has the following advantages:
By using technical scheme of the present invention, regularly change partitions is to the Backup Data table, user's query page is divided into two classes: the recent data that enquiry frequency is higher are inquired about by different tables of data respectively with the lower historical data of enquiry frequency, and control the data volume of recent data, control high frequency queries at the data volume scale, improve the speed and the efficient of carrying out data query, improve user's experience.
Through the above description of the embodiments, those skilled in the art can be well understood to the present invention and can realize by hardware, also can realize by the mode that software adds necessary general hardware platform.Based on such understanding, technical scheme of the present invention can embody with the form of software product, it (can be CD-ROM that this software product can be stored in a non-volatile memory medium, USB flash disk, portable hard drive etc.) in, comprise some instructions with so that computer equipment (can be personal computer, server, the perhaps network equipment etc.) each implements the described method of scene to carry out the present invention.
It will be appreciated by those skilled in the art that accompanying drawing is a preferred synoptic diagram of implementing scene, module in the accompanying drawing or flow process might not be that enforcement the present invention is necessary.
It will be appreciated by those skilled in the art that the module in the device of implementing in the scene can be distributed in the device of implementing scene according to implementing scene description, also can carry out respective change and be arranged in the one or more devices that are different from this enforcement scene.The module of above-mentioned enforcement scene can be merged into a module, also can further split into a plurality of submodules.
The invention described above sequence number is not represented the quality of implementing scene just to description.
More than disclosed only be several concrete enforcement scene of the present invention, still, the present invention is not limited thereto, any those skilled in the art can think variation all should fall into protection scope of the present invention.
Claims (11)
1. a database maintenance method is characterized in that, is applied to comprise in the Database Systems of one or more tables of data, and wherein, a described tables of data comprises at least one data partition as current data table memory, said method comprising the steps of:
Pairing time interval of the rise time of recognition data;
With described data storage in the data partition of the pairing described current data table memory of described time interval;
When reaching default creation-time threshold value, in described current data table memory, create new data partition; When at least one data partition in the described current data table memory reaches default deletion time threshold, data storage in the described data partition to the Backup Data table in the corresponding data partition, and is deleted the described data partition that reaches default deletion time threshold.
2. the method for claim 1 is characterized in that, a described tables of data comprises at least one data partition as current data table memory, is specially:
When the tables of data of current existence in the described Database Systems does not comprise data partition, create a new tables of data, and in described tables of data, create the data partition in corresponding different time interval; Or,
When comprising data partition in the tables of data of current existence in the described Database Systems, the described tables of data that comprises data partition is defined as current data table memory, and determines the time interval that described data partition is corresponding different.
3. method as claimed in claim 2, it is characterized in that, when the tables of data of current existence in the described Database Systems does not comprise data partition, create a new tables of data, and in described tables of data, create after the data partition in corresponding different time interval, also comprise:
Set enabling the triggered time of described new tables of data, describedly enable the starting point that the triggered time is the pairing time interval of second data partition in the described tables of data;
Enable the triggered time when arriving when described, enable described new tables of data as current data table memory, in first data partition of the data storage in other tables of data to the described current data table memory, and discarded described other tables of data.
4. the method for claim 1, it is characterized in that, when at least one data partition in the described current data table memory reaches default deletion time threshold, with the data storage in the described data partition to the Backup Data table in the corresponding data partition, and delete the described data partition that reaches default deletion time threshold, specifically comprise:
When at least one data partition in the described current data table memory reaches default deletion time threshold, judge the current Backup Data table that whether exists, if there is no, then create the Backup Data table, comprise in the described Backup Data table with described current data table memory in the data partition of corresponding identical time interval;
If existing Backup Data table or described Backup Data table to create finishes, then will reach data storage in the data partition of default deletion time threshold in the described current data table memory to the described Backup Data table in the corresponding data partition, and delete the described data partition that reaches default deletion time threshold.
5. the method for claim 1 is characterized in that, also comprises:
When receiving the data query request, discern the pairing time interval of described data query request;
If the pairing time interval of described data query request is contained in the pairing time interval of data partition in the described current data table memory, or described data query request do not carry the time corresponding interval, then the pairing data of the described data query request of inquiry in described current data table memory;
If the pairing time interval of described data query request is contained in the pairing time interval of data partition in the described historical storage tables of data, then in described historical storage tables of data, inquire about the pairing data of described data query request.
6. method as claimed in claim 5 is characterized in that, when the pairing time interval of described data query request is contained in the different tables of data the pairing time interval of data partition, is specially:
By different query link, trigger described data query request.
7. a database maintenance equipment is characterized in that, is applied to comprise in the Database Systems of one or more tables of data, and wherein, a described tables of data comprises at least one data partition as current data table memory, specifically comprises:
Module is set, is used for being provided with the pairing time interval of each data partition of current data table memory, and pairing creation-time threshold value of described current data table memory and the pairing deletion time threshold of each data partition;
Identification module is used for the pairing time interval of rise time of recognition data;
Memory module is used for according to described the result that the set time interval of module and described identification module are discerned being set, with described data storage in the data partition of the pairing described current data table memory of described time interval;
Judge module is used to judge whether to reach described set creation-time threshold value of module or the deletion time threshold of being provided with;
Processing module is used for creating new data partition in described current data table memory when described judge module judgement reaches the creation-time threshold value; When described judge module judges that at least one data partition reaches the deletion time threshold in the described current data table memory, data storage in the described data partition to the Backup Data table in the corresponding data partition, and is deleted the described data partition that reaches default deletion time threshold.
8. equipment as claimed in claim 7 is characterized in that, described identification module also is used for discerning in the tables of data of the current existence of described Database Systems whether comprise data partition,
When the tables of data of discerning current existence in the described Database Systems when described identification module does not comprise data partition, described new tables of data of module creation is set, and in described tables of data, creates the data partition in corresponding different time interval; Or,
When in described identification module is discerned the tables of data of current existence in the described Database Systems, comprising data partition, the described module that is provided with is defined as current data table memory with the described tables of data that comprises data partition, and determines the time interval that described data partition is corresponding different.
9. equipment as claimed in claim 8, it is characterized in that, when the tables of data of discerning current existence in the described Database Systems when described identification module does not comprise data partition, the described new tables of data of module creation that is provided with, and in described tables of data, create after the data partition in corresponding different time interval, also comprise:
Described enabling the triggered time of the described new tables of data of module settings be set, describedly enable the starting point that the triggered time is the pairing time interval of second data partition in the described tables of data;
When described judge module judge described be provided with module set enable the triggered time when arriving, described processing module is enabled described new tables of data as current data table memory, in first data partition of the data storage in other tables of data to the described current data table memory, and discarded described other tables of data.
10. equipment as claimed in claim 7 is characterized in that,
Described judge module also is used for further judging the current Backup Data table that whether exists when judging that described at least one data partition of current data table memory reaches default deletion time threshold;
Do not have the Backup Data table if described judge module is judged, then notify the described module creation Backup Data table that is provided with, comprise in the described Backup Data table with described current data table memory in the data partition of corresponding identical time interval;
If judging, described judge module exist Backup Data table or the described module that is provided with the Backup Data table is created to be finished, described processing module will reach data storage in the data partition of default deletion time threshold to the described Backup Data table in the corresponding data partition in the described current data table memory, and deletes the described data partition that reaches default deletion time threshold.
11. equipment as claimed in claim 7 is characterized in that, also comprises enquiry module, is used for according to the data query request, carries out data query in tables of data;
Described identification module also is used for when receiving the data query request, discerns the pairing time interval of described data query request;
If described identification module is discerned the pairing time interval of described data query request and is contained in the pairing time interval of data partition in the described current data table memory, or described data query request do not carry the time corresponding interval, and then described enquiry module is inquired about the pairing data of described data query request in described current data table memory;
If described identification module is discerned the pairing time interval of described data query request and is contained in the pairing time interval of data partition in the described historical storage tables of data, then described enquiry module is inquired about the pairing data of described data query request in described historical storage tables of data;
Wherein, when the pairing time interval of described data query request is contained in the different tables of data the pairing time interval of data partition,, trigger described data query request specifically by different query link.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2010101314169A CN102200972A (en) | 2010-03-24 | 2010-03-24 | Database maintenance method and database maintenance equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2010101314169A CN102200972A (en) | 2010-03-24 | 2010-03-24 | Database maintenance method and database maintenance equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN102200972A true CN102200972A (en) | 2011-09-28 |
Family
ID=44661658
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2010101314169A Pending CN102200972A (en) | 2010-03-24 | 2010-03-24 | Database maintenance method and database maintenance equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102200972A (en) |
Cited By (17)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102385634A (en) * | 2011-12-14 | 2012-03-21 | 苏州阔地网络科技有限公司 | Device for dynamically optimizing data sheets |
CN103544157A (en) * | 2012-07-11 | 2014-01-29 | 阿里巴巴集团控股有限公司 | Data storage method and device |
CN103823812A (en) * | 2012-11-19 | 2014-05-28 | 苏州工业园区新宏博通讯科技有限公司 | System data management method |
CN103838762A (en) * | 2012-11-26 | 2014-06-04 | 中国银联股份有限公司 | Uninterrupted data processing device and method based on data table rotation |
CN104408164A (en) * | 2014-12-05 | 2015-03-11 | 北京国双科技有限公司 | SSAS Tabular based data analyzing and processing method and device |
CN104572936A (en) * | 2014-12-30 | 2015-04-29 | 苏州驰声信息科技有限公司 | Data management method and system for linear dynamic expansion |
CN105045535A (en) * | 2015-07-22 | 2015-11-11 | 北京京东尚科信息技术有限公司 | Method and system for automatically deleting expired data |
CN105279677A (en) * | 2015-10-29 | 2016-01-27 | 江苏惠居乐信息科技有限公司 | Multifunctional online price comparison system |
CN105302896A (en) * | 2015-10-22 | 2016-02-03 | 江苏国泰新点软件有限公司 | Method and apparatus for storing data in electronic bid evaluation system |
CN105677685A (en) * | 2014-11-21 | 2016-06-15 | 中芯国际集成电路制造(天津)有限公司 | Database system and method for saving and querying data in database system |
CN105744508A (en) * | 2016-03-28 | 2016-07-06 | 努比亚技术有限公司 | Game data backup method and mobile terminal |
CN106776249A (en) * | 2016-11-28 | 2017-05-31 | 华迪计算机集团有限公司 | A kind of processing method and system of the business diary for concurrently generating |
CN107436898A (en) * | 2016-05-27 | 2017-12-05 | 北京京东尚科信息技术有限公司 | The method and system for the storehouse data that periodically clear data |
CN107861989A (en) * | 2017-10-17 | 2018-03-30 | 平安科技(深圳)有限公司 | Partitioned storage method, apparatus, computer equipment and the storage medium of data |
CN110019436A (en) * | 2017-07-14 | 2019-07-16 | 北京国双科技有限公司 | Data import deriving method and device, tables of data treating method and apparatus |
CN110413631A (en) * | 2018-04-25 | 2019-11-05 | 中移(苏州)软件技术有限公司 | A kind of data query method and device |
CN111324485A (en) * | 2020-01-20 | 2020-06-23 | 杭州安恒信息技术股份有限公司 | Data information backup method, device, equipment and storage medium of data table |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101086732A (en) * | 2006-06-11 | 2007-12-12 | 上海全成通信技术有限公司 | A high magnitude of data management method |
CN101216821A (en) * | 2007-01-05 | 2008-07-09 | 中兴通讯股份有限公司 | Data acquisition system storage management method |
US20080320244A1 (en) * | 2006-06-14 | 2008-12-25 | International Business Machines Corporation | Moving records between partitions |
CN101533406A (en) * | 2009-04-10 | 2009-09-16 | 北京锐安科技有限公司 | Mass data querying method |
-
2010
- 2010-03-24 CN CN2010101314169A patent/CN102200972A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101086732A (en) * | 2006-06-11 | 2007-12-12 | 上海全成通信技术有限公司 | A high magnitude of data management method |
US20080320244A1 (en) * | 2006-06-14 | 2008-12-25 | International Business Machines Corporation | Moving records between partitions |
CN101216821A (en) * | 2007-01-05 | 2008-07-09 | 中兴通讯股份有限公司 | Data acquisition system storage management method |
CN101533406A (en) * | 2009-04-10 | 2009-09-16 | 北京锐安科技有限公司 | Mass data querying method |
Cited By (26)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102385634A (en) * | 2011-12-14 | 2012-03-21 | 苏州阔地网络科技有限公司 | Device for dynamically optimizing data sheets |
CN103544157B (en) * | 2012-07-11 | 2017-08-15 | 阿里巴巴集团控股有限公司 | The storage method and equipment of a kind of data |
CN103544157A (en) * | 2012-07-11 | 2014-01-29 | 阿里巴巴集团控股有限公司 | Data storage method and device |
CN103823812A (en) * | 2012-11-19 | 2014-05-28 | 苏州工业园区新宏博通讯科技有限公司 | System data management method |
CN103838762A (en) * | 2012-11-26 | 2014-06-04 | 中国银联股份有限公司 | Uninterrupted data processing device and method based on data table rotation |
CN103838762B (en) * | 2012-11-26 | 2017-09-29 | 中国银联股份有限公司 | Uninterrupted data processing unit and method based on tables of data rotation |
CN105677685A (en) * | 2014-11-21 | 2016-06-15 | 中芯国际集成电路制造(天津)有限公司 | Database system and method for saving and querying data in database system |
CN104408164A (en) * | 2014-12-05 | 2015-03-11 | 北京国双科技有限公司 | SSAS Tabular based data analyzing and processing method and device |
CN104408164B (en) * | 2014-12-05 | 2018-05-18 | 北京国双科技有限公司 | Based on SSAS Tabular data analysis processing methods and device |
CN104572936A (en) * | 2014-12-30 | 2015-04-29 | 苏州驰声信息科技有限公司 | Data management method and system for linear dynamic expansion |
CN104572936B (en) * | 2014-12-30 | 2018-07-13 | 苏州驰声信息科技有限公司 | A kind of data managing method and system of linear dynamic extending |
CN105045535A (en) * | 2015-07-22 | 2015-11-11 | 北京京东尚科信息技术有限公司 | Method and system for automatically deleting expired data |
CN105045535B (en) * | 2015-07-22 | 2018-10-02 | 北京京东尚科信息技术有限公司 | A kind of method and system being automatically deleted stale data |
CN105302896A (en) * | 2015-10-22 | 2016-02-03 | 江苏国泰新点软件有限公司 | Method and apparatus for storing data in electronic bid evaluation system |
CN105302896B (en) * | 2015-10-22 | 2018-12-25 | 江苏国泰新点软件有限公司 | Date storage method and device in a kind of electronics bid evaluation system |
CN105279677A (en) * | 2015-10-29 | 2016-01-27 | 江苏惠居乐信息科技有限公司 | Multifunctional online price comparison system |
CN105744508A (en) * | 2016-03-28 | 2016-07-06 | 努比亚技术有限公司 | Game data backup method and mobile terminal |
CN107436898A (en) * | 2016-05-27 | 2017-12-05 | 北京京东尚科信息技术有限公司 | The method and system for the storehouse data that periodically clear data |
CN107436898B (en) * | 2016-05-27 | 2020-06-05 | 北京京东尚科信息技术有限公司 | Method and system for periodically clearing database data and computer readable storage medium |
CN106776249B (en) * | 2016-11-28 | 2020-07-28 | 华迪计算机集团有限公司 | Method and system for processing concurrently generated service logs |
CN106776249A (en) * | 2016-11-28 | 2017-05-31 | 华迪计算机集团有限公司 | A kind of processing method and system of the business diary for concurrently generating |
CN110019436A (en) * | 2017-07-14 | 2019-07-16 | 北京国双科技有限公司 | Data import deriving method and device, tables of data treating method and apparatus |
CN110019436B (en) * | 2017-07-14 | 2021-04-09 | 北京国双科技有限公司 | Data import \ export method and device and data table processing method and device |
CN107861989A (en) * | 2017-10-17 | 2018-03-30 | 平安科技(深圳)有限公司 | Partitioned storage method, apparatus, computer equipment and the storage medium of data |
CN110413631A (en) * | 2018-04-25 | 2019-11-05 | 中移(苏州)软件技术有限公司 | A kind of data query method and device |
CN111324485A (en) * | 2020-01-20 | 2020-06-23 | 杭州安恒信息技术股份有限公司 | Data information backup method, device, equipment and storage medium of data table |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102200972A (en) | Database maintenance method and database maintenance equipment | |
US8949189B2 (en) | Managing storage of individually accessible data units | |
CN105224546B (en) | Data storage and query method and equipment | |
AU2010347763B2 (en) | Managing storage of individually accessible data units | |
CN102739622A (en) | Expandable data storage system | |
CN102932415A (en) | Method and device for storing mirror image document | |
CN103488687A (en) | Searching system and searching method of big data | |
US10866940B2 (en) | Method, apparatus, and computer-readable medium for ingesting semi-structured data in a columnar format | |
CN102725755A (en) | Method and system of file access | |
US11151081B1 (en) | Data tiering service with cold tier indexing | |
CN103440301A (en) | Data multi-duplicate hybrid storage method and system | |
CN110109866B (en) | Method and equipment for managing file system directory | |
US20170270149A1 (en) | Database systems with re-ordered replicas and methods of accessing and backing up databases | |
CN103353901A (en) | Orderly table data management method and system based on Hadoop distributed file system (HDFS) | |
CN103246549A (en) | Method and system for data transfer | |
CN105653697A (en) | Recommended word retrieval method and system | |
US20150169623A1 (en) | Distributed File System, File Access Method and Client Device | |
CN108038253B (en) | Log query processing method and device | |
CN103279489A (en) | Method and device for storing metadata | |
CN105677252B (en) | Read method, data processing method and the associated storage device of data | |
CN107451204B (en) | Data query method, device and equipment | |
CN115599807A (en) | Data access method, device, application server and storage medium | |
CN105512239A (en) | Database data push method and device | |
CN104408084A (en) | Method and device for screening big data | |
CN111221814B (en) | Method, device and equipment for constructing secondary index |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C12 | Rejection of a patent application after its publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20110928 |