CN114942929A - Bank data storage method and related device - Google Patents
Bank data storage method and related device Download PDFInfo
- Publication number
- CN114942929A CN114942929A CN202210689245.4A CN202210689245A CN114942929A CN 114942929 A CN114942929 A CN 114942929A CN 202210689245 A CN202210689245 A CN 202210689245A CN 114942929 A CN114942929 A CN 114942929A
- Authority
- CN
- China
- Prior art keywords
- data
- target
- bank
- stored
- time
- 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
- 238000013500 data storage Methods 0.000 title claims abstract description 200
- 238000000034 method Methods 0.000 title claims abstract description 53
- 238000004590 computer program Methods 0.000 description 7
- 238000010586 diagram Methods 0.000 description 7
- 230000003203 everyday effect Effects 0.000 description 5
- 238000012545 processing Methods 0.000 description 4
- 230000014759 maintenance of location Effects 0.000 description 3
- 230000006978 adaptation Effects 0.000 description 1
- 230000002354 daily effect Effects 0.000 description 1
- 238000012217 deletion Methods 0.000 description 1
- 230000037430 deletion Effects 0.000 description 1
- 230000010365 information processing Effects 0.000 description 1
- 238000003780 insertion Methods 0.000 description 1
- 230000037431 insertion Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 238000007619 statistical method Methods 0.000 description 1
Images
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/21—Design, administration or maintenance of databases
- G06F16/219—Managing data history or versioning
-
- 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/23—Updating
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/02—Banking, e.g. interest calculation or account maintenance
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- Business, Economics & Management (AREA)
- General Engineering & Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Accounting & Taxation (AREA)
- Finance (AREA)
- Software Systems (AREA)
- Development Economics (AREA)
- Economics (AREA)
- Marketing (AREA)
- Strategic Management (AREA)
- Technology Law (AREA)
- General Business, Economics & Management (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application discloses a bank data storage method and a related device, which can be applied to the field of big data or the field of finance. After target bank data to be stored and target data time are obtained, whether the target data time exists in a data storage table is judged, if the target data time is determined not to be in the data storage table, the target data time is indicated to be the first time of storing the bank data, and a to-be-stored position of the target bank data in the data storage table is determined according to the storage period and the target data time of historical bank data in the data storage table. The target bank data is stored in a position covering mode in the data table to be stored in a rotating mode, so that the step of deleting historical bank data is not involved in the storage process, the historical data does not need to be deleted periodically through an additional configuration module, and the problem of performance jitter is avoided.
Description
Technical Field
The invention relates to the technical field of data processing, in particular to a bank data storage method and a related device.
Background
Data statistical analysis is widely applied in computer information processing, for example, for bank data, daily history retention for statistical index results is a common requirement so as to be used for data tracking and trend analysis.
In the related art, a data storage method is generally to add a new piece of data in a data storage table every day, and in order to prevent the data table from growing all the time, historical data exceeding a retention time limit is deleted regularly. However, this method must be additionally equipped with a module responsible for deleting the history periodically, and since the bank data grows rapidly, performance jitter may be generated on processing efficiency during deletion.
Disclosure of Invention
In order to solve the problems, the application provides a bank data storage method and a related device, which are used for solving the problems that modules need to be additionally equipped and performance jitter is generated when historical bank data is deleted.
Based on this, the embodiment of the application discloses the following technical scheme:
in one aspect, an embodiment of the present application provides a method for storing bank data, where the method includes:
acquiring target bank data to be stored and target data time corresponding to the target bank data; wherein the target data time is used for identifying the generation time of the target bank data;
if the target data time is determined not to be in the data storage table according to the data storage table, determining the position of the target bank data to be stored in the data storage table according to the storage period of historical bank data in the data storage table and the target data time; the data storage table comprises historical bank data and historical data time corresponding to the historical bank data, and the historical data time is used for identifying the generation time of the historical bank data;
and overwriting and storing the target bank data to the position to be stored, wherein the position to be stored has the historical bank data.
Optionally, the determining, according to the storage cycle of the historical bank data in the data storage table and the target data time, a to-be-stored position of the target bank data in the data storage table includes:
determining target historical time data corresponding to the previous storage period of the target data time according to the difference between the storage period of the historical bank data in the data storage table and the target data time;
and determining the position of the target bank data to be stored in the data storage table according to the position of the target historical time data in the data storage table.
Optionally, the method further includes:
if the target data time is determined in the data storage table according to the data storage table, determining the position of the target bank data to be stored in the data storage table according to the position of the target data time in the data storage table;
and storing the target bank data to the position to be stored.
Optionally, the storing the target bank data to the to-be-stored location includes:
if the target bank data is full data, the target bank data is stored to the position to be stored in a covering mode;
and if the target bank data is incremental data, determining accumulated bank data according to the target bank data and historical bank data in the position to be stored, and storing the accumulated bank data to the position to be stored in a covering manner.
Optionally, the data storage table includes a plurality of tuples, each tuple includes a data value field and a data date field, the data value field is used for storing the historical banking data, and the data date field is used for storing the historical data time corresponding to the historical banking data.
Optionally, the data in the data storage table is stored in columns.
In another aspect, the present application provides a storage device for bank data, the device including: the device comprises an acquisition unit, a first determination unit and a first storage unit;
the acquisition unit is used for acquiring target bank data to be stored and target data time corresponding to the target bank data; wherein the target data time is used for identifying the generation time of the target bank data;
the first determining unit is used for determining the position of the target bank data to be stored in the data storage table according to the storage period of historical bank data in the data storage table and the target data time if the target data time is determined not to be in the data storage table according to the data storage table; the data storage table comprises historical bank data and historical data time corresponding to the historical bank data, the historical data time is used for marking the storage time of the historical bank data, and the historical bank data are stored in the position to be stored;
the first storage unit is used for storing the target bank data to the position to be stored in an overlaying mode.
Optionally, the first determining unit is specifically configured to:
determining target historical time data corresponding to the previous storage period of the target data time according to the difference between the storage period of the historical bank data in the data storage table and the target data time;
and determining the position of the target bank data to be stored in the data storage table according to the position of the target historical time data in the data storage table.
Optionally, the apparatus further includes a second determining unit and a second storing unit;
the second determining unit is configured to determine, if it is determined that the target data time is in the data storage table according to the data storage table, a to-be-stored position of the target bank data in the data storage table according to a position of the target data time in the data storage table;
the second storage unit is used for storing the target bank data to the position to be stored.
Optionally, the second storage unit is specifically configured to:
if the target bank data is full data, the target bank data is stored to the position to be stored in a covering mode;
and if the target bank data is incremental data, determining accumulated bank data according to the target bank data and historical bank data in the position to be stored, and storing the accumulated bank data to the position to be stored in a covering manner.
Optionally, the data storage table includes a plurality of tuples, each tuple includes a data value field and a data date field, the data value field is used for storing the historical banking data, and the data date field is used for storing the historical data time corresponding to the historical banking data.
Optionally, the data in the data storage table is stored in columns.
In another aspect, the present application provides a method for storing bank data, where the method includes:
acquiring target bank data to be stored and target data time corresponding to the target bank data; wherein the target data time is used for identifying the generation time of the target bank data;
determining the position of the target bank data to be stored in the data storage table according to the target data time and the storage period of the bank data in the data storage table; the data storage table comprises bank data and data time corresponding to the bank data, and the data time is used for identifying the generation time of the bank data;
and if the data time corresponding to the bank data stored in the position to be stored is different from the target data time, the target bank data is stored to the position to be stored in a covering manner.
In another aspect, the present application provides a storage device for bank data, the device including: the device comprises an acquisition unit, a determination unit and a storage unit;
the acquisition unit is used for acquiring target bank data to be stored and target data time corresponding to the target bank data; wherein the target data time is used for identifying the generation time of the target bank data;
the determining unit is used for determining the position of the target bank data to be stored in the data storage table according to the target data time and the storage period of the bank data in the data storage table; the data storage table comprises bank data and data time corresponding to the bank data, and the data time is used for identifying the generation time of the bank data;
and the storage unit is used for covering and storing the target bank data to the position to be stored if the data time corresponding to the bank data stored in the position to be stored is different from the target data time.
In another aspect, the present application provides a computer device comprising a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to perform the method of the above aspect according to instructions in the program code.
In another aspect, the present application provides a computer readable storage medium for storing a computer program for performing the method of the above aspect.
In another aspect, embodiments of the present application provide a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, causing the computer device to perform the method of the above aspect.
Compared with the prior art, the technical scheme of the application has the advantages that:
after target bank data to be stored and target data time are obtained, whether the target data time exists in a data storage table or not is judged, if the target data time is determined not to be in the data storage table, the target data time is indicated to be the first time of storing the bank data, and the position of the target bank data to be stored in the data storage table is determined according to the storage period of historical bank data and the target data time in the data storage table. Therefore, under the condition that the data storage table is full of bank data, new target bank data are directly covered in the to-be-stored position with historical bank data, namely the target bank data are covered and stored by using the position in the to-be-stored data table in a rotating mode, so that the step of deleting the historical bank data is not involved in the storage process, the historical data do not need to be deleted regularly through an additional configuration module, and the problem of performance jitter is avoided.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be 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 some embodiments described in the present application, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a flowchart of a bank data storage method provided in the present application;
FIG. 2 is a schematic diagram of a data storage table provided in an embodiment of the present application;
FIG. 3 is a schematic diagram of a data storage table according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a bank data storage device provided herein;
fig. 5 is a block diagram of a computer device according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions of the present application better understood, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, 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 application.
In the related art, there are generally two ways for storing bank data, and the following description will take the example of storing bank data every day as an example.
The first method is as follows: and adding a new record in the data storage table every day for storing the statistical result of the day, deleting the historical data exceeding the retention time limit every day, and generally deleting the historical data in a delete mode in order to ensure the stability of the data volume.
The second method comprises the following steps: two data storage tables are designed, data are inserted into one data storage table, one data storage table is inserted every day, when enough records are achieved, the other data storage table is replaced, and the two data storage tables are used in an alternating mode. If history data is stored in another data storage table before data is stored, the history data stored in the data storage table needs to be deleted by a truncate method.
However, in both of the above two modes, a module for periodically removing the historical data is required to be provided so as to delete the historical data in time, and in the process of deleting the historical data, since the bank data grows rapidly, the data is required to be deleted continuously, and the performance of the deleting operation and the consumed resources is jittered to the processing efficiency, which results in the failure of operations such as data insertion.
Based on this, an embodiment of the present application provides a bank data storage method, where after target bank data to be stored and target data time are obtained, it is determined whether the target data time exists in a data storage table, if it is determined that the target data time does not exist in the data storage table, it is described that the target data time is bank data stored for the first time, and a to-be-stored position of the target bank data in the data storage table is determined according to a storage period of historical bank data in the data storage table and the target data time, and although the to-be-stored position has the historical bank data, the historical bank data does not need to be deleted, and the target bank data is directly stored in a covering manner to the to-be-stored position. Therefore, under the condition that the data storage table is full of bank data, new target bank data are directly covered in the to-be-stored position with historical bank data, namely the target bank data are covered and stored by using the position in the to-be-stored data table in a rotating mode, so that the step of deleting the historical bank data is not involved in the storage process, the historical data do not need to be deleted regularly through an additional configuration module, and the problem of performance jitter is avoided.
A method for storing bank data according to an embodiment of the present application is described below with reference to fig. 1. Referring to fig. 1, the figure is a flowchart of a bank data storage method provided in the present application, and the method may include the following steps 101-105.
S101: and acquiring target bank data to be stored and target data time corresponding to the target bank data.
The target bank data is bank data waiting to be stored in the data storage table, and the target data time is used for identifying the generation time of the target bank data. For example, today, the data is 2022 year 1 month 10 day, and the bank data generated this day is stored as target bank data in the data storage table while waiting, and the target data time corresponding to the target bank data is 2022 year 1 month 10 day.
S102: and if the target data time is determined not to be in the data storage table according to the data storage table, determining the position of the target bank data to be stored in the data storage table according to the storage period of the historical bank data in the data storage table and the target data time.
The data storage table comprises historical bank data and historical data time, the historical bank data is the bank data already stored in the data storage table, and the historical data time is used for identifying the generation time of the historical bank data. For example, today is 10/1/2022, and the bank data generated by yesterday is already stored in the data storage table, so the bank data generated by 9/1/2022 and already stored in the data storage table is the historical bank data, and the data time corresponding to the historical bank data is the data time corresponding to 1/9/2022.
The data storage table includes historical bank data and historical data time corresponding to the historical bank data, and in most cases, the data storage table is filled with the historical bank data and the historical data time corresponding to the historical bank data. As a possible implementation manner, the data storage table includes a plurality of tuples, and each tuple includes a data value field and a data date field, where the data value field is used to store historical banking data, and the data date field is used to store historical data time corresponding to the historical banking data.
As one possible implementation, the data in the data storage table may be stored in columns, for example, the data value field is a column and the data date field is a column. Therefore, the database searches data in a row mode, and the bank data are stored in columns, so that the searching speed of the database can be increased, and the searching efficiency is improved. The following description will be made in conjunction with fig. 2.
As shown in fig. 2, the figure is a schematic diagram of a data storage table provided in an embodiment of the present application, where the data storage table is a table for an index a001, and includes two fields, namely a data date field and a data value field, where a field value corresponding to the data date field is historical data time, and a field value corresponding to the data value field is historical bank data.
If the acquired target bank data time is 2022, 1, month 10, 20220110 is not in the data storage table, but the data storage table shown in fig. 2 has been filled with historical bank data and historical data time, the data storage table has no place to continue storing the target bank data generated 2022, 1, month 10. In the related art, historical bank data stored in 3 days at 1 month and 2022 needs to be deleted, so that target bank data generated in 10 days at 1 month and 2022 needs to be stored, but a module responsible for deleting the history periodically is additionally arranged in the mode, and moreover, as the bank data is increased rapidly, performance jitter is generated on processing efficiency in the deleting process.
Based on this, the embodiment of the application does not delete the historical bank data stored in the data storage table at 1 month and 3 days 2022 by an additional deleting action, but determines the to-be-stored position of the target bank data in the data storage table according to the storage period of the historical bank data in the data storage table and the target data time, so as to store the target bank data to the to-be-stored position in a covering manner. Therefore, by storing the target bank data in an overlaying manner, the target bank data can be stored in the data storage table while the historical bank data is clear without additional deleting operation.
As a possible implementation manner, in this embodiment, a specific implementation manner of S102 is provided, that is, a specific implementation manner of determining, according to a storage period of historical bank data in a data storage table and a target data time, a to-be-stored location of the target bank data in the data storage table, specifically refer to S1021-S1022.
S1021: and determining target historical time data corresponding to the previous storage period relative to the target data time according to the difference between the storage period of the historical bank data in the data storage table and the target data time.
S1022: and determining the position of the target bank data to be stored in the data storage table according to the position of the target historical time data in the data storage table.
Continuing with the example of fig. 2, the target data time is 10 days in 1 month in 2022, 20220110 is not in the data storage table, and the storage period of the historical bank data in the data storage table in fig. 2 is 7 days, so the determined target historical time data is 1 month and 3 days in 2022, and the determined position to be stored is the position corresponding to the 1 month and 3 days in 2022 and used for storing the bank data, that is, the position of the field value corresponding to the 1 field of the data value.
S103: and storing the target bank data to a position to be stored in an overlaying manner.
S104: and if the target data time is determined in the data storage table according to the data storage table, determining the position of the target bank data to be stored in the data storage table according to the position of the target data time in the data storage table.
If the target data time is determined in the data storage table according to the data storage table, which indicates that the target data time is already used as historical time data, and the bank data is already stored in the data storage table at least once, the to-be-stored position of the target bank data in the data storage table can be determined according to the position of the target data time in the data storage table, so that the target bank data can be stored in the to-be-stored position.
Continuing with fig. 2 as an example, the target data time is 2022 year 1, month 9, and 20220109 determines that the location to be stored is the location for storing bank data corresponding to 2022 year 1, month 9, that is, the location of the field value corresponding to the data value 7 field.
S105: and storing the target bank data to a position to be stored.
As a possible implementation manner, in this embodiment of the present application, a specific implementation manner of S105, that is, storing the target bank data to the location to be stored is provided, specifically refer to S1051-S1052.
S1051: and if the target bank data is full data, the target bank data is stored to the position to be stored in a covering mode.
S1052: and if the target bank data is incremental data, determining accumulated bank data according to the target bank data and historical bank data in the position to be stored, and storing the accumulated bank data to the position to be stored in a covering manner.
The full data is the whole data, and the target bank data generated in 1 month and 9 days of 2022 is 100. The incremental data is an incremental value of the data of this time relative to the data of the last time, and if the bank data generated for the first time on 1/9/2022 is 100 and the bank data generated for the second time on 1/9/2022 is 150, the target bank data is 50.
If the target bank data is full data, the target bank data can be directly stored in a storage position in a covering mode, if the target bank data is incremental data, the accumulated bank data is determined according to the target bank data and historical bank data in the position to be stored, namely, the previous data relative to the target bank data, and at the moment, the accumulated bank data is full data and can be directly stored in the position to be stored in a covering mode.
According to the technical scheme, after the target bank data to be stored and the target data time are obtained, whether the target data time exists in the data storage table is judged, if the target data time is determined not to be in the data storage table, the target data time is the first time of storing the bank data, the position, to be stored, of the target bank data in the data storage table is determined according to the storage period and the target data time of the historical bank data in the data storage table, although the historical bank data exists in the position to be stored, the historical bank data does not need to be deleted, and the target bank data are directly stored in the position to be stored in a covering mode. Therefore, under the condition that the data storage table is full of bank data, new target bank data are directly covered in the to-be-stored position with historical bank data, namely the target bank data are covered and stored by using the position in the to-be-stored data table in a rotating mode, so that the step of deleting the historical bank data is not involved in the storage process, the historical data do not need to be deleted regularly through an additional configuration module, and the problem of performance jitter is avoided.
Next, a description is given of another bank data storage method provided in the embodiment of the present application. The method may comprise the following steps 201-203:
s201: and acquiring target bank data to be stored and target data time corresponding to the target bank data.
The target bank data is bank data waiting to be stored in the data storage table, and the target data time is used for identifying the generation time of the target bank data. For example, today, the data is 2022 year 1 month 10 day, and the bank data generated this day is stored as target bank data in the data storage table while waiting, and the target data time corresponding to the target bank data is 2022 year 1 month 10 day.
S202: and determining the position of the target bank data to be stored in the data storage table according to the target data time and the storage period of the bank data in the data storage table.
The data storage table includes bank data and data time corresponding to the bank data, and the data time is used for identifying the generation time of the bank data, for example, the bank data (bank data corresponding to the data time) stored in 1 month and 10 days (data time) of 2022.
For example, if the storage period of the bank data in the data storage table is one week, the data storage table stores seven days of data, that is, the bank data on monday to sunday. The target data time can be determined as the day of the week through the calendar, so that the position where the target bank data is to be stored in the data storage table is determined, and if the target data time is tuesday, the position where the target bank data is to be stored corresponds to the position where the tuesday is located.
For another example, if the storage period of the bank data in the data storage table is one ten days, the data storage table stores 11 days of data, that is, the bank data in the first ten days is bank data No. 1 to 10, the bank data in the middle ten days is bank data No. 11 to 20, and the bank data in the last ten days is bank data No. 21 to 31 (if any). The target data time is determined to be the first day of the first, middle or last ten days by taking the remainder of 10 and the like, so that the position of the target bank data to be stored in the data storage table is determined, and if the target data time is 3 month and 12 th, the position to be stored corresponds to the position of the second day of the middle day.
For another example, if the storage period of the bank data in the data storage table is one month, the data storage table stores data of one month, that is, bank data of numbers 1 to 31 (if any), the location to be stored of the target bank data in the data storage table can be determined by the last bit of the date, and if the time of the target data is 3 months and 12 numbers, the location to be stored corresponds to the location of number 12.
S203: and if the data time corresponding to the bank data stored in the position to be stored is different from the target data time, the target bank data is stored to the position to be stored in a covering manner.
If it is determined that the data time corresponding to the bank data stored in the to-be-stored position is different from the target data time, it is described that the bank data is stored for the first time for the target data time, and although the to-be-stored position has the historical bank data, the historical bank data does not need to be deleted, and the target bank data is directly stored in the to-be-stored position in a covering manner. Therefore, under the condition that the data storage table is full of bank data, new target bank data are directly covered in the to-be-stored position with historical bank data, namely the target bank data are covered and stored by using the position in the to-be-stored data table in a rotating mode, so that the step of deleting the historical bank data is not involved in the storage process, the historical data do not need to be deleted regularly through an additional configuration module, and the problem of performance jitter is avoided.
S204: and if the data time corresponding to the bank data stored in the position to be stored is the same as the target data time, storing the target bank data to the position to be stored.
If it is determined that the data time corresponding to the bank data stored in the to-be-stored location is the same as the target data time, which indicates that the target data time has already stored the bank data at least once in the data storage table, the target bank data may be stored in the to-be-stored location according to the manner of S1051-S1052. As a possible implementation manner, the data storage table includes a plurality of tuples, each tuple includes a data value field and a data date field, the data value field is used to store the historical banking data, and the data date field is used to store the historical data time corresponding to the historical banking data.
As a possible implementation, the data in the data storage table is stored in columns.
In order to make the technical solution provided by the embodiment of the present application clearer, the following describes a bank data storage method provided by the embodiment of the present application with two examples in conjunction with fig. 2 and fig. 3.
As shown in fig. 2, the storage period of the bank data in the data storage table shown in fig. 2 is 7 days, and the data storage table includes 7 tuples, each tuple includes two columns, which respectively identify a data value field and a data date field. And storing the bank data into a data storage table according to the week corresponding to the data time.
03/2022/01/03 is monday, the corresponding bank data is stored in tuple 1, and so on, 09/2022/01/09 is sunday, and the corresponding bank data is stored in tuple 7. And then, rotating to monday from 2022 year 01 month 10, corresponding to the tuple in which monday is located, namely, the tuple corresponding to 2022 year 01 month 03 day, wherein the data date field 20220103 in the tuple is different from the target data time 20220110, and storing the target bank data in an overlay manner to the position to be stored, namely, the position corresponding to the data value field in the tuple in which monday is located. . The latest 7-day history data can be kept every time when the rotation is continued.
Fig. 3 is a schematic diagram of a data storage table according to an embodiment of the present application. The storage period of the bank data in the data storage table shown in fig. 2 is 1 st day, and the data storage table includes 11 tuples, each tuple includes two columns, which respectively identify a data value field and a data date field. And storing the bank data into a data storage table according to the last bit corresponding to the data time.
The 01 st day of the 01 th month in 2022 is the 1 st day of the last ten days, the corresponding bank data is stored in the tuple 1, and so on, the 10 th day of the 01 th month in 2022 is the 10 th day of the last ten days, and the corresponding bank data is stored in the tuple 10. And then, rotating to the 1 st day of the middle ten days from the 11 th day of the 2022 year 01 month, wherein the tuple is the tuple on the first day, namely the tuple 1 corresponding to the 01 th day of the 2022 year 01 month, and the data date field 20220101 in the tuple is different from the target data time 20220110, and storing the target bank data to the position to be stored in an overlaying manner, namely the position corresponding to the data value field in the tuple on the first day. And then, rotating to the 11 th day of the last ten days from 31/01/2022, and storing the target bank data to a position to be stored in a covering manner, namely a position corresponding to the data value field in the tuple on the eleventh day, wherein the tuple corresponds to the tuple on the eleventh day, namely the tuple 11 corresponding to 31/12/2021, and the data date field 20211231 in the tuple is different from the target data time 20220131.
In addition to the bank data storage method provided in the embodiments of the present application, a bank data storage device is also provided, as shown in fig. 4, including: an acquisition unit 401, a first determination unit 402, and a first storage unit 403;
the acquiring unit 401 is configured to acquire target bank data to be stored and target data time corresponding to the target bank data; wherein the target data time is used for identifying the generation time of the target bank data;
the first determining unit 402 is configured to determine, if it is determined that the target data time is not in the data storage table according to the data storage table, a to-be-stored position of the target bank data in the data storage table according to a storage period of historical bank data in the data storage table and the target data time; the data storage table comprises historical bank data and historical data time corresponding to the historical bank data, the historical data time is used for marking the storage time of the historical bank data, and the historical bank data are stored in the position to be stored;
the first storage unit 403 is configured to store the target bank data in the to-be-stored location in an overlay manner.
As a possible implementation manner, the first determining unit 402 is specifically configured to:
determining target historical time data corresponding to the previous storage period of the target data time according to the difference between the storage period of the historical bank data in the data storage table and the target data time;
and determining the position of the target bank data to be stored in the data storage table according to the position of the target historical time data in the data storage table.
As a possible implementation manner, the apparatus further includes a second determining unit and a second storing unit;
the second determining unit is configured to determine, if the target data time is determined in the data storage table according to the data storage table, a to-be-stored position of the target bank data in the data storage table according to a position of the target data time in the data storage table;
the second storage unit is used for storing the target bank data to the position to be stored.
As a possible implementation manner, the second storage unit is specifically configured to:
if the target bank data is full data, the target bank data is stored to the position to be stored in a covering mode;
and if the target bank data is incremental data, determining accumulated bank data according to the target bank data and historical bank data in the position to be stored, and storing the accumulated bank data to the position to be stored in a covering manner.
As a possible implementation manner, the data storage table includes a plurality of tuples, each tuple includes a data value field and a data date field, the data value field is used for storing the historical banking data, and the data date field is used for storing the historical data time corresponding to the historical banking data.
As a possible implementation, the data in the data storage table is stored in columns.
According to the technical scheme, after the target bank data to be stored and the target data time are obtained, whether the target data time exists in the data storage table is judged, if the target data time is determined not to be in the data storage table, the target data time is the first time of storing the bank data, the position, to be stored, of the target bank data in the data storage table is determined according to the storage period and the target data time of the historical bank data in the data storage table, although the historical bank data exists in the position to be stored, the historical bank data does not need to be deleted, and the target bank data are directly stored in the position to be stored in a covering mode. Therefore, under the condition that the data storage table is full of bank data, new target bank data are directly covered in the to-be-stored position with historical bank data, namely the target bank data are covered and stored by using the position in the to-be-stored data table in a rotating mode, so that the step of deleting the historical bank data is not involved in the storage process, the historical data do not need to be deleted regularly through an additional configuration module, and the problem of performance jitter is avoided.
The embodiment of the application provides a bank data storage device besides the bank data storage method, and the device comprises: the device comprises an acquisition unit, a determination unit and a storage unit;
the acquisition unit is used for acquiring target bank data to be stored and target data time corresponding to the target bank data; the target data time is used for identifying the generation time of the target bank data;
the determining unit is used for determining the position of the target bank data to be stored in the data storage table according to the target data time and the storage period of the bank data in the data storage table; the data storage table comprises bank data and data time corresponding to the bank data, and the data time is used for identifying the generation time of the bank data;
and the storage unit is used for covering and storing the target bank data to the position to be stored if the data time corresponding to the bank data stored in the position to be stored is different from the target data time.
For the related points, reference may be made to the foregoing method embodiments, which are not described herein again.
An embodiment of the present application further provides a computer device, referring to fig. 5, which shows a structural diagram of a computer device provided in an embodiment of the present application, and as shown in fig. 5, the device includes a processor 510 and a memory 520:
the memory 510 is used for storing program codes and transmitting the program codes to the processor;
the processor 520 is configured to execute any one of the bank data storage methods provided by the above embodiments according to instructions in the program code.
The embodiment of the present application provides a computer-readable storage medium, where the computer-readable storage medium is used for storing a computer program, and the computer program is used for executing any one of the bank data storage methods provided by the foregoing embodiments.
Embodiments of the present application also provide a computer program product or computer program comprising computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to cause the computer device to execute the bank data storage method provided in the various alternative implementations of the above aspects.
It should be noted that the bank data storage method and the related device provided by the invention can be used in the field of big data or the field of finance. The foregoing is merely an example, and does not limit the application field of the bank data storage method and the related apparatus provided by the present invention.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. The present application can further combine to provide more implementations on the basis of the implementations provided by the above aspects. In particular, the apparatus embodiments are substantially similar to the method embodiments and therefore are described in a relatively simple manner, and reference may be made to some of the description of the method embodiments for relevant points. The above-described apparatus embodiments are merely illustrative, and the units and modules described as separate components may or may not be physically separate. In addition, some or all of the units and modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
The foregoing is directed to embodiments of the present application and it is noted that numerous modifications and adaptations may be made by those skilled in the art without departing from the principles of the present application and are intended to be within the scope of the present application.
Claims (10)
1. A method for storing bank data is characterized by comprising the following steps:
acquiring target bank data to be stored and target data time corresponding to the target bank data; wherein the target data time is used for identifying the generation time of the target bank data;
if the target data time is determined not to be in the data storage table according to the data storage table, determining the position of the target bank data to be stored in the data storage table according to the storage period of historical bank data in the data storage table and the target data time; the data storage table comprises historical bank data and historical data time corresponding to the historical bank data, the historical data time is used for marking the generation time of the historical bank data, and the historical bank data are stored in the position to be stored;
and storing the target bank data to the position to be stored in an overlaying manner.
2. The method according to claim 1, wherein the determining the location of the target bank data to be stored in the data storage table according to the storage period of the historical bank data in the data storage table and the target data time comprises:
determining target historical time data corresponding to the previous storage period of the target data time according to the difference between the storage period of the historical bank data in the data storage table and the target data time;
and determining the position of the target bank data to be stored in the data storage table according to the position of the target historical time data in the data storage table.
3. The method of claim 1, further comprising:
if the target data time is determined in the data storage table according to the data storage table, determining the position of the target bank data to be stored in the data storage table according to the position of the target data time in the data storage table;
and storing the target bank data to the position to be stored.
4. The method according to claim 3, wherein the storing the target bank data to the location to be stored comprises:
if the target bank data is full data, the target bank data is stored to the position to be stored in a covering mode;
and if the target bank data is incremental data, determining accumulated bank data according to the target bank data and historical bank data in the position to be stored, and storing the accumulated bank data to the position to be stored in a covering manner.
5. The method according to claim 1, wherein the data storage table comprises a plurality of tuples, each tuple comprising a data value field and a data date field, the data value field being used for storing the historical banking data, and the data date field being used for storing the historical data time corresponding to the historical banking data.
6. The method of any of claims 1-5, wherein the data in the data storage table is stored in columns.
7. A method for storing bank data is characterized by comprising the following steps:
acquiring target bank data to be stored and target data time corresponding to the target bank data; wherein the target data time is used for identifying the generation time of the target bank data;
determining the position of the target bank data to be stored in the data storage table according to the target data time and the storage period of the bank data in the data storage table; the data storage table comprises bank data and data time corresponding to the bank data, and the data time is used for identifying the generation time of the bank data;
and if the data time corresponding to the bank data stored in the position to be stored is different from the target data time, the target bank data is stored to the position to be stored in a covering manner.
8. An apparatus for storing banking data, the apparatus comprising: the device comprises an acquisition unit, a first determination unit and a first storage unit;
the acquisition unit is used for acquiring target bank data to be stored and target data time corresponding to the target bank data; wherein the target data time is used for identifying the generation time of the target bank data;
the first determining unit is used for determining the position of the target bank data to be stored in the data storage table according to the storage period of historical bank data in the data storage table and the target data time if the target data time is determined not to be in the data storage table according to the data storage table; the data storage table comprises historical bank data and historical data time corresponding to the historical bank data, the historical data time is used for marking the storage time of the historical bank data, and the historical bank data are stored in the position to be stored;
the first storage unit is used for storing the target bank data to the position to be stored in an overlaying mode.
9. An apparatus for storing bank data, the apparatus comprising: the device comprises an acquisition unit, a determination unit and a storage unit;
the acquisition unit is used for acquiring target bank data to be stored and target data time corresponding to the target bank data; wherein the target data time is used for identifying the generation time of the target bank data;
the determining unit is used for determining the position of the target bank data to be stored in the data storage table according to the target data time and the storage period of the bank data in the data storage table; the data storage table comprises bank data and data time corresponding to the bank data, and the data time is used for identifying the generation time of the bank data;
and the storage unit is used for covering and storing the target bank data to the position to be stored if the data time corresponding to the bank data stored in the position to be stored is different from the target data time.
10. A computer device, the device comprising a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to perform the method of any one of claims 1-6 or the method of claim 7 according to instructions in the program code.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210689245.4A CN114942929A (en) | 2022-06-17 | 2022-06-17 | Bank data storage method and related device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210689245.4A CN114942929A (en) | 2022-06-17 | 2022-06-17 | Bank data storage method and related device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114942929A true CN114942929A (en) | 2022-08-26 |
Family
ID=82910839
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210689245.4A Pending CN114942929A (en) | 2022-06-17 | 2022-06-17 | Bank data storage method and related device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114942929A (en) |
-
2022
- 2022-06-17 CN CN202210689245.4A patent/CN114942929A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7853770B2 (en) | Storage system, data relocation method thereof, and recording medium that records data relocation program | |
US7801932B2 (en) | Undo hints to speed up segment extension and tuning of undo retention | |
US20070118547A1 (en) | Efficient index versioning in multi-version databases | |
US20130179476A1 (en) | Scalable billing usage data storage | |
CN108875077B (en) | Column storage method and device of database, server and storage medium | |
CN102867071A (en) | Management method for massive network management historical data | |
CN113111129A (en) | Data synchronization method, device, equipment and storage medium | |
CN1794181A (en) | Finally agent optimization method and system of source in reorder two-stage refering | |
CN107992492B (en) | Data block storage method, data block reading method, data block storage device, data block reading device and block chain | |
CN102893265A (en) | Managing storage of individually accessible data units | |
CN107608860A (en) | A kind of method, apparatus, the equipment of error log classification storage | |
US20110145255A1 (en) | Systems and methods for distribution of data in a database index | |
US20080162591A1 (en) | Method of Logging Transactions and a Method of Reversing a Transaction | |
CN112269791A (en) | Construction method of account book index skip list and block chain account book processing method using same | |
US7269589B2 (en) | Database managing method and system having data backup function and associated programs | |
CN114942929A (en) | Bank data storage method and related device | |
CN109725852B (en) | Current-limiting counting optimization method and terminal | |
CN102495838B (en) | Data processing method and data processing device | |
US7958090B2 (en) | Method, system, and computer program product for implementing back up history cleanup operations for a database management system | |
CN113486021B (en) | Method and device for determining daily average balance of account in distributed banking system | |
CN110674214A (en) | Big data synchronization method and device, computer equipment and storage medium | |
US8296336B2 (en) | Techniques for efficient dataloads into partitioned tables using swap tables | |
CN116775667B (en) | Associated data processing method and device | |
US7996366B1 (en) | Method and system for identifying stale directories | |
CN118445155B (en) | Real-time data change data capturing platform |
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 |