CN106202524A - Data base and point meter apparatus and method - Google Patents
Data base and point meter apparatus and method Download PDFInfo
- Publication number
- CN106202524A CN106202524A CN201610585099.5A CN201610585099A CN106202524A CN 106202524 A CN106202524 A CN 106202524A CN 201610585099 A CN201610585099 A CN 201610585099A CN 106202524 A CN106202524 A CN 106202524A
- Authority
- CN
- China
- Prior art keywords
- point
- business
- storage
- user
- amount
- 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
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/2282—Tablespace storage structures; Management thereof
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/28—Databases characterised by their database models, e.g. relational or object models
- G06F16/284—Relational databases
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a kind of data base and point meter apparatus and method, wherein, this point of meter apparatus includes: the first judge module, for when receiving service request, it is judged that whether user corresponding to service request is requested service for the first time;Second judge module, in the case of being first time requested service user, adds one by a point table enumerator by the amount of storage of first point of current table, and judges whether the amount of storage of first point of table reaches default data volume higher limit;Perform module, in the case of reaching data volume higher limit first point of table amount of storage, the business datum of business is saved in the second point of table pre-build by the address of theenduser according to user, by the amount of storage of point second point of table of table counters count, and sets up the 3rd point of table;Wherein, point table name of point table is made up of point table prefix and a point table suffix, and point table prefix of point table that each business is corresponding is identical and point table suffix is different.
Description
Technical field
The present invention relates to communication field, particularly relate to a kind of data base and point meter apparatus and method.
Background technology
MySQL database is existing frequently-used a kind of data storage, but after the data volume of storage reaches some,
The query performance of MySQL, it would appear that degradation, is at this time accomplished by that the big table in data base does data and splits.
Existing point of table method is to split data from business dimension, such as divides table according to ID scope, such as 0~1000
Data at table 1,1001~2000 at table 2, it is also possible to use ID complementation or after carrying out hash algorithm according to ID delivery carry out
Divide table.
But, range divides table to need the size of fixing table data;And use the mode of complementation or hash delivery
Divide table, then initially limit the quantity of point table in exploitation, after data volume continues to increase, it may occur that single table data volume is excessive,
The situation that performance reduces, and there is certain difficulty in the extension to point table.
Existing method when carrying out point table to MySQL database, and point table mode is the most fixing, and motility is relatively low, every kind point
Table mode all exists bigger restricted, and Consumer's Experience is relatively low.
Summary of the invention
Present invention is primarily targeted at a kind of data base of proposition and point meter apparatus and method, it is intended to solve prior art
When MySQL database carries out point table, point table mode is the most fixing, can only be in point table of the fixed number distributed
Carry out the storage of business datum, when the amount of storage of each point of table is bigger, may result in the problem that system queries performance is relatively low.
For achieving the above object, point meter apparatus of a kind of data base that the present invention provides, including: the first judge module, use
In when receiving service request, it is judged that whether user corresponding to described service request is to ask described business for the first time;Second
Judge module, in the case of described user is for the first time to ask described business, by point table enumerator by current the
The amount of storage of one point of table adds one, and judges whether the amount of storage of described first point of table reaches default data volume higher limit;Perform
Module, in the case of described first point of table amount of storage reaches described data volume higher limit, according to the user of described user
The business datum of described business is saved in the second point of table pre-build by address, by described point of table counters count institute
State the amount of storage of second point of table, and set up the 3rd point of table;Wherein, divide point table name of table by point table prefix and point table suffix group
Becoming, point table prefix of point table that each business is corresponding is identical and point table suffix is different.
Optionally, described device also includes: arrange module, for arranging point table that each business is corresponding the most in the buffer
Title, the described data volume higher limit of point table and described point of table enumerator.
Optionally, described execution module, it is additionally operable to reach described data volume higher limit in the amount of storage of described second point of table
In the case of, the business datum of new user is saved in the 3rd point of table pre-build, is united by described point of table enumerator
Counting the amount of storage of described 3rd point of table, and set up the 4th point of table, wherein, described new user is the use asking described business for the first time
Family.
Optionally, described device also includes: search module, and being used for described user is not to ask described business for the first time
In the case of, obtain the address of theenduser of described user, and in point table that described business is corresponding, search industry according to described address of theenduser
The storage position of business data;Described execution module, is additionally operable in the case of finding described storage position, by described business
Business datum is saved in described storage position.
Additionally, for achieving the above object, the present invention also proposes a kind of data base, including: point table dress of above-mentioned data base
Put.
Additionally, for achieving the above object, the present invention also proposes a kind of point table method of data base, and described method includes step
Rapid: when receiving service request, it is judged that whether user corresponding to described service request is to ask described business for the first time;Institute
State user be for the first time ask described business in the case of, the amount of storage of first point of current table is added one, and judges described the
Whether the amount of storage of one point of table reaches default data volume higher limit;Reach in described data volume in described first point of table amount of storage
In the case of limit value, according to the address of theenduser of described user, the business datum of described business is saved in second pre-build
Divide in table, add up the amount of storage of described second point of table, and set up the 3rd point of table;Wherein, divide point table name of table by a point table prefix
With a point table suffix composition, point table prefix of point table that each business is corresponding is identical and point table suffix is different.
Optionally, before receiving service request, also include: point table that each business is corresponding is set the most in the buffer
Title and the described data volume higher limit of point table, and it is set in advance in the amount of storage of statistical table in described caching.
Optionally, point table suffix of above-mentioned point of table name arranges regular as follows: the time of table generation or point table will be divided to generate
Order as described point of table suffix.
Optionally, described method includes: the amount of storage at described second point of table reaches the situation of described data volume higher limit
Under, the business datum of new user is saved in the 3rd point of table pre-build, adds up the amount of storage of described 3rd point of table, and
Setting up the 4th point of table, wherein, described new user is the user asking described business for the first time.
Optionally, it is judged that user corresponding to described service request be whether ask described business for the first time after, also include:
In the case of described user is not to ask described business for the first time, obtain the address of theenduser of described user, and according to described use
Address, family searches the storage position of business datum in point table that described business is corresponding;In the situation finding described storage position
Under, the business datum of described business is saved in described storage position.
The present invention, can be by a point table meter in the case of the user determining transmission business application is to ask this business for the first time
The amount of storage of this point of table added up by number device, and judges amount of storage and the relation of default data volume higher limit, reaches in amount of storage
During data volume higher limit, stored by a well-established new point table, and use new the dividing of point table counters count
Table, should during, the number of point table is not fixing, foundation that can be the most unlimited, and owing to a point table enumerator is
One small routine, therefore, the amount of storage in each point of table also can change, and solves prior art to MySQL data
When storehouse carries out point table, point table mode is the most fixing, can only carry out business datum in point table of the fixed number distributed
Storage, when the amount of storage of each point of table is bigger, may result in the problem that system queries performance is relatively low.
Accompanying drawing explanation
Fig. 1 is the structural representation of point meter apparatus of the data base of first embodiment of the invention;
Fig. 2 is the structural representation of point meter apparatus of the data base of second embodiment of the invention;
Fig. 3 is the flow chart of point table method of the data base of fourth embodiment of the invention.
The realization of the object of the invention, functional characteristics and advantage will in conjunction with the embodiments, are described further referring to the drawings.
Detailed description of the invention
Should be appreciated that specific embodiment described herein, only in order to explain the present invention, is not intended to limit the present invention.
First embodiment of the invention proposes point meter apparatus of a kind of data base, and the structural representation of this device is as it is shown in figure 1, wrap
Include:
First judge module 10, for when receiving service request, it is judged that whether user corresponding to service request is the
Requested service;
Second judge module 11, in the case of being first time requested service user, ought by a point table enumerator
The amount of storage of first point of front table adds one, and judges whether the amount of storage of first point of table reaches default data volume higher limit;
Perform module 12, in the case of first point of table amount of storage reaches data volume higher limit, according to the use of user
The business datum of business is saved in the second point of table pre-build by address, family, by point second point of table of table counters count
Amount of storage, and set up the 3rd point of table;
Wherein, point table name of point table is made up of point table prefix and a point table suffix, point table of point table that each business is corresponding
Prefix is identical and point table suffix is different.
When realizing, the first judge module 10, when receiving service request, needs the user sending this service request
Carry out a judgement, i.e. judge whether this user is to ask this business for the first time.If user is to ask this business for the first time, say
Bright its before and has the information of user in any point of table that this business is corresponding, it is now desired to set up the letter that this user is corresponding
Breath.But, the business datum storing this user in which point table is a problem, and therefore, the embodiment of the present invention have employed point
Table enumerator solves this problem.
Dividing table enumerator can realize with a little program when realizing, it is exactly the process of a cycle count,
I.e. in each point of table, start counting up from 0, whenever having a new user, just in point table enumerator, add one, this point of table meter
The quantity of number device statistics is exactly the amount of storage of current first point of table storage data, owing to a point table enumerator is a single little Cheng
Sequence, therefore, its built-in amount of storage simple according to user's request just can complete amendment.It practice, storage number
Adding up according to according to ID (address), therefore, judge in above process is also whether user is request for the first time
This business, and when request for the first time, just added up by a point table enumerator.
Second judge module 11 is in the case of user is to ask this business for the first time, it is judged that point table counting after adding
Whether the quantity of device exceedes default data volume higher limit.
In the case of the quantity of the execution module 12 point table enumerator after adding exceedes default data volume higher limit,
Determine that first point of table amount of storage reaches the upper limit, at this time, it may be necessary to business datum corresponding for this user to be stored in another second point
In table.
The embodiment of the present invention is in order to ensure the most not affect new business number after current first point of table amount of storage reaches the upper limit
According to storage, therefore, second point of table the most just establishes, when implementing, if first point of table to be this business corresponding
First initial point table, then second point of table can be the most also to be established setting up first point of table when, if first
Point table is not initially to divide table, but point table initially set up again after point table, then second point of table can be that first point of table has just enter into and make
Set up while with.
Execution module 12, when the business datum of new user being stored, does not knows simple at will second point of table of input
In, but need by ID, i.e. according to ID business datum corresponding for this business is saved in and to pre-build
In second point of table, in order to when this user follow-up applies for same business again as old user, second point of table can be stored it in
The position of middle correspondence.
Now, the data of first point of table storage expire, and this business datum is stored in second point of table by, due to the
Two points of tables begin to use, and point table enumerator starts statistics from 0 the most again, but owing to now having determined to above-mentioned business datum
Store in second point of table, therefore, now a point table enumerator is added one, then in judging this business datum is saved in second point of table be
No meeting makes the amount of storage of second point of table reach second point of data volume higher limit corresponding to table.
After statistics, when confirming the data volume higher limit that the amount of storage of second point of table is not up to its correspondence, by this business
Data are stored in second point of table.Certainly, if the storage simply in a point of table, only judge the most whether exceed this point of table pair
The data volume higher limit answered, but the process related to due to the present embodiment is that a point of table has been expired, needed to be stored in another point
The situation of table, therefore, the embodiment of the present invention considers from system preciseness, preferably allows a point table enumerator carry out twice judgement, i.e.
After first point of table judges, it is also carried out once judging in second point of table.Certainly, when implementing, due to first part of table
Full, second point of table is again empty, then can be omitted in second point of table the first time judge process of point table enumerator, the most directly will
Business datum is stored in second point of table, and adds one to a point table enumerator.
When there being next new user also to store business datum corresponding to this business, it should be stored in second point of table
In, now, just need a point table enumerator first to add one, judge the relation of the quantity after adding one and data volume higher limit the most again.
Confirm enable second point of table time or business datum is being stored to second point of table, at once set up the 3rd point of table,
So that when second point of table amount of storage reaches data volume higher limit, can there be next point of table storage service data in time.
Therefore, module 12 is performed, it is also possible in the case of the amount of storage of second point of table reaches data volume higher limit, will be new
The business datum of user is saved in the 3rd point of table pre-build, by the storage of point the 3rd point of table of table counters count
Amount, and set up the 4th point of table.
For above-mentioned point of table, each point of table corresponding to each business is required for different names, but, owing to being
Each point of table of identical services, name again can not be entirely different, so, a point table name for point table is set to by the embodiment of the present invention
Being made up of point table prefix and a point table suffix, and when arranging, point table prefix of point table that each business is corresponding is identical and after point table
Sew difference.Dividing table prefix identical is to determine it is which business, and it is that this business is corresponding that a point table suffix is not both to distinguish
Different points of tables, but, a point table suffix can not be the most unordered, and it is permissible that above-mentioned point of table suffix of the embodiment of the present invention arranges rule
As follows, time that table generates or the order that point table generates will be divided as a point table suffix.Such as, if by a point order for table generation
As a point table suffix, then point table name can be " point table prefix _ 1, point table prefix _ 2, point table prefix _ 3 ... ".
During said method realizes, each of which point of table storage is full, just reopens a next point table and carries out
Storage, therefore, the embodiment of the present invention divides the process of setting up of table to be that storage limit, limit is set up, and the most just establishes in prior art
The process of how many point tables is diverse.
The embodiment of the present invention, in the case of the user determining transmission business application is to ask this business for the first time, can be passed through
Divide table enumerator to add up the amount of storage of this point of table, and judge amount of storage and the relation of default data volume higher limit, in storage
When amount reaches data volume higher limit, stored by a well-established new point table, and use a point table counters count
New point table, should during, the number of point table is not fixing, foundation that can be the most unlimited, and due to a point table meter
Number device is a small routine, and therefore, the amount of storage in each point of table also can change, and solves prior art to data
When storehouse carries out point table, point table mode is the most fixing, can only carry out business datum in point table of the fixed number distributed
Storage, when the amount of storage of each point of table is bigger, may result in the problem that system queries performance is relatively low.
Second embodiment of the invention provides point meter apparatus of a kind of data base, and the structural representation of this device is as in figure 2 it is shown, wrap
Include:
Module 20 is set, for arranging point table name corresponding to each business, the data volume of point table the most in the buffer
Limit value and point table enumerator.
First judge module 21, for when receiving service request, it is judged that whether user corresponding to service request is the
Requested service;
Second judge module 22, in the case of being first time requested service user, ought by a point table enumerator
The amount of storage of first point of front table adds one, and judges whether the amount of storage of first point of table reaches default data volume higher limit;
Perform module 23, in the case of first point of table amount of storage reaches data volume higher limit, according to the use of user
The business datum of business is saved in the second point of table pre-build by address, family, by point second point of table of table counters count
Amount of storage, and set up the 3rd point of table;
Wherein, point table name of point table is made up of point table prefix and a point table suffix, point table of point table that each business is corresponding
Prefix is identical and point table suffix is different.
When realizing, the embodiment of the present invention first passes through and arranges module 20 to arrange each business the most in the buffer corresponding
Dividing table name, the data volume higher limit of point table and point table enumerator, this process is exactly a process pre-set.Arranging
Time, caching can be the caching within server system, it is of course also possible to be third party's caching system, such as, Redis caches.
Point table name can be realized by a little program, certainly, due to a point table name be by point table prefix and point
Table suffix composition, and a point table prefix corresponding to each business be not changed in, and a point table suffix changes, because of
This, it is also possible to the setting of above-mentioned point of table name is realized by two small routines.
The data volume higher limit and point table enumerator that divide table can be realized by small routine when arranging, and then arrange
In the buffer, owing to being provided in caching, revising more convenient, if needing to revise data volume higher limit, directly amendment is little
Code in program just can adjust the capacity of each point of table easily.
When realizing, the first judge module 21, when receiving service request, needs the user sending this service request
Carry out a judgement, i.e. judge whether this user is to ask this business for the first time.If user is to ask this business for the first time, say
Bright its before and has the information of user in any point of table that this business is corresponding, it is now desired to set up the letter that this user is corresponding
Breath.But, the business datum storing this user in which point table is a problem, and therefore, the embodiment of the present invention have employed point
Table enumerator solves this problem.
For a point table enumerator, it is exactly the process of a cycle count, i.e. in each point of table, starts counting up from 0,
Whenever having a new user, just adding one in point table enumerator, the quantity of this point of table counters count is exactly current first point
The amount of storage of table storage data, owing to a point table enumerator is a single small routine, therefore, its built-in amount of storage is permissible
Amendment the most just can be completed according to user's request.It practice, storage data are added up according to ID (address),
Therefore, judge in above process is also whether user is this business of asking for the first time, and when first time request, just passes through
Table enumerator is divided to add up.
Second judge module 22 is in the case of user is to ask this business for the first time, it is judged that point table counting after adding
Whether the quantity of device exceedes default data volume higher limit.
In the case of the quantity of the execution module 23 point table enumerator after adding exceedes default data volume higher limit,
Determine that first point of table amount of storage reaches the upper limit, at this time, it may be necessary to business datum corresponding for this user to be stored in another second point
In table.
The embodiment of the present invention is in order to ensure the most not affect new business number after current first point of table amount of storage reaches the upper limit
According to storage, therefore, second point of table the most just establishes, when implementing, if first point of table to be this business corresponding
First initial point table, then second point of table can be the most also to be established setting up first point of table when, if first
Point table is not initially to divide table, but point table initially set up again after point table, then second point of table can be that first point of table has just enter into and make
Set up while with.
Execution module 23, when the business datum of new user being stored, does not knows simple at will second point of table of input
In, but need by ID, i.e. according to ID business datum corresponding for this business is saved in and to pre-build
In second point of table, in order to when this user follow-up applies for same business again as old user, second point of table can be stored it in
The position of middle correspondence.
Now, the data of first point of table storage expire, and this business datum is stored in second point of table by, due to the
Two points of tables begin to use, and point table enumerator starts statistics from 0 the most again, but owing to now having determined to above-mentioned business datum
Store in second point of table, therefore, now a point table enumerator is added one, then in judging this business datum is saved in second point of table be
No meeting makes the amount of storage of second point of table reach second point of data volume higher limit corresponding to table.
After statistics, when confirming the data volume higher limit that the amount of storage of second point of table is not up to its correspondence, by this business
Data are stored in second point of table.Certainly, if the storage simply in a point of table, only judge the most whether exceed this point of table pair
The data volume higher limit answered, but the process related to due to the present embodiment is that a point of table has been expired, needed to be stored in another point
The situation of table, therefore, the embodiment of the present invention considers from system preciseness, preferably allows a point table enumerator carry out twice judgement, i.e.
After first point of table judges, it is also carried out once judging in second point of table.Certainly, when implementing, due to first part of table
Full, second point of table is again empty, then can be omitted in second point of table the first time judge process of point table enumerator, the most directly will
Business datum is stored in second point of table, and adds one to a point table enumerator.
When there being next new user also to store business datum corresponding to this business, it should be stored in second point of table
In, now, just need a point table enumerator first to add one, judge the relation of the quantity after adding one and data volume higher limit the most again.
Confirm enable second point of table time or business datum is being stored to second point of table, at once set up the 3rd point of table,
So that when second point of table amount of storage reaches data volume higher limit, can there be next point of table storage service data in time.
Therefore, module 23 is performed, it is also possible in the case of the amount of storage of second point of table reaches data volume higher limit, will be new
The business datum of user is saved in the 3rd point of table pre-build, by the storage of point the 3rd point of table of table counters count
Amount, and set up the 4th point of table.
For above-mentioned point of table, each point of table corresponding to each business is required for different names, but, owing to being
Each point of table of identical services, name again can not be entirely different, so, a point table name for point table is set to by the embodiment of the present invention
Being made up of point table prefix and a point table suffix, and when arranging, point table prefix of point table that each business is corresponding is identical and after point table
Sew difference.Dividing table prefix identical is to determine it is which business, and it is that this business is corresponding that a point table suffix is not both to distinguish
Different points of tables, but, a point table suffix can not be the most unordered, and it is permissible that above-mentioned point of table suffix of the embodiment of the present invention arranges rule
As follows, time that table generates or the order that point table generates will be divided as a point table suffix.Such as, if by a point time for table generation
As a point table suffix, then point table name can be " point table prefix _ 10:30, point table prefix _ 11:15, point table prefix _ 12:
22、……”。
During said method realizes, each of which point of table storage is full, just reopens a next point table and carries out
Storage, therefore, the embodiment of the present invention divides the process of setting up of table to be that storage limit, limit is set up, and the most just establishes in prior art
The process of how many point tables is diverse.
When implementing, said apparatus can also include searching module, is not the situation of requested service for the first time user
Under, obtain the address of theenduser of user, and in point table that business is corresponding, search the storage position of business datum according to address of theenduser;
Then perform module 23, be additionally operable to, in the case of finding storage position, the business datum of business be saved in storage position.
The embodiment of the present invention, by needing the parameter adjusted to be configured in the buffer, facilitates subsequent modification to adjust, is determining
The user of transmission business application be for the first time ask this business in the case of, depositing of this point of table can be added up by a point table enumerator
Reserves, and judge the relation of amount of storage and the data volume higher limit preset, when amount of storage reaches data volume higher limit, by one
An individual well-established newly point table stores, and uses point table that point table counters count is new, during being somebody's turn to do, the number of point table
It not fixing, foundation that can be the most unlimited, and owing to a point table enumerator is a small routine, therefore, Mei Gefen
Amount of storage in table also can change, and Consumer's Experience is higher.
Third embodiment of the invention provides a kind of data base, and this data base includes the data base of statement in the second embodiment
Point meter apparatus.When arranging, point meter apparatus of data base can be integrated in data base.
Divide each business of meter apparatus corresponding point table name, the data volume higher limit of point table and point table for data base
The setting of enumerator, may be located in the caching that data base is corresponding, it is of course also possible to be arranged on third party's caching system
In, such as Redis caches.For data base, it can be MySQL database, about data base point meter apparatus structure this
Place repeats no more.
Fourth embodiment of the invention provides a kind of point table method of data base, and the flow process of the method such as Fig. 3, including step
S302 to S306:
S302, when receiving service request, it is judged that whether user corresponding to service request is requested service for the first time;
S304, in the case of user is first time requested service, adds one by the amount of storage of first point of current table, and sentences
Whether the amount of storage of disconnected first point of table reaches default data volume higher limit;
S306, in the case of first point of table amount of storage reaches data volume higher limit, according to the address of theenduser of user by industry
The business datum of business is saved in the second point of table pre-build, the amount of storage of second point of table of statistics, and sets up the 3rd point of table;
Wherein, point table name of point table is made up of point table prefix and a point table suffix, point table of point table that each business is corresponding
Prefix is identical and point table suffix is different.
When realizing, when receiving service request, the user to sending this service request is needed to carry out a judgement, i.e.
Judge whether this user is to ask this business for the first time.If user is to ask this business for the first time, do not have before it is described
The information of user is had, it is now desired to set up the information that this user is corresponding in any point of table that this business is corresponding.But, at which
Dividing the business datum storing this user in table is a problem, and therefore, the embodiment of the present invention is by adding up current first point of table
Amount of storage solves this problem, when implementing, can be to use a point table enumerator to realize.
Dividing table enumerator can realize with a little program when realizing, it is exactly the process of a cycle count,
I.e. in each point of table, start counting up from 0, whenever having a new user, just in point table enumerator, add one, this point of table meter
The quantity of number device statistics is exactly the amount of storage of current first point of table storage data, owing to a point table enumerator is a single little Cheng
Sequence, therefore, its built-in amount of storage simple according to user's request just can complete amendment.It practice, storage number
Adding up according to according to ID (address), therefore, judge in above process is also whether user is request for the first time
This business, and when request for the first time, just added up by a point table enumerator.
In the case of user is to ask this business for the first time, it is judged that whether the quantity of point table enumerator after adding surpasses
Cross the data volume higher limit preset.
In the case of the quantity of point table enumerator after adding exceedes default data volume higher limit, determine first point
Table amount of storage reaches the upper limit, at this time, it may be necessary to business datum corresponding for this user be stored in another second point of table.
The embodiment of the present invention is in order to ensure the most not affect new business number after current first point of table amount of storage reaches the upper limit
According to storage, therefore, second point of table the most just establishes, when implementing, if first point of table to be this business corresponding
First initial point table, then second point of table can be the most also to be established setting up first point of table when, if first
Point table is not initially to divide table, but point table initially set up again after point table, then second point of table can be that first point of table has just enter into and make
Set up while with.
When the business datum of new user is stored, do not know in second point of table of simple at will input, but need
By ID, i.e. according to ID, business datum corresponding for this business is saved in the second point of table pre-build,
During so that this user follow-up applies for same business again as old user, position corresponding in second point of table can be stored it in
Put.
Now, the data of first point of table storage expire, and this business datum is stored in second point of table by, due to the
Two points of tables begin to use, and point table enumerator starts statistics from 0 the most again, but owing to now having determined to above-mentioned business datum
Store in second point of table, therefore, now a point table enumerator is added one, then in judging this business datum is saved in second point of table be
No meeting makes the amount of storage of second point of table reach second point of data volume higher limit corresponding to table.
After statistics, when confirming the data volume higher limit that the amount of storage of second point of table is not up to its correspondence, by this business
Data are stored in second point of table.Certainly, if the storage simply in a point of table, only judge the most whether exceed this point of table pair
The data volume higher limit answered, but the process related to due to the present embodiment is that a point of table has been expired, needed to be stored in another point
The situation of table, therefore, the embodiment of the present invention considers from system preciseness, preferably allows a point table enumerator carry out twice judgement, i.e.
After first point of table judges, it is also carried out once judging in second point of table.Certainly, when implementing, due to first part of table
Full, second point of table is again empty, then can be omitted in second point of table the first time judge process of point table enumerator, the most directly will
Business datum is stored in second point of table, and adds one to a point table enumerator.
When there being next new user also to store business datum corresponding to this business, it should be stored in second point of table
In, now, just need a point table enumerator first to add one, judge the relation of the quantity after adding one and data volume higher limit the most again.
Confirm enable second point of table time or business datum is being stored to second point of table, at once set up the 3rd point of table,
So that when second point of table amount of storage reaches data volume higher limit, can there be next point of table storage service data in time.
And hence it is also possible in the case of the amount of storage of second point of table reaches data volume higher limit, by the business of new user
Data are saved in the 3rd point of table pre-build, by the amount of storage of point the 3rd point of table of table counters count, and set up the
Four points of tables.
For above-mentioned point of table, each point of table corresponding to each business is required for different names, but, owing to being
Each point of table of identical services, name again can not be entirely different, so, a point table name for point table is set to by the embodiment of the present invention
Being made up of point table prefix and a point table suffix, and when arranging, point table prefix of point table that each business is corresponding is identical and after point table
Sew difference.Dividing table prefix identical is to determine it is which business, and it is that this business is corresponding that a point table suffix is not both to distinguish
Different points of tables, but, a point table suffix can not be the most unordered, and it is permissible that above-mentioned point of table suffix of the embodiment of the present invention arranges rule
As follows, time that table generates or the order that point table generates will be divided as a point table suffix.Such as, if by a point order for table generation
As a point table suffix, then point table name can be " point table prefix _ 1, point table prefix _ 2, point table prefix _ 3 ... ".
During said method realizes, each of which point of table storage is full, just reopens a next point table and carries out
Storage, therefore, the embodiment of the present invention divides the process of setting up of table to be that storage limit, limit is set up, and the most just establishes in prior art
The process of how many point tables is diverse.
When implementing, before receiving service request, also include:
Point table name corresponding to each business and the data volume higher limit of point table are set the most in the buffer, and pre-set
The amount of storage of statistical table in the buffer.
When realizing, the embodiment of the present invention first arranges point table name corresponding to each business the most in the buffer, divides
The data volume higher limit of table and point table enumerator, this process is exactly a process pre-set.When arranging, caching can be
Caching within server system, it is of course also possible to be third party's caching system, such as, Redis caches.
Point table name can be realized by a little program, certainly, due to a point table name be by point table prefix and point
Table suffix composition, and a point table prefix corresponding to each business be not changed in, and a point table suffix changes, because of
This, it is also possible to the setting of above-mentioned point of table name is realized by two small routines.
The data volume higher limit and point table enumerator that divide table can be realized by small routine when arranging, and then arrange
In the buffer, owing to being provided in caching, revising more convenient, if needing to revise data volume higher limit, directly amendment is little
Code in program just can adjust the capacity of each point of table easily.
Fifth embodiment of the invention provides a kind of point table method of data base, and the method can use in cloud service project
In MySQL database, have as follows:
Cloud service project uses userId (ID) as a point table service fields, i.e. according to userId, data are carried out
Divide table.The present embodiment understands for convenience, just uses userId to explain, in sundry item, according to customer parameter
Different, it is possible to use other customer parameter, point table can be replaced according to field according to corresponding business.
First, arranging user's allocation list, this form is provided in data base side, and its explanation of field is as shown in table 1.
Table 1
Field name | Field type | DEFAULT constraint | Remarks explanation |
id | int(11) | Not null Auto_increment | No. Id, self-propagation |
type | int(11) | Not null | Type of service |
table_header | Varchar(50) | Not null | Table name starts |
table_size | Int(11) | Not null | Divide table size |
In table 1 above, it is provided that user can configure the size (amount of storage) of point table, type of service, point table name
Point table prefix etc., multiple services point of table can be supported.During after above-mentioned setting option, extended meeting is loaded into point table allocating cache.
Secondly, in Redis caches (third-party a set of caching system) arrange a point table allocating cache, point table enumerator and
Divide table id caching.
Wherein, point table allocating cache is the configuration data for caching point table, can be obtained by the loading of user's allocation list
Taking related data, it is arranged as shown in table 2.
Table 2
The effect duration of this caching could be arranged to 12 months;After starting server, can be the completeest in back-stage management flush buffers
The loading of component list allocating cache;After Key (ID, key assignments) lost efficacy, reload caching from data base, configure with complete component list
The abnormality processing of caching;When implementing, it is to determine value according to key and filed in table 2.
Wherein, a point table enumerator is used for recording each type and divides table to Add User quantity, the type of service that Adds User data
Rear flush buffers effect duration, when reaching point limits table, starting counting up from 1, its explanation of field is as shown in table 3.
Table 3
Field name | Remarks explanation |
key | Using TABLE_COUNT as KEY value |
filed | Type, type of service |
value | Store the userid data volume in up-to-date point of table of this type |
Caching effect duration could be arranged to 6 months;After starting server, can revise in back-stage management flush buffers every time
After data, flush buffers effect duration;After Key lost efficacy, reload caching from data base, to complete to cache abnormality processing.
Wherein, point table id caching, for recording point table id that each type divides the current record data of table to be used, is i.e. remembered
Which point table record is currently, and its explanation of field is as shown in table 4.
Table 4
Its effect duration could be arranged to 12 months;After starting server, number can be revised in back-stage management flush buffers every time
According to rear, flush buffers effect duration;After Key lost efficacy, reload caching from data base, to complete to cache abnormality processing.
When a point table enumerator reaches the full quota, carry out newly-increased point of table handling, and refresh point table id caching and an effect duration.This reality
Execute example employing and build table principle in advance, i.e. pre-build that the next one of currently used table divides table.As: currently used point of table id is 5, then
Point table id be 6 point table well-established, when a point table enumerator reaches the full quota, set up a point table 7, data then insert point table 6, with guarantor
Barrier data are inserted and are unaffected.
Implement flow process as follows:
Arranging concrete point of table table name and point table size according to different service types, userId judges for point table, i.e. this point table
Open ended userId quantity;And in redis caches, add a point table enumerator.
During write data, for some business, if new user, go point table enumerator to judge, add one,
Value after will adding one compares with a point limits table, divides limits table if more than, will point to next point of table, is specifically directed towards
Which table, is determined by a point table id caching, a point table id adds one.
For some business, if old user, there is business A, then had a fixing point table to deposit this business.According to
Family ID and traffic ID find the storage position in point table, and then continue storage.
Such as, type of service is for synchronizing contact person, and user A is the new user of this business, and user B is the old use of this business
Family, as follows for user A and its operating process of user B:
User A: when synchronizing contact person, goes point table enumerator to judge, adds one by a point table enumerator, the value after will adding one and
Point limits table compares, and divides limits table if more than, will point to next point of table, and the associated person information that will synchronize is deposited
Storage is in the next one divides table, and without exceeding a point limits table, then in current point of table, storage needs the associated person information synchronized.
User B: search its storage position according in each point of table under synchronizing contact person's business of the userId of user, and
After finding, its associated person information is stored under the position that point table found is corresponding.
Embodiment of the present invention flexibly configurable divides table size;Divide table endless number system, there is not a point table scaling problem;At list
After table is excessive, also data base can be divided again table;After Data Migration to new point table, amendment point table id caching, will point
Table id caching respective value increases, and can again split single table, easily extend, not interfere with point table handling of follow-up data.
It should be noted that in this article, term " includes ", " comprising " or its any other variant are intended to non-row
Comprising of his property, so that include that the process of a series of key element, method, article or device not only include those key elements, and
And also include other key elements being not expressly set out, or also include intrinsic for this process, method, article or device
Key element.In the case of there is no more restriction, statement " including ... " key element limited, it is not excluded that including this
The process of key element, method, article or device there is also other identical element.
The invention described above embodiment sequence number, just to describing, does not represent the quality of embodiment.
Through the above description of the embodiments, those skilled in the art is it can be understood that arrive above-described embodiment side
Method can add the mode of required general hardware platform by software and realize, naturally it is also possible to by hardware, but a lot of in the case of
The former is more preferably embodiment.Based on such understanding, prior art is done by technical scheme the most in other words
The part going out contribution can embody with the form of software product, and this computer software product is stored in a storage medium
In (such as ROM/RAM, magnetic disc, CD), including some instructions with so that a station terminal equipment (can be mobile phone, computer, take
Business device, air-conditioner is, or the network equipment etc.) method that performs each embodiment of the present invention.
These are only the preferred embodiments of the present invention, not thereby limit the scope of the claims of the present invention, every utilize this
Equivalent structure or equivalence flow process that bright description and accompanying drawing content are made convert, or are directly or indirectly used in other relevant skills
Art field, is the most in like manner included in the scope of patent protection of the present invention.
Claims (10)
1. point meter apparatus of a data base, it is characterised in that including:
First judge module, for when receiving service request, it is judged that whether user corresponding to described service request is first
The described business of secondary request;
Second judge module, is used in the case of described user is to ask described business for the first time, will by point table enumerator
The amount of storage of first point of current table adds one, and judges whether the amount of storage of described first point of table reaches the default data volume upper limit
Value;
Perform module, in the case of described first point of table amount of storage reaches described data volume higher limit, according to described use
The business datum of described business is saved in the second point of table pre-build by the address of theenduser at family, is counted by described point of table
The amount of storage of described second point of table added up by device, and sets up the 3rd point of table;
Wherein, point table name of point table is made up of point table prefix and a point table suffix, point table prefix of point table that each business is corresponding
Identical and point table suffix different.
2. as claimed in claim 1 point of meter apparatus, it is characterised in that described device also includes:
Module is set, for arranging point table name corresponding to each business, the described data volume upper limit of point table the most in the buffer
Value and described point of table enumerator.
3. as claimed in claim 1 or 2 point of meter apparatus, it is characterised in that
Described execution module, is additionally operable in the case of the amount of storage of described second point of table reaches described data volume higher limit, will
The business datum of new user is saved in the 3rd point of table pre-build, by described in described point of table counters count the 3rd point
The amount of storage of table, and set up the 4th point of table, wherein, described new user is the user asking described business for the first time.
4. as claimed in claim 1 or 2 point of meter apparatus, it is characterised in that described device also includes:
Search module, for, in the case of described user is not to ask described business for the first time, obtaining the user of described user
Address, and in point table that described business is corresponding, the storage position of business datum is searched according to described address of theenduser;
Described execution module, is additionally operable in the case of finding described storage position, the business datum of described business is preserved
In described storage position.
5. a data base, it is characterised in that including: point meter apparatus of the data base according to any one of Claims 1-4.
6. point table method of a data base, it is characterised in that described method includes step:
When receiving service request, it is judged that whether user corresponding to described service request is to ask described business for the first time;
In the case of described user is to ask described business for the first time, the amount of storage of first point of current table is added one, and sentences
Whether the amount of storage of disconnected described first point of table reaches default data volume higher limit;
In the case of described first point of table amount of storage reaches described data volume higher limit, the address of theenduser according to described user will
The business datum of described business is saved in the second point of table pre-build, adds up the amount of storage of described second point of table, and builds
Vertical 3rd point of table;
Wherein, point table name of point table is made up of point table prefix and a point table suffix, point table prefix of point table that each business is corresponding
Identical and point table suffix different.
7. as claimed in claim 6 point of table method, it is characterised in that before receiving service request, also include:
Point table name corresponding to each business and the described data volume higher limit of point table are set the most in the buffer, and pre-set
The amount of storage of statistical table in described caching.
8. as claimed in claim 6 point of table method, it is characterised in that a point table suffix for above-mentioned point of table name arranges rule such as
Under: the order that the time generated by point table or point table generate is as described point of table suffix.
9. point table method as according to any one of claim 6 to 8, it is characterised in that described method includes:
In the case of the amount of storage of described second point of table reaches described data volume higher limit, the business datum of new user is preserved
In the 3rd point of table pre-build, add up the amount of storage of described 3rd point of table, and set up the 4th point of table, wherein, described newly
User is for asking the user of described business for the first time.
10. point table method as according to any one of claim 6 to 8, it is characterised in that judge that described service request is corresponding
User be whether ask described business for the first time after, also include:
In the case of described user is not to ask described business for the first time, obtain the address of theenduser of described user, and according to institute
State address of theenduser in point table that described business is corresponding, search the storage position of business datum;
In the case of finding described storage position, the business datum of described business is saved in described storage position.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610585099.5A CN106202524A (en) | 2016-07-22 | 2016-07-22 | Data base and point meter apparatus and method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610585099.5A CN106202524A (en) | 2016-07-22 | 2016-07-22 | Data base and point meter apparatus and method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106202524A true CN106202524A (en) | 2016-12-07 |
Family
ID=57491407
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610585099.5A Pending CN106202524A (en) | 2016-07-22 | 2016-07-22 | Data base and point meter apparatus and method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106202524A (en) |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107766459A (en) * | 2017-09-27 | 2018-03-06 | 天翼电子商务有限公司 | A kind of high-performance and high availability divide table method and its system |
CN107958041A (en) * | 2017-11-23 | 2018-04-24 | 杭州电魂网络科技股份有限公司 | Date storage method, device, server and readable storage medium storing program for executing |
CN108052391A (en) * | 2017-11-30 | 2018-05-18 | 努比亚技术有限公司 | Memory Optimize Method, mobile terminal and readable storage medium storing program for executing based on thread deadlock |
CN109684329A (en) * | 2018-12-13 | 2019-04-26 | 高新兴科技集团股份有限公司 | A kind of method for managing resource based on data center apparatus |
CN110019191A (en) * | 2017-09-21 | 2019-07-16 | 阿里巴巴集团控股有限公司 | Database information processing method and processing device |
CN110750513A (en) * | 2019-09-17 | 2020-02-04 | 福建天泉教育科技有限公司 | Dynamic database capacity expansion method and storage medium |
CN111209284A (en) * | 2020-01-10 | 2020-05-29 | 北京仁科互动网络技术有限公司 | Metadata-based table dividing method and device |
CN111309724A (en) * | 2019-12-31 | 2020-06-19 | 航天信息股份有限公司 | Method and system for processing big data |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102033882A (en) * | 2009-09-25 | 2011-04-27 | 中兴通讯股份有限公司 | Method and system for storing performance data |
US20110202929A1 (en) * | 2010-02-16 | 2011-08-18 | Stephen Schleimer | Method and system for parallelizing database requests |
CN105095393A (en) * | 2015-06-30 | 2015-11-25 | 努比亚技术有限公司 | Method and device for data storage |
-
2016
- 2016-07-22 CN CN201610585099.5A patent/CN106202524A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102033882A (en) * | 2009-09-25 | 2011-04-27 | 中兴通讯股份有限公司 | Method and system for storing performance data |
US20110202929A1 (en) * | 2010-02-16 | 2011-08-18 | Stephen Schleimer | Method and system for parallelizing database requests |
CN105095393A (en) * | 2015-06-30 | 2015-11-25 | 努比亚技术有限公司 | Method and device for data storage |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110019191A (en) * | 2017-09-21 | 2019-07-16 | 阿里巴巴集团控股有限公司 | Database information processing method and processing device |
CN107766459A (en) * | 2017-09-27 | 2018-03-06 | 天翼电子商务有限公司 | A kind of high-performance and high availability divide table method and its system |
CN107766459B (en) * | 2017-09-27 | 2021-03-02 | 天翼商业保理有限公司 | Table dividing method and system |
CN107958041A (en) * | 2017-11-23 | 2018-04-24 | 杭州电魂网络科技股份有限公司 | Date storage method, device, server and readable storage medium storing program for executing |
CN107958041B (en) * | 2017-11-23 | 2020-07-31 | 杭州电魂网络科技股份有限公司 | Data storage method, device, server and readable storage medium |
CN108052391A (en) * | 2017-11-30 | 2018-05-18 | 努比亚技术有限公司 | Memory Optimize Method, mobile terminal and readable storage medium storing program for executing based on thread deadlock |
CN109684329A (en) * | 2018-12-13 | 2019-04-26 | 高新兴科技集团股份有限公司 | A kind of method for managing resource based on data center apparatus |
CN110750513A (en) * | 2019-09-17 | 2020-02-04 | 福建天泉教育科技有限公司 | Dynamic database capacity expansion method and storage medium |
CN111309724A (en) * | 2019-12-31 | 2020-06-19 | 航天信息股份有限公司 | Method and system for processing big data |
CN111209284A (en) * | 2020-01-10 | 2020-05-29 | 北京仁科互动网络技术有限公司 | Metadata-based table dividing method and device |
CN111209284B (en) * | 2020-01-10 | 2023-12-29 | 北京仁科互动网络技术有限公司 | Meta-data-based sub-table method and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106202524A (en) | Data base and point meter apparatus and method | |
CN105138541B (en) | The method and apparatus of audio-frequency fingerprint matching inquiry | |
EP3236365A1 (en) | Data query method and device | |
CN106658096A (en) | Method and device for pushing live program | |
CN110738477A (en) | reconciliation method, device, computer equipment and storage medium | |
CN106415534B (en) | The method and apparatus of contingency table subregion in a kind of distributed data base | |
KR102153806B1 (en) | Data processing method and device | |
US20220253419A1 (en) | Multi-record index structure for key-value stores | |
CN111625561B (en) | Data query method and device | |
CN106055706A (en) | Cache resource storage method and device | |
KR20180017085A (en) | Location information providing method and device | |
CN101739439A (en) | Method and system for dynamically customizing statistical object based on template | |
CN109388636A (en) | Business datum is inserted into database method, apparatus, computer equipment and storage medium | |
CN100392652C (en) | Retrieval system and method | |
CN104506394B (en) | A kind of mobile Internet flow statistical method and system | |
CN114090530A (en) | Log summarizing and inquiring method and device under distributed architecture | |
CN104239486A (en) | Method and system for processing data, and related device | |
CN105787379A (en) | Information management method and system as well as electronic device | |
CN105978744A (en) | Resource allocation method, device and system | |
CN111178965B (en) | Resource release method and server | |
CN101217690A (en) | A system and method for realizing distributed storage of data operation and data information | |
CN106815221B (en) | Telecommunication service relation judging method and device | |
CN107451229B (en) | Database query method and device | |
CN108345699A (en) | Obtain the method, apparatus and storage medium of multi-medium data | |
CN109428774B (en) | Data processing method of DPI equipment and related DPI equipment |
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: 20161207 |
|
RJ01 | Rejection of invention patent application after publication |