CN107562851B - Data updating method and device and electronic equipment - Google Patents
Data updating method and device and electronic equipment Download PDFInfo
- Publication number
- CN107562851B CN107562851B CN201710750743.4A CN201710750743A CN107562851B CN 107562851 B CN107562851 B CN 107562851B CN 201710750743 A CN201710750743 A CN 201710750743A CN 107562851 B CN107562851 B CN 107562851B
- Authority
- CN
- China
- Prior art keywords
- data updating
- data
- sector
- sector classification
- memory cache
- 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.)
- Active
Links
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Memory System Of A Hierarchy Structure (AREA)
Abstract
The application provides a data updating method, a device and an electronic device, which can avoid directly updating a received data updating request into a database table when receiving the data updating request by storing the received data updating request into a memory cache region so as to execute a data updating operation according to the updating content of the database table, and when the number of the data updating requests recorded and stored into the memory cache region reaches a preset boundary value, carry out sector classification sequencing on a plurality of data updating requests stored into the memory cache region according to the index sequence of the database table to generate a sector classification table comprising a plurality of sector classification sub-tables, so that the number of data updating operations executed by the database system in the data updating process is equal to the number of the sector classification sub-tables contained after the database table is updated, thereby reducing the number and time of data updating operations executed by the database system according to the data updating request, the work efficiency of the database system for processing the data updating request and the throughput of the database system are improved.
Description
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a method and an apparatus for updating data, and an electronic device.
Background
With the rapid development of information technology, databases are widely used as a technical means for people to effectively manage and utilize various information resources by using computers. In order to ensure that the data stored in the sectors in the database is the current latest data, the database system needs to update the data stored in the sectors in the database in time according to the needs of the user.
At present, the existing method for updating data mainly selects only one data updating request each time according to the sequence of the receiving time of the data updating request, and updates the data updating request into a database table, so that a database system determines a sector which needs to be modified at this time from all sectors in the database according to the updated content of the database table to perform corresponding data updating operation, and when one data updating operation is completed according to the data updating request, the next received data updating request is updated into the database table, so that the next data updating operation is performed on the data stored in the sector in the database, and the real-time performance of the data in the database is further ensured. However, when the existing data updating method is adopted, the data updating operation with the number of times of execution equal to the number of the received data updating requests is required to enable the data stored in the sectors in the database to complete the corresponding data updating operation according to all the received data updating requests, so that the time for the database system to process the data updating requests is longer, and the work efficiency for the database system to process the data updating requests and the throughput of the database system are indirectly reduced.
Disclosure of Invention
In view of this, the present invention provides a data updating method, a data updating device and an electronic device, which reduce the time for a database system to process a data updating request, and further improve the work efficiency of the database system for processing the data updating request and the throughput of the database system.
In order to achieve the purpose, the invention provides the following technical scheme:
a method of updating data, comprising:
when a data updating request is received, storing the data updating request into a memory cache region;
recording the number of data updating requests stored in the memory cache region;
when the number of the data updating requests stored in the memory cache region reaches a preset boundary value, according to the index sequence of the database tables, carrying out sector classification sorting on the data updating requests stored in the memory cache region to generate a sector classification table, wherein the sector classification table comprises at least one sector classification sub-table, and each sector classification sub-table comprises a data updating request corresponding to the data updating operation of the data stored in the same sector;
and updating the sector classification table to the database table for data updating.
Preferably, after the recording the number of the data update requests stored in the memory cache region, the method further includes:
starting a timer to time and generating the timing time of the timer;
judging whether the timing time of the timer reaches a preset time value or not;
and if the timing time of the timer reaches the preset time value, executing the sector classification sequencing of the data updating requests recorded and stored in the memory cache region according to the index sequence of the database table to generate a sector classification table.
Preferably, the performing sector classification sorting on the data update requests recorded in the memory cache region according to the index sequence of the database table to generate a sector classification table includes:
according to the index sequence of the database table, carrying out sector classification on the data updating request recorded in the memory cache region to generate at least one sector classification sub-table;
and arranging the generated sector classification sub-tables according to a generation sequence to generate a sector classification table.
Preferably, after the updating the sector classification table to the database table for data updating, the method further includes:
and generating an updating completion result.
An apparatus for updating data, comprising:
the storage module is used for storing the data updating request into a memory cache region when the data updating request is received;
the recording module is used for recording the number of the data updating requests stored in the memory cache region;
the classification sorting module is used for performing sector classification sorting on the data updating requests recorded and stored in the memory cache region according to the index sequence of a database table when the number of the data updating requests recorded and stored in the memory cache region by the recording module reaches a preset boundary value, and generating a sector classification table, wherein the sector classification table comprises at least one sector classification sub-table, and each sector classification sub-table comprises a data updating request corresponding to the data updating operation of the data stored in the same sector;
and the updating module is used for updating the sector classification table to the database table for data updating.
Preferably, the apparatus further comprises:
the timing module is used for starting a timer to time and generating the timing time of the timer;
the judging module is used for judging whether the timing time of the timer reaches a preset time value or not;
and the classification and sorting module is further configured to perform sector classification and sorting on the data update requests recorded in the memory cache region according to the index sequence of the database table after the judgment module judges that the timer timing time reaches the preset time value, so as to generate a sector classification table.
Preferably, the sorting module comprises:
the sector classification module is used for carrying out sector classification on the data updating request recorded in the memory cache region according to the index sequence of the database table to generate at least one sector classification sub-table;
and the sector sorting module is used for sorting the generated sector classification sub-tables according to the generation sequence to generate a sector classification table.
Preferably, the apparatus further comprises:
and the generating module is used for generating an updating completion result after the updating module updates the sector classification table to the database table and performs data updating.
An electronic device, comprising: a transceiver, a memory, and a processor;
the transceiver is used for receiving a data updating request;
the memory comprises a memory cache region and a database table;
the processor is used for storing the data updating request into the memory cache region when the transceiver receives the data updating request, and recording the number of the data updating requests stored in the memory cache region; when the number of the data updating requests stored in the memory cache region reaches a preset boundary value, according to the index sequence of the database table, carrying out sector classification sorting on the data updating requests stored in the memory cache region to generate a sector classification table, wherein the sector classification table comprises at least one sector classification sub-table, and each sector classification sub-table comprises a data updating request corresponding to the data updating operation of the data stored in the same sector; and updating the sector classification table to the database table for data updating.
Preferably, the electronic device further includes: a timer;
the timer is used for timing and generating timer timing time; the processor is further used for judging whether the timing time of the timer reaches a preset time value; and if the timer reaches the preset time value, carrying out sector classification sequencing on the data updating requests in the memory cache region according to the index sequence of the database table to generate a sector classification table.
It can be known from the above technical solutions that, compared with the prior art, the present invention provides a data updating method, apparatus and electronic device, by storing a received data updating request in a memory cache region, it can effectively avoid directly updating the data updating request into a database table when a data updating request is received, so that the database system executes a data updating operation according to the updating content of the database table, and when the number of data updating requests recorded in the memory cache region reaches a preset boundary value, performs sector classification sorting on a plurality of data updating requests stored in the memory cache region according to the index sequence of the database table, generates a sector classification table containing a plurality of sector classification sub-tables, which is beneficial for the number of data updating operations executed by the database system in the data updating process to be equal to the number of sector classification sub-tables in the sector classification table obtained by updating the database table, the data updating method can complete all data updating operations which need to be executed by the database system when the data updating request is executed, further solve the problem that the data stored in the sectors in the database can be updated correspondingly to all the received data updating requests only by executing the data updating operations with the quantity equal to that of the received data updating requests, effectively reduce the times and time for the database system to perform the data updating operations according to the data updating requests, and indirectly improve the working efficiency of the database system for processing the data updating requests and the throughput of the database system.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a method for updating data according to an embodiment of the present invention;
fig. 2 is a flowchart of a method for generating a sector classification table according to an embodiment of the present invention;
FIG. 3 is a flowchart of another method for updating data according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a data updating apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a sector classification table generation apparatus according to an embodiment of the present invention;
FIG. 6 is a schematic structural diagram of another data updating apparatus according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of another electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the invention discloses a data updating method, please refer to fig. 1, which specifically comprises the following steps:
s101: when a data updating request is received, storing the data updating request into a memory cache region;
specifically, the database belongs to a shared resource, and multiple users having the right of the shared resource can be allowed to perform read-write operation on the data resource stored in the sector in the database. And each user with the right of sharing the resource sends a data updating request to the database system so that the database system knows that the user currently needs to perform a writing operation, i.e. an updating operation, on the data resource in the database system, so that the database system performs a subsequent related data updating operation on the received data updating request.
After receiving a data updating request sent by a user, the database system stores the data updating request into a memory cache region in time. The memory cache area in the database system can be pre-established and is mainly used for storing the received data updating request. The stored data update requests may be sent by the same user or by different users.
The storage time of the data update request is not limited in this scheme, and the data update requests may be stored at the same or different time intervals, for example, the database system stores the "data update request a" sent by the "user a" at the "time T", stores the "data update request B" sent by the "user a" at the "time T + 1", and stores the "data update request c" sent by the "user B" at the "time T + 4".
S102: recording the number of data updating requests stored in the memory cache region;
specifically, in order to facilitate the database system to timely know whether the number of the currently stored data update requests meets the condition of performing the sector sorting, the data update requests need to be stored into the memory cache area each time, and then recorded in time.
For example, after the database system receives and stores a data update request, the number of data update requests contained in the current memory cache region is recorded as "1", and then, if a next data update request is received and stored again, recording is performed again, so that the number of data update requests contained in the current memory cache region is changed to "2", and recording is sequentially performed until the number of data update requests in the recorded memory cache region meets the condition of performing sector classification and sorting, that is, the number of data update requests in the recorded memory cache region reaches a preset boundary value.
S103: when the number of the data updating requests stored in the memory cache region reaches a preset boundary value, according to the index sequence of the database tables, carrying out sector classification sorting on the data updating requests stored in the memory cache region to generate a sector classification table, wherein the sector classification table comprises at least one sector classification sub-table, and each sector classification sub-table comprises a data updating request corresponding to the data updating operation of the data stored in the same sector;
specifically, the number of the data updating requests stored in the memory cache region reaches the preset boundary value and serves as an execution basis for performing subsequent sector sorting operation, so that the problem that the database system immediately updates the data updating requests into the database table when receiving the data updating requests, the database system executes one data updating operation according to the updated database table can be avoided, and conditions are provided for subsequently reducing the number of data updating operations. The memory cache region is pre-established in the database system and is mainly used for storing the received data updating request and executing the related operation of sector classification and sequencing in the memory cache region.
The database table records data stored on all sectors in the database, and the index sequence of the database table is mainly used for recording the specific storage positions of all data recorded in the database table, namely the sectors to which the data belong. Therefore, the required data resources can be quickly acquired from the corresponding sectors in the database by using the index sequence of the database table. Wherein, different database tables can have the same or different index orders of the database tables, and the index orders can be preset.
The sector classification sorting is carried out on all data updating requests recorded in the current time and stored in the memory cache region by utilizing the index sequence of the database table, all the data updating requests can be classified and sorted according to specific sectors in the database which is subjected to data updating operation, and therefore a sector classification table comprising a plurality of sector classification sub-tables is obtained, wherein the number of the sector classification sub-tables obtained after classification sorting is less than that of all the data updating requests stored in the memory cache region, and therefore when a plurality of data updating requests are received and stored subsequently, the database system can carry out a data updating process according to the sector classification tables contained in the updated database table, and the number of times of executing data updating operation is reduced.
Secondly, each stored data updating request contains relevant information for performing data updating operation on a certain sector in the database system, so that all data updating requests which belong to the data updating request operation on the same sector can be quickly put into a sector classification sub-table according to the data updating requests in the sector classification sorting process.
For example, the data update requests recorded in the memory cache region at this time are "request 1", "request 2", "request 3", "request 4" and "request 5", and at this time, the number of the data update requests recorded in the memory cache region has reached "preset boundary value 5", then the sector classification sorting is performed on "request 1", "request 2", "request 3", "request 4" and "request 5" according to the index sequence of the database table, so as to generate a sector classification sub-table including 3 sector classification sub-tables "sector classification sub-table 1", "sector classification sub-table 2" and "sector classification sub-table 3", where "sector classification sub-table 1" includes "request 1" and "request 2" for performing data update operation on data stored in sector 1 in the database, and "sector classification sub-table 2" includes "request 3" and "request 5" for performing data update operation on data stored in sector 2 in the database, the "sector classification sub-table 3" contains "request 4" for a data update operation with respect to data stored in sector 3 in the database.
The number of sectors in the database is not limited in this case, and the number of sectors included in the database may be set according to the storage characteristics of the database, and may be any of 5, 27, or 50.
S104: updating the sector classification table to the database table for data updating;
specifically, because the database system executes the data updating operation on the data stored in the sector according to the content contained in the database table, in order to timely fulfill the data updating requirement of the user, the generated sector classification table needs to be updated into the database table, so that the database sequentially executes the data updating operation on the data stored in the corresponding sector in the database according to the sector classification sub-table contained in the updated database table.
Still take the sector classification table containing "sector classification sub table 1", "sector classification sub table 2" and "sector classification sub table 3" as an example to make specific explanation, wherein "sector classification sub table 1" contains "request 1" and "request 2", "sector classification sub table 2" contains "request 3" and "request 5" and "sector classification sub table 3" contains "request 4", after updating the sector classification table to the database table, the database system performs a data updating operation on the data stored in "sector 1", the data stored in "sector 2" and the data stored in "sector 3" in the database in sequence according to "sector classification sub table 1", "sector classification sub table 2" and "sector classification sub table 3" contained in the updated database table, and further successfully reduces the data updating operation which originally needs to be performed 5 times to 3 data updating operations, therefore, the times and time of data updating operation of the database system according to the data updating request are effectively reduced, and the working efficiency of the database system for processing the data updating request and the throughput of the database system are indirectly improved.
The data updating method disclosed by the embodiment of the invention can effectively avoid that the data updating request is directly updated into the database table when the data updating request is received by storing the received data updating request into the memory cache region, so that the database system executes one data updating operation according to the updating content of the database table, and when the number of the data updating requests recorded into the memory cache region reaches a preset boundary value, the plurality of data updating requests stored into the memory cache region are subjected to sector classification sequencing according to the index sequence of the database table to generate the sector classification table comprising a plurality of sector classification sub-tables, thereby being beneficial to the situation that the number of data updating operations executed by the database system in the data updating process is equal to the number of the sector classification sub-tables in the sector classification obtained by updating the database table, and being capable of finishing all data updating operations executed by the database system by the data updating requests, and the problem that the data stored in the sectors in the database can be updated correspondingly to all the received data updating requests only by executing the data updating operation with the quantity equal to that of the received data updating requests is solved, the times and time for the database system to perform the data updating operation according to the data updating requests are effectively reduced, and the working efficiency of the database system for processing the data updating requests and the throughput of the database system are indirectly improved.
Referring to fig. 2, the specific implementation process of S103 in the embodiment corresponding to fig. 1 includes the following steps:
s201: according to the index sequence of the database table, carrying out sector classification on the data updating request recorded in the memory cache region to generate at least one sector classification sub-table;
specifically, the data update requests recorded in the memory cache area are subjected to sector classification according to the index sequence of the database table, and on the basis of ensuring that the data update requests contained in each generated sector classification sub-table are subjected to data update operation aiming at the data stored in the same sector, the plurality of sector classification sub-tables are sequentially generated according to the arrangement sequence of the sectors to which the originally recorded data belong in the index sequence of the database table. For example, the index sequence of the database table includes 4 sectors arranged in sequence, which are "sector 1", "sector 2", "sector 3" and "sector 4", respectively, and the data update request stored in the memory cache region includes "request 1", "request 2", "request 3", "request 4", "request 5" and "request 6", where "request 1" and "request 2" are data update operations performed on data stored in sector 1 in the database, "request 3" is data update operations performed on data stored in sector 2 in the database, "request 4" is data update operations performed on data stored in sector 3 in the database, "request 5" and "request 6" are data update operations performed on data stored in sector 4 in the database, and the number of data update requests in the memory cache region recorded at this time reaches "preset boundary value 6", then "sector classification sub-table 1" containing "request 1" and "request 2", sector classification sub-table 2 "containing" request 3 ", sector classification sub-table 3" containing "request 4", and sector classification sub-table 4 "containing" request 5 "and" request 6 "are generated in sequence according to the index order of the database tables.
S202: arranging the generated sector classification sub-tables according to a generation sequence to generate a sector classification table;
specifically, one or more sector classification sub-tables are sequentially generated according to the index sequence of the database table, so that the generation sequence of the sector classification sub-tables is used as a ranking standard to rank all the generated sector classification sub-tables, and thus, the sector classification table consistent with the sector ranking position in the index sequence of the database table can be obtained, so that a subsequent database system can rapidly complete one data updating operation on each sector needing data updating according to the updated database table, and data updating of data stored in the sector is realized.
In the embodiment of the invention, the sector classification is carried out on the data updating request recorded and stored in the memory cache region according to the index sequence of the database table to obtain a plurality of sector classification sub-tables, and then the sector classification sub-tables are arranged according to the generation sequence of the sector classification sub-tables, so that the arrangement positions of the sector classification sub-tables in the generated sector classification tables are consistent with the arrangement positions of the sectors in the index sequence of the database table, the arrangement positions of the sector classification sub-tables in the sector classification tables are indirectly consistent with the arrangement positions of the data stored in the database table, the updating of the sector classification tables into the database table is accelerated, the speed of the database system for executing data updating operation according to the updated database table is increased, and the work efficiency of the database system for processing the data updating request and the throughput of the database system are indirectly improved.
Optionally, after S104 in the embodiment corresponding to fig. 1, the following steps are further included:
and generating an updating completion result.
In the embodiment of the invention, the updating completion result is generated after the data updating corresponding to all the stored data updating requests is completed, so that the follow-up staff can conveniently call the result to know whether the data updating operation is completed smoothly, and the occurrence probability that the staff cannot timely know the processing condition due to accidents in the data updating process is further reduced.
On the basis of the embodiment shown in fig. 1, another data updating method is disclosed in the embodiment of the present invention, referring to fig. 3, where the method specifically includes the following steps:
s301: and when a data updating request is received, storing the data updating request into a memory cache region.
S302: and recording the number of the data updating requests stored in the memory cache region.
S303: starting a timer to time and generating the timing time of the timer;
specifically, when a part of data update requests are recorded in the memory cache region, but the number of the stored data update requests does not reach a preset boundary value, if a new data update request is not continuously received and recorded for a long time, subsequent sector sorting operations cannot be performed, and thus data update operations corresponding to the part of data update requests stored in the memory cache region cannot be performed, which causes a problem of data update delay.
Therefore, in order to avoid the above problem, a timer may be preset, and is triggered to time when the number of the data update requests stored in the memory buffer is not 0, so as to periodically perform sector classification and sorting on the stored partial data update requests, thereby continuing to perform subsequent related data update operations and avoiding the problem of data update delay.
S304: judging whether the timing time of the timer reaches a preset time value, if so, executing S305, otherwise, returning to execute S303;
specifically, the preset time value of the timer may be preset, for example, 5s, 10s, or 20 s.
S305: according to the index sequence of the database table, carrying out sector classification sorting on the data updating requests recorded and stored in the memory cache region to generate a sector classification table, and executing S306;
specifically, when the timer timing time reaches the preset time value, the sector classification table is generated in time according to the index sequence of the database table, and the time of the database system for performing data updating operation according to the data updating request is further effectively shortened.
S306: and updating the sector classification table to the database table for data updating.
The embodiment of the invention discloses a data updating method, which comprises the steps of starting a timer to time, and when the time counted by the timer reaches a preset time value, carrying out sector classification sequencing on data updating requests recorded and stored in a memory cache region according to the index sequence of a database table to further generate a sector classification table so that a database system can update data stored in a corresponding sector by using the sector classification table contained after the database table is updated, thereby effectively avoiding the problem that the data updating operation corresponding to part of the data updating requests stored in the memory cache region cannot be executed on the premise that the number of the data updating requests stored in the memory cache region does not reach a preset boundary value and new data updating requests are not stored continuously for a long time.
The embodiment of the invention discloses a data updating device, please refer to fig. 4, the device includes:
a storing module 401, configured to store a data update request into a memory cache area when the data update request is received;
a recording module 402, configured to record the number of data update requests stored in the memory cache region;
a sorting module 403, configured to, when the number of data update requests recorded in the memory cache area by the recording module 402 reaches a preset boundary value, perform sector sorting on the data update requests recorded in the memory cache area according to an index sequence of a database table to generate a sector sorting table, where the sector sorting table includes at least one sector sorting sub-table, and each sector sorting sub-table includes a data update request corresponding to a data update operation performed on data stored in the same sector;
an updating module 404, configured to update the sector classification table to the database table for data updating.
The data updating device disclosed in the embodiment of the invention stores the received data updating request into the memory cache region through the storage module 401, so that the situation that when a data updating request is received, the data updating request is directly updated into the database table, so that the database system executes a data updating operation according to the updating content of the database table can be effectively avoided, and the classification and sorting module 403 carries out sector classification and sorting on a plurality of data updating requests stored into the memory cache region according to the index sequence of the database table when the number of the data updating requests stored into the memory cache region recorded by the recording module 402 reaches a preset boundary value, so as to generate a sector classification table comprising a plurality of sector classification sub-tables, which is beneficial for the data updating operation times executed by the database system in the data updating process to be equal to the number of the sector classification sub-tables in the sector classification table obtained by updating the database table, the data updating method can complete all data updating operations which need to be executed by the database system when the data updating request is executed, further solve the problem that the data stored in the sectors in the database can be updated correspondingly to all the received data updating requests only by executing the data updating operations with the quantity equal to that of the received data updating requests, effectively reduce the times and time for the database system to perform the data updating operations according to the data updating requests, and indirectly improve the working efficiency of the database system for processing the data updating requests and the throughput of the database system.
Please refer to a method flowchart corresponding to fig. 1 for the working process of each module provided in the embodiment of the present invention, and detailed description of the working process is omitted.
Referring to fig. 5, the sorting module 403 in the embodiment corresponding to fig. 4 specifically includes:
a sector classification module 4031, configured to perform sector classification on the data update request recorded in the memory cache area according to the index order of the database table, and generate at least one sector classification sub-table;
and a sector sorting module 4032, configured to arrange the generated sector classification sub-tables according to a generation order, and generate a sector classification table.
In the embodiment of the invention, the sector classification module 4031 performs sector classification on the data updating requests recorded in the memory cache region according to the index sequence of the database table to obtain a plurality of sector classification sub-tables, the sector sorting module 4032 performs arrangement according to the generation sequence of the sector classification sub-tables, the arrangement position of the sector classification sub-table in the generated sector classification table can be kept consistent with the arrangement position of the sectors in the index sequence of the database table, the arrangement position of the sector classification sub-table in the sector classification table is indirectly consistent with the arrangement position of the data stored in the database table, and the speed of updating the sector classification table into the database table and the speed of executing data updating operation by the database system according to the updated database table are increased, and the working efficiency of processing the data updating request by the database system and the throughput of the database system are indirectly improved.
Please refer to a method flowchart corresponding to fig. 2 for the working process of each module provided in the embodiment of the present invention, and detailed description of the working process is omitted.
On the basis of the embodiment corresponding to fig. 4, another data updating apparatus is disclosed in the embodiment of the present invention, please refer to fig. 6, where the apparatus includes:
a storage module 401, a recording module 402, a sorting module 403, an updating module 404, a timing module 405, a judging module 406, and a generating module 407;
the timing module 405 is configured to start a timer to time, and generate a timer timing time;
the judging module 406 is configured to judge whether the timing time of the timer reaches a preset time value;
the sorting and sorting module 403 is further configured to, after the determining module 406 determines that the timer timing time reaches the preset time value, perform sector sorting and sorting on the data update requests recorded in the memory cache region according to the index sequence of the database table, so as to generate a sector sorting table.
The generating module 407 is configured to generate an update completion result after the updating module 404 updates the sector classification table to the database table and performs data update.
The data updating device disclosed in the embodiment of the present invention starts a timer through the timing module 405 to count, generates the timing time of the timer, and when the determining module 406 determines that the timer reaches the preset time value, the sorting module 403 sorts the sectors of the data update requests stored in the memory buffer according to the index sequence of the database table, further, a sector classification table is generated, so that the database system updates the data stored in the corresponding sector by using the sector classification table contained in the updated database table, thereby effectively avoiding the situation that the number of the data updating requests recorded and stored in the memory cache region does not reach the preset boundary value, and under the premise that new data updating requests are not stored continuously for a long time, the problem that the data updating operation corresponding to part of the stored data updating requests in the memory cache region cannot be executed is caused.
Please refer to a method flowchart corresponding to fig. 3 for the working process of each module provided in the embodiment of the present invention, and detailed description of the working process is omitted.
An embodiment of the present invention discloses an electronic device, please refer to fig. 7, where the electronic device includes:
a transceiver 501, a memory 502, and a processor 503;
the transceiver 501 is configured to receive a data update request;
the memory 502 includes a memory cache and a database table;
the processor 503 is configured to store the data update request into the memory cache region when the transceiver 501 receives the data update request, and record the number of the data update requests stored in the memory cache region; when the number of the data updating requests stored in the memory cache region reaches a preset boundary value, according to the index sequence of the database table, carrying out sector classification sorting on the data updating requests stored in the memory cache region to generate a sector classification table, wherein the sector classification table comprises at least one sector classification sub-table, and each sector classification sub-table comprises the data updating request corresponding to the data updating operation of the data stored in the same sector; and updating the sector classification table to the database table for data updating.
The electronic device disclosed in the embodiment of the present invention stores the data update request received by the transceiver 501 into the memory cache region through the processor 503, which can effectively avoid that when a data update request is received, the processor 503 directly updates the data update request into the database table in the memory 502, so that the processor 503 executes a data update operation according to the update content of the database table, and when the number of data update requests recorded into the memory cache region reaches a preset boundary value, the processor 503 performs sector classification and sorting on the plurality of data update requests stored in the memory cache region in the memory 502 according to the index sequence of the database table, generates a sector classification table including a plurality of sector classification sub-tables, and is favorable for the number of data update operations executed by the processor 503 in the data update process to be equal to the number of sector classification sub-tables in the sector classification table obtained by updating the data table, the data updating operation which is required to be executed by the processor 503 and corresponds to the data updating request can be completed, so that the problem that the data updating operation which is equal to the number of the received data updating requests is executed to enable the data stored in the sectors in the database to complete the data updating corresponding to the received data updating requests is solved, the times and time of the data updating operation performed by the processor 503 according to the data updating requests are effectively reduced, and the working efficiency and the throughput of the processor 503 for processing the data updating requests are indirectly improved.
On the basis of the embodiment corresponding to fig. 7, another electronic device is disclosed in the embodiment of the present invention, please refer to fig. 8, where the electronic device includes:
a transceiver 501, a memory 502, a processor 503, and a timer 504;
the timer 504 is used for timing and generating timer timing time;
the processor 503 is further configured to determine whether the timed time of the timer reaches a preset time value; and if the timer reaches the preset time value, carrying out sector classification sequencing on the data updating requests in the memory cache region according to the index sequence of the database table to generate a sector classification table.
In the electronic device disclosed in the embodiment of the present invention, when the processor 503 determines that the timer timing time generated by the timer 504 reaches the preset time value, the processor 503 classifies and sorts the sectors of the data update requests recorded and stored in the memory cache region according to the index sequence of the database table to generate the sector classification table, so that the subsequent processor 503 updates the data stored in the corresponding sectors by using the sector classification table included in the updated database table, thereby effectively avoiding the problem that the processor 503 cannot execute the data update operation corresponding to the partial data update request stored in the memory cache region on the premise that the number of the data update requests stored in the memory cache region does not reach the preset boundary value and the new data update request is not stored continuously for a long time.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (10)
1. A method for updating data, comprising:
when a data updating request is received, storing the data updating request into a memory cache region;
recording the number of data updating requests stored in the memory cache region;
when the number of the data updating requests stored in the memory cache region reaches a preset boundary value, according to the index sequence of the database tables, carrying out sector classification sorting on the data updating requests stored in the memory cache region to generate a sector classification table, wherein the sector classification table comprises at least one sector classification sub-table, and each sector classification sub-table comprises a data updating request corresponding to the data updating operation of the data stored in the same sector; the index sequence of the database table is used for recording sectors to which all data recorded in the database table belong;
and updating the sector classification table to the database table for data updating.
2. The method of claim 1, further comprising, after recording the number of data update requests stored in the memory buffer:
starting a timer to time and generating the timing time of the timer;
judging whether the timing time of the timer reaches a preset time value or not;
and if the timing time of the timer reaches the preset time value, executing the sector classification sequencing of the data updating requests recorded and stored in the memory cache region according to the index sequence of the database table to generate a sector classification table.
3. The method of claim 1, wherein the performing sector classification ordering on the data update requests recorded in the memory cache region according to the index order of the database table to generate a sector classification table comprises:
according to the index sequence of the database table, carrying out sector classification on the data updating request recorded in the memory cache region to generate at least one sector classification sub-table;
and arranging the generated sector classification sub-tables according to a generation sequence to generate a sector classification table.
4. The method of claim 1, wherein after the updating the sector classification table to the database table for data updating, further comprising:
and generating an updating completion result.
5. An apparatus for updating data, comprising:
the storage module is used for storing the data updating request into a memory cache region when the data updating request is received;
the recording module is used for recording the number of the data updating requests stored in the memory cache region;
the classification sorting module is used for performing sector classification sorting on the data updating requests recorded and stored in the memory cache region according to the index sequence of a database table when the number of the data updating requests recorded and stored in the memory cache region by the recording module reaches a preset boundary value, and generating a sector classification table, wherein the sector classification table comprises at least one sector classification sub-table, and each sector classification sub-table comprises a data updating request corresponding to the data updating operation of the data stored in the same sector; the index sequence of the database table is used for recording sectors to which all data recorded in the database table belong;
and the updating module is used for updating the sector classification table to the database table for data updating.
6. The apparatus of claim 5, further comprising:
the timing module is used for starting a timer to time and generating the timing time of the timer;
the judging module is used for judging whether the timing time of the timer reaches a preset time value or not;
and the classification and sorting module is further configured to perform sector classification and sorting on the data update requests recorded in the memory cache region according to the index sequence of the database table after the judgment module judges that the timer timing time reaches the preset time value, so as to generate a sector classification table.
7. The apparatus of claim 5, wherein the sort order module comprises:
the sector classification module is used for carrying out sector classification on the data updating request recorded in the memory cache region according to the index sequence of the database table to generate at least one sector classification sub-table;
and the sector sorting module is used for sorting the generated sector classification sub-tables according to the generation sequence to generate a sector classification table.
8. The apparatus of claim 5, further comprising:
and the generating module is used for generating an updating completion result after the updating module updates the sector classification table to the database table and performs data updating.
9. An electronic device, comprising: a transceiver, a memory, and a processor;
the transceiver is used for receiving a data updating request;
the memory comprises a memory cache region and a database table;
the processor is used for storing the data updating request into the memory cache region when the transceiver receives the data updating request, and recording the number of the data updating requests stored in the memory cache region; when the number of the data updating requests stored in the memory cache region reaches a preset boundary value, according to the index sequence of the database table, carrying out sector classification sorting on the data updating requests stored in the memory cache region to generate a sector classification table, wherein the sector classification table comprises at least one sector classification sub-table, and each sector classification sub-table comprises a data updating request corresponding to the data updating operation of the data stored in the same sector; updating the sector classification table to the database table for data updating; and the index sequence of the database table is used for recording the sectors to which all the data recorded in the database table belong.
10. The electronic device of claim 9, further comprising: a timer;
the timer is used for timing and generating timer timing time;
the processor is further configured to determine whether the timer timing time reaches a preset time value, and if the timer timing time reaches the preset time value, perform sector classification and sorting on the data update requests recorded in the memory cache area according to the index sequence of the database table to generate a sector classification table.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710750743.4A CN107562851B (en) | 2017-08-28 | 2017-08-28 | Data updating method and device and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710750743.4A CN107562851B (en) | 2017-08-28 | 2017-08-28 | Data updating method and device and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107562851A CN107562851A (en) | 2018-01-09 |
CN107562851B true CN107562851B (en) | 2020-10-23 |
Family
ID=60977461
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710750743.4A Active CN107562851B (en) | 2017-08-28 | 2017-08-28 | Data updating method and device and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107562851B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109933590B (en) * | 2019-03-19 | 2021-04-20 | 上海达梦数据库有限公司 | Data updating method, device, server and storage medium |
CN110442579B (en) * | 2019-08-02 | 2022-06-28 | 杭州复杂美科技有限公司 | State tree data storage method, synchronization method and equipment and storage medium |
CN111459893B (en) * | 2020-04-03 | 2023-08-22 | 北京字节跳动网络技术有限公司 | File processing method and device and electronic equipment |
CN113037853B (en) * | 2021-03-22 | 2023-01-06 | 北京字节跳动网络技术有限公司 | Data processing method, device, equipment and storage medium |
CN115237927B (en) * | 2022-09-20 | 2022-11-29 | 神州医疗科技股份有限公司 | Method and system for realizing data table updating based on cache and data processing rule |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8606575B1 (en) * | 2011-09-06 | 2013-12-10 | West Corporation | Method and apparatus of providing semi-automated classifier adaptation for natural language processing |
CN104182441A (en) * | 2014-02-27 | 2014-12-03 | 无锡天脉聚源传媒科技有限公司 | Data sheet synchronization method and device |
CN106528871A (en) * | 2016-12-06 | 2017-03-22 | 爱普(福建)科技有限公司 | Method for updating information of engineering data points in industrial control system on line |
-
2017
- 2017-08-28 CN CN201710750743.4A patent/CN107562851B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8606575B1 (en) * | 2011-09-06 | 2013-12-10 | West Corporation | Method and apparatus of providing semi-automated classifier adaptation for natural language processing |
CN104182441A (en) * | 2014-02-27 | 2014-12-03 | 无锡天脉聚源传媒科技有限公司 | Data sheet synchronization method and device |
CN106528871A (en) * | 2016-12-06 | 2017-03-22 | 爱普(福建)科技有限公司 | Method for updating information of engineering data points in industrial control system on line |
Also Published As
Publication number | Publication date |
---|---|
CN107562851A (en) | 2018-01-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107562851B (en) | Data updating method and device and electronic equipment | |
CN110727685B (en) | Data compression method, equipment and storage medium based on Cassandra database | |
WO2013078583A1 (en) | Method and apparatus for optimizing data access, method and apparatus for optimizing data storage | |
CN109240607B (en) | File reading method and device | |
WO2018121242A1 (en) | Multiple buffer-based data elimination method and device | |
US20190171479A1 (en) | Method and system for scheduling transactions in a data system | |
US20240061712A1 (en) | Method, apparatus, and system for creating training task on ai training platform, and medium | |
CN106649146A (en) | Memory release method and apparatus | |
CN104778271A (en) | Video data caching method and device | |
CN105359142A (en) | Hash join method, device and database management system | |
CN104156173A (en) | Method and device for disk defragmentation | |
CN113377777B (en) | Data loading method, device, computer program product and storage medium | |
CN105912664B (en) | File processing method and equipment | |
CN117251275B (en) | Multi-application asynchronous I/O request scheduling method, system, equipment and medium | |
CN116860723B (en) | Cross-computing center data migration method | |
CN109325199A (en) | It is a kind of to reduce the method and electronic equipment that webpage redraws number using programming language | |
CN106991116B (en) | Optimization method and device for database execution plan | |
CN110399451B (en) | Full-text search engine caching method, system and device based on nonvolatile memory and readable storage medium | |
WO2019019596A1 (en) | Breakpoint list processing method, device, server and medium | |
CN106095577B (en) | The optimized treatment method and device of shared drive based on multichannel process device | |
CN106202374A (en) | A kind of data processing method and device | |
CN101833585A (en) | Database server operation control system, method and device | |
US20160253591A1 (en) | Method and apparatus for managing performance of database | |
WO2020140623A1 (en) | Electronic device, metadata processing method and computer readable storage medium | |
EP3070853B1 (en) | Task processing method and device for implementing multipath searching |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |