Data processing method and device, equipment, readable storage medium and program product
By determining target fields for cold data and storing them in a separate table, the method addresses inefficiencies in traditional storage architectures, optimizing resource use and minimizing development and maintenance costs.
Patent Information
- Application Number
- CN202410891296.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-03
- Publication Date
- 2024-12-17
AI Technical Summary
Traditional single storage architectures struggle with data access efficiency and storage space waste due to varying data access frequencies, especially for data sets with significant differences in popularity, leading to storage bottlenecks and resource inefficiencies.
A data processing method that determines target fields for cold data based on configuration parameters, generates a query statement to extract cold data from a first data table, and stores it in a second data table, thereby filtering out unnecessary data storage, reducing the need for point-to-point code development and system upgrades.
This approach saves network interface and hard disk storage resources by selectively storing only relevant data, achieving resource optimization and reducing development and maintenance costs.
Smart Images

Figure CN119149559A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data processing method, apparatus, device, computer-readable storage medium, and computer program product. Background Art
[0002] With the development of computer technology, the amount of data carried by databases in the big data environment has shown an explosive growth trend, which has brought great storage pressure and access efficiency challenges. The traditional single storage architecture is difficult to meet the needs of various data access frequencies, especially for those data sets with significant differences in access popularity, which easily leads to storage space waste and access bottlenecks. Summary of the invention
[0003] Based on this, the embodiments of the present application provide a data processing method, apparatus, device, readable storage medium and program product that can save hard disk storage resources.
[0004] In a first aspect, the present application provides a data processing method, the method comprising:
[0005] Determine the target field corresponding to the cold data according to the configuration parameters of the first data table;
[0006] Generate a query statement according to the target field, and acquire cold data from the first data table based on the query statement;
[0007] The cold data in the first data table is stored in the second data table.
[0008] In a second aspect, the present application further provides a data processing device, the device comprising:
[0009] A determination module, used to determine a target field corresponding to the cold data according to configuration parameters of the first data table;
[0010] A query module, used to generate a query statement according to the target field, and obtain cold data from the first data table based on the query statement;
[0011] The storage module is used to store the cold data in the first data table into the second data table.
[0012] In a third aspect, the present application further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method of the first aspect when executing the computer program.
[0013] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the method of the first aspect when executed by a processor.
[0014] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, which implements the steps of the method of the first aspect when executed by a processor.
[0015] The data processing method, device, equipment, readable storage medium and program product provided by the present application first determine the target field corresponding to the cold data according to the configuration parameters of the first data table, then generate a query statement according to the target field, and then obtain the cold data from the first data table according to the query statement, store the cold data in the first data table in the second data table, filter out the cold data based on the target field, and store the cold data in the second data table. By determining the target field through the configuration parameters and filtering the cold data based on the target field, it is only necessary to select the cold data corresponding to the target field for storage, and it is not necessary to store the cold data of all fields, thus saving the network interface resources occupied by the data transmission of the redundant fields and the hard disk storage resources occupied by the storage of the redundant data. Furthermore, it is realized by the configuration parameters, and there is no need for point-to-point code development and system upgrade, thus realizing the generalization of configuration and saving the computer hardware resources and software resources consumed by the re-development. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 is a flow chart of a data processing method in one embodiment;
[0018] Figure 2 A schematic diagram of a process of adding a candidate data table to a task queue and obtaining a first data table in one embodiment;
[0019] Figure 3 A schematic diagram of a process for determining a total field length score of a target field in one embodiment;
[0020] Figure 4 It is a flow chart of using a different database separation strategy in one embodiment to store the cold data corresponding to the target field into the second data table;
[0021] Figure 5 is a flow chart of a data processing method in another embodiment;
[0022] Figure 6 is a structural block diagram of a data processing device in one embodiment;
[0023] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0025] The separation of hot and cold data in related data tables usually requires point-to-point code development and system upgrades, and manual continuous monitoring is required in the later stage. As the number of hot and cold separated tables increases, the entire system becomes difficult to maintain and requires a large amount of hard disk storage resources.
[0026] To this end, the present application provides a data processing method, which determines the target field corresponding to the cold data according to the configuration parameters of the first data table, generates a query statement according to the target field, obtains the cold data from the first data table according to the query statement, stores the cold data in the first data table in the second data table, filters out the cold data based on the target field, and stores the cold data in the second data table. By determining the target field through configuration parameters and filtering the cold data based on the target field, it is only necessary to select the cold data corresponding to the target field for storage, and it is not necessary to store the cold data of all fields, which saves network interface resources and hard disk storage resources. Moreover, it is realized by configuring parameters, and there is no need for point-to-point code development and system upgrades, which realizes configuration generalization and reduces development costs and maintenance costs.
[0027] In an exemplary embodiment, Figure 1 As shown, a data processing method is provided, and the method is applied to a computer device as an example for explanation. The computer device can be a terminal or an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The data processing method includes the following steps 102 to 106. Among them:
[0028] Step 102: Determine the target field corresponding to the cold data according to the configuration parameters of the first data table.
[0029] Among them, hot / cold data separation refers to dividing the database into a cold database and a hot database when processing data, and the cold database is used to store cold data. The hot database is used to store hot data. The configuration parameters of the first data table can be obtained by parsing the configuration data of the first data table to be hot / cold separated. Hot / cold data separation is to separate the cold data from the hot data in the first data table, and the cold data can be stored in the second data table, and then the cold data can be deleted from the first data table.
[0030] Cold data refers to data in the first data table whose timeliness requirement or access frequency meets preset conditions. Hot data refers to data in the first data table whose timeliness requirement or access frequency does not meet preset conditions.
[0031] Taking the example that cold data is data in the first data table whose timeliness requirement meets the preset conditions, the cold data may be data in the first data table whose timeliness requirement is less than the preset threshold. The hot data may be data in the first data table whose timeliness requirement is greater than or equal to the preset threshold. The preset threshold may be set as needed. For example, the timeliness requirement of the data generated by the preset number of days closest to the current moment may be set to be greater than or equal to the preset threshold, and the data generated by the preset number of days closest to the current moment may be determined as hot data; the timeliness requirement of the data generated before the preset number of days closest to the current moment may be set to be less than the preset threshold, and the data generated before the preset number of days closest to the current moment may be determined as cold data. The preset number of days may be 1 day, 5 days, 7 days, 10 days, 15 days, 20 days, 30 days, etc., but is not limited thereto.
[0032] Taking the example that cold data is data in the first data table whose access frequency meets the preset condition, cold data may be data in the first data table whose access frequency is lower than the access frequency threshold, and hot data may be data in the first data table whose access frequency is higher than or equal to the access frequency threshold. The access frequency threshold may be set as needed.
[0033] Optionally, a task queue can be set. After receiving the hot and cold separation request of the candidate data table, the computer device parses the configuration data of the candidate data table to obtain the configuration parameters, generates a pending task according to the configuration parameters, adds the pending task to the task queue, and then obtains the pending tasks from the task queue in sequence for processing. The configuration data can be JSON (JavaScript Object Notation, JS key-value pair data) configuration data, which is a lightweight data exchange format. The configuration parameters may include the hot table name, the cold table name, the target field, and the number of days ago of hot data to be queried.
[0034] The target field may be a field that needs to be cold processed. The target field may include, for example, an identifier, a name, a description, a generation time, etc., but is not limited thereto, such as "identifier id": "integer int", "name name": "character varchar", "description description": "character varchar", "generation time create_time": "date datetime". Cold processing refers to migrating the data under the relevant fields from the first data table to the second data table. Furthermore, the configuration parameters may also include one or more of the following parameters: task priority, separation type parameters for characterizing the hot and cold separation types, data sources for querying hot data, data sources for deleting hot data, hot table time index fields, cold data write data sources, and duration for executing hot and cold separation. It can be understood that the first data table is the hot table.
[0035] Optionally, the computer device determines the target field corresponding to the cold data that needs to be cold processed according to the configuration parameters of the first data table.
[0036] Step 104: Generate a query statement according to the target field, and obtain cold data from the first data table based on the query statement.
[0037] The query statement may be a SQL (Structured Query Language) statement.
[0038] Optionally, the computer device generates a query statement according to the target field in the configuration parameter, and acquires cold data corresponding to the target field from the first data table based on the query statement.
[0039] Optionally, the computer device may search for data under the target field row by row from the first data table according to a query statement, and then obtain cold data corresponding to the target field.
[0040] Step 106: Store the cold data in the first data table into the second data table.
[0041] Optionally, the computer device may store the cold data corresponding to the target field in the second data table according to the hot and cold separation type. The hot and cold separation type may include same-database separation and different-database separation. Same-database separation means that the first data table and the second data table are located in the same database, and the cold data in the first data table is stored in the second data table in the same database. Different-database separation means that the first data table and the second data table are located in different databases, and the cold data in the first data table in the first database is stored in the second data table in the second database.
[0042] The data processing method provided in this embodiment first determines the target field corresponding to the cold data according to the configuration parameters of the first data table, then generates a query statement according to the target field, obtains the cold data from the first data table according to the query statement, stores the cold data in the first data table in the second data table, filters out the cold data based on the target field, and stores the cold data in the second data table. By determining the target field through the configuration parameters and filtering the cold data based on the target field, it is only necessary to select the cold data corresponding to the target field for storage, and it is not necessary to store the cold data of all fields, thus saving network interface resources and hard disk storage resources. Furthermore, by implementing the configuration parameters, it is not necessary to carry out point-to-point code development and system upgrades, thus realizing configuration generalization and reducing development and maintenance costs.
[0043] It is understandable that before determining the target field corresponding to the cold data according to the configuration parameters of the first data table, the candidate data table may be added to the task queue first, and then the candidate data tables are sequentially obtained from the task queue according to the task priority of the candidate data table to perform cold and hot separation processing. Figure 2 As shown, the above data processing method also includes:
[0044] Step 202: determine a candidate data table, and determine the task priority of the candidate data table according to the configuration parameters of the candidate data table.
[0045] Optionally, the computer device may periodically determine the candidate data table, obtain configuration data of the candidate data table, parse the configuration data of the candidate data table, obtain configuration parameters of the candidate data table, and determine the task priority of the candidate data table according to the configuration parameters of the candidate data table.
[0046] Among them, the configuration data can be JSON configuration data. It is understandable that the computer device can periodically obtain the configuration data of the candidate data table to be separated from hot and cold, or it can simultaneously obtain the configuration data of one or more candidate data tables to be separated from hot and cold, and then parse the JSON configuration data of the candidate data table to obtain the configuration parameters of the candidate data table. The configuration parameters may include the hot table name, the cold table name, the target field (the field to be cold processed), the number of days ago of the hot data to be queried, the task priority, and may also include one or more of the separation type parameters used to characterize the hot and cold separation type, the data source for querying hot data, the data source for deleting hot data, the hot table time index field, the cold data write data source, the duration of executing hot and cold separation, and the like.
[0047] Optionally, the computer device determines the task priority of the candidate data table according to the configuration parameters of the candidate data table.
[0048] Step 204: Add the data table identifier of the candidate data table to the task queue in descending order of task priority.
[0049] Optionally, the computer device adds the data identification of the candidate data table to the task queue in the order of task priority from high to low. Optionally, the computer device can compare the task priority of the candidate data table with the task priority of the data table already in the task queue one by one, and then add the data table identification of the candidate data table to the task queue according to the comparison result. The data table identification is used to uniquely identify the data table. The data table identification of the candidate data table is used to uniquely identify the candidate data table. For example, the task priority of the existing data table A in the task queue is p0, the task priority of data table B is p2, the task priority of data table C is p3, the task priority of data table D is p4, and the task priority of the determined candidate data table E is p1, then the data identification of the candidate data table E is added to the data identification of data table A after the data identification, and is located before the data identification of data table B, and the order of the data table identification of the data table stored in the task queue is A, E, B, C, D. In a possible implementation, the task queue is a first-in, first-out queue.
[0050] Step 206 , obtaining target table identifiers from the task queue in sequence, and determining the candidate data table corresponding to the target table identifier as the first data table.
[0051] Optionally, the computer device sequentially obtains the target table identifier from the task queue, and determines the candidate data table corresponding to the target table identifier as the first data table. The target table identifier may be any data table identifier in the task queue.
[0052] Because the data table identifiers in the task queue are sorted from high to low according to the task priority, the corresponding candidate data tables are obtained in sequence according to the task priority as the first data table for cold and hot separation processing to ensure that the business table can process cold data as soon as possible.
[0053] In actual applications, the number of rows queried each time may be limited in the process of querying cold data from the first data table according to the query statement to improve query efficiency, so the target limit length may be increased in the query statement.
[0054] In an exemplary embodiment, based on the query statement, cold data is obtained from the first data table, including: determining the total field length score of the target field, and determining the target limit length according to the total field length score of the target field; adding the target limit length to the query statement to obtain an updated query statement; and obtaining cold data from the first data table according to the updated query statement.
[0055] Optionally, the computer device can determine the total field length score of the target field based on the total field length of the target field in the first data table, the number of rows of the target field and a preset maximum score value, and then determine the target limit length based on the total field length score of the target field, and add the target limit length to the query statement to obtain an updated query statement. According to the updated query statement, each time cold data with the target limit length number of rows is queried from the first data table, the queried cold data is summarized to obtain the total cold data.
[0056] Optionally, the updated query statement is used to obtain the cold data corresponding to the target field from the first data table. Since the query statement includes the target limit length, the number of rows in the first data table each time does not exceed the target limit length, and the cold data within the target limit length range of each query can be obtained. For example, if the target limit length is 900 rows and the total number of rows in the first data table is 2000 rows, the query is divided into three times, the first query range is from row 1 to row 900, the second query range is from row 901 to row 1800, and the third query range is from row 1801 to row 2000. The cold data within the target length range of each query is accumulated to obtain all the cold data corresponding to the fields to be cold processed obtained from the first data table.
[0057] By limiting the length of each query, the efficiency of each query can be improved. When an abnormal query result occurs, the query range can be re-queried without re-querying all the data, which saves query time and improves query efficiency.
[0058] In an exemplary embodiment, the total field length score of the target field can be determined based on the total field length of the target field in the first data table, the number of rows of the target field, and a preset maximum score value. Figure 3 As shown, determine the total field length score of the target field, including:
[0059] Step 302, determine the sum of the field lengths of the target fields in the Lth row of the first data table, where L is any integer from 1 to M, where M represents the total number of rows of the target fields in the first data table, and M is a natural number.
[0060] The total number of rows of the target field can be M. If M is 1, the sum of the lengths of the fields in the row is calculated. If M is greater than 1, the sum of the lengths of the fields in each row of the M rows is calculated. M is a natural number.
[0061] Optionally, the computer device may determine the sum of the field lengths of the target fields in the Lth row in the first data table, where L may be any integer from 1 to M. The computer device may determine the sum of the field lengths of the target fields in each row row by row starting from the first row in the first data table until the sum of the field lengths of the target fields in all rows is obtained.
[0062] Step 304: determine the total field length of the target field according to the sum of the field lengths of the target fields from the 1st row to the Mth row.
[0063] Optionally, the computer device adds the sum of the field lengths of the target fields from the 1st row to the Mth row to obtain a total, and the total can be determined as the total field length of the target field. The total can also be multiplied by a preset coefficient, or divided by a preset coefficient to obtain the total field length of the target field, but is not limited to this.
[0064] Step 306, determining the field length score of the target field according to the field length, the number of M rows and the preset maximum score value.
[0065] Optionally, the computer device may divide the total length of the field by M, and then divide it by a preset maximum score value to obtain a quotient, and determine the quotient as the total field length score of the target field. The computer device may also multiply or divide the quotient by a preset coefficient to obtain the total field length score of the target field, but is not limited to this.
[0066] In this implementation, the total field length score of the target field is determined according to the field length of the target field in the first data table and a preset maximum score value. The calculation method is simple and saves calculation effort.
[0067] In an exemplary embodiment, the target restriction length is determined based on the total field length score of the target field, including: determining the query restriction length based on the total field length score of the target field, the minimum single query restriction length, and the maximum single query restriction length; determining the target restriction length based on the query restriction length and the maximum single query restriction length.
[0068] The preset highest score value, the minimum single query limit length, and the maximum single query limit length are obtained based on the database hardware performance and statistical historical experience data. Database hardware performance includes CPU performance, memory performance, interface performance, etc. Assuming that the CPU main frequency is 2.4GHz (gigahertz), the memory bandwidth rate is 10GB / S (gigabit / second), and the interface bandwidth rate is 10GB / S, the corresponding minimum single query limit length is 1000, the maximum single query limit length is 9999, and the preset highest score value is 1000 points. Similarly, the historical data of other database hardware performance, minimum single query limit length, and maximum single query limit length can also be counted to obtain the relationship between the database hardware performance, the minimum single query limit length, the maximum single query limit length, and the preset highest score value.
[0069] Optionally, a single minimum query limit length and a single maximum query limit length are used as constants, and a field total length score and a query limit length are used as variables to construct a target relational expression of the field total length score variable and the query limit length variable. The field total length score is negatively correlated with the query limit length, that is, the smaller the field total length score, the larger the query limit length. The computer device brings the field total length score into the target relational expression to calculate the corresponding query limit length.
[0070] The target relational expression can be queryLimit = (int) ((1 - score) * (maxLimit -minLimit) + minLimit), where queryLimit indicates the query limit length, maxLimit indicates the maximum query limit length for a single query, minLimit indicates the minimum query limit length for a single query, and score is the total length score of the field.
[0071] Optionally, the computer device obtains the limit difference between the maximum single query limit length and the minimum single query limit length, and obtains the score difference between 1 and the total length score of the field, calculates the product of the limit difference and the score difference, then sums the product with the minimum single query limit length, rounds the sum, and obtains the query limit length.
[0072] Optionally, the computer device compares the query limit length with the single maximum query limit length. If the query limit length is less than the single maximum query limit length, the query limit length is used as the target limit length; if the query limit length is greater than or equal to the single maximum query limit length, the single maximum query limit length is used as the target limit length, that is, the smaller value of the query limit length and the single maximum query limit length is used as the target limit length. For a data table, the target limit length can be a target limit row number.
[0073] The query limit length is determined based on the total length score of the target field, and can dynamically adapt to the query statement length limit in different scenarios. The query limit length is calculated by the minimum single query limit length and the maximum single query limit length, which reduces the amount of data calculated and adapts to the hardware performance of the database.
[0074] It is understandable that the above data processing method can also adopt a corresponding separation strategy according to the cold-hot separation type of the data table to store the cold data corresponding to the target field in the second data table.
[0075] In an exemplary embodiment, storing the cold data in the first data table into the second data table includes: determining the cold-hot separation type of the first data table according to the configuration parameter; when the cold-hot separation type of the first data table is same-database separation, using the same-database separation strategy to store the cold data in the first data table in the second data table; when the cold-hot separation type of the first data table is different-database separation, using the different-database separation strategy to store the cold data in the first data table in the second data table.
[0076] Optionally, the computer device can obtain the separation type parameter in the configuration parameters. The separation type parameter can be represented by async. When the value of async is true, it indicates that the hot and cold separation type is different-database separation. When the value of async is false, it indicates that the hot and cold separation type is same-database separation. Optionally, the separation type parameter can also be represented by other parameters, such as the letter L. When the value of L is 1, it indicates that the hot and cold separation type is different-database separation. When the value of L is 2, it indicates that the hot and cold separation type is same-database separation. That is, the separation type parameter can be configured as needed, and different values can be set to indicate different hot and cold separation types.
[0077] Among them, the same database separation strategy can be that a hot data table and a cold data table are stored in the same database, the cold data in the hot data table is stored in the cold data table, and the cold data stored in the cold data table is deleted from the hot data table. Optionally, the first data table (i.e., the hot data table) and the second data table (i.e., the cold data table) are in the same database, the cold data in the first data table is stored in the second data table, and the cold data stored in the second data table is deleted from the first data table. The different database separation strategy can be that the cold data in the hot data table of the first database is stored in the cold data table of the second database, and the cold data is deleted from the hot data table.
[0078] By configuring the separation type parameters, you can support hot and cold separation in multiple scenarios, such as separation of the same database and separation of different databases, etc., to provide support for different scenarios and different needs and improve system flexibility.
[0079] It can be understood that, in an exemplary embodiment, cold data separated from multiple first data tables can be configured to be stored in the same second data table, thereby supporting hot and cold separation in a multi-table integration scenario.
[0080] In an exemplary embodiment, Figure 4 As shown, the cold data corresponding to the field to be cold processed is stored in the second data table by adopting the heterogeneous database separation strategy, including:
[0081] Step 402: determine a hash value corresponding to the table name of the first data table, and perform modulo operation on the hash value to determine a message queue sequence number corresponding to the first data table.
[0082] Optionally, the computer device obtains the table name of the first data table, and then performs hash processing on the table name of the first data table to obtain a hash value, and then performs modulo processing on the hash value to obtain the message queue sequence number corresponding to the first data table. There are N message queues, and the message queue sequence numbers are 1, 2...N, respectively, where N is a natural number. For example, the table name of the first data table is mbp_hot_table1, and the hash processing is performed to obtain a hash value of 13. There are 3 message queues, and the message queue sequence numbers are 1, 2, and 3, then 13%3=1, that is, the message queue sequence number corresponding to the first data table is 1.
[0083] Step 404: Send the configuration parameters and cold data of the first data table to the target message queue corresponding to the message queue sequence number.
[0084] Optionally, the computer device sends the configuration parameters of the first data table and the cold data corresponding to the target field to the target message queue corresponding to the message queue sequence number, and after successful sending, deletes the cold data from the first data table.
[0085] Optionally, when there are multiple first data tables corresponding to the same message queue sequence number, that is, multiple first data tables transmit cold data through the same message queue, the task priority in the configuration parameters of each first data table is obtained, and the first data tables are placed in the corresponding list in the message queue according to the task priority. For example, if the task priority of the first data table A is p0, the configuration parameters and cold data of the first data table A are placed in the p0list list, and the task priority of the first data table B is p1, then the configuration parameters and cold data of the first data table B are placed in the p1list list.
[0086] Optionally, when there are multiple first data tables corresponding to the same message queue sequence number, that is, multiple first data tables transmit cold data through the same message queue, multiple groups are configured in the message queue, and the cold data of the same first data table is placed in the same group. Placing the cold data of the same first data table in the same group facilitates the subsequent centralized reading of the cold data of the same first data table, thereby improving the transmission efficiency of the data of the same first data table. Furthermore, after the cold data of the same first data table is placed in the same group, the task priority in the configuration parameters of each first data table is obtained, and the first data table is placed in the corresponding list in the message queue according to the task priority.
[0087] Step 406: Read the configuration parameters and cold data of the first data table from the target message queue.
[0088] Optionally, the computer device can read the configuration parameters of the first data table and the cold data corresponding to the target field from the target message queue in order from high to low task priority, and read data from the list with high task priority first, and then read data from the list with low task priority. For example, if the task priority p0 is the highest, then data is read from the p0list list first.
[0089] Step 408: determine the target corresponding to the cold data according to the configuration parameters of the first data table, and generate an insert statement according to the target field.
[0090] Optionally, the computer device generates an insert statement according to a target field in the configuration parameters of the read first data table.
[0091] Step 410: insert the cold data in the first data table into the second data table according to the insert statement.
[0092] Optionally, the computer device inserts the cold data corresponding to the target field in the first data table into the second data table according to the insert statement. The second data table is the cold data table.
[0093] When the computer device inserts the cold data into the second data table according to the insert statement, if the ID key is repeated, it means that the cold data already exists and the cold data is directly discarded. If other exceptions are prompted and the insertion fails, the exception is saved in the error record table and is subsequently processed manually.
[0094] In actual applications, the first data table is a hot data table, and the second data table is a cold data table. The configuration data of the hot data table is configured with JSON data. In an exemplary embodiment, Figure 5 As shown, the data processing method includes:
[0095] Step 502: Determine the configuration data of the candidate data table to be separated into hot and cold data.
[0096] Optionally, the computer device detects that the scheduled hot and cold separation task is triggered, and obtains the configuration data of the candidate data table to be hot and cold separated. The configuration data is JSON configuration data, and the JSON configuration data is as follows:
[0097] {
[0098] "async": true, / / Whether it is asynchronous, that is, true to send kafka, the default is false
[0099] "hotTableName":"mbp_hot_table1", / / hot table name
[0100] "queryHotTableDataSource":"SLAVE" / / Query the data source of hot data, the default SLAVE slave library
[0101] "deleteHotTableDataSource":"MASTER", / / Delete the data source of hot data, the default is MASTER main library
[0102] "fieldName":"update_time", / / hot table time field (must have index), default update_time
[0103] "coldTableDataSource":"COLDDB2", / / Write cold data into the data source
[0104] "coldTableName":"mbp_cold_table_history", / / cold table name
[0105] "tableFiledExtend":{"id":"int","name":"varchar","description":"varchar","create_time":"datetime"} / / The hot table field that needs to be cold processed is the target field
[0106] "priority":p0, / / priority
[0107] "day":7, #Query the hot data from how many days ago, no less than 7 days
[0108] "maxExecuteTimeSeconds":82800, / / Execute hot and cold separation duration, default is 82800 (23 hours)
[0109] }
[0110] Step 504: parse the configuration data of the candidate data table to obtain configuration parameters of the candidate data table.
[0111] Optionally, the computer device parses the configuration data of the candidate data table to obtain configuration parameters of the candidate data table. The configuration parameters are shown in Table 1.
[0112] Table 1
[0113]
[0114] Among them, key is the field name of the hot-cold separation configuration task, value is the value of the corresponding field, required parameters are required, and non-required parameters have default values.
[0115] Step 506 , determining the task priority of the candidate data table according to the configuration parameters of the candidate data table, and adding the data identifier of the candidate data table to the task queue in order of task priority from high to low.
[0116] Optionally, the computer device uses the List data structure of redis to add the data identifiers of the candidate data table to the task queue in order of task priority from high to low.
[0117] Among them, redis is an open source log-type, key-value database written in ANSI C, supporting the network, and can be based on memory or persistence. The Redis List structure is a bidirectional linked list. Its main functions are push, pop, and getting elements within a certain range. Each child element is of string type. Redis List can be used as a stack or a queue. The operations of stacks and queues are to add elements at one end and delete elements at the other end, but the directions are different. A stack is a last-in-first-out data structure, and a queue is a first-in-first-out data structure.
[0118] For example, candidate data table A corresponds to task t1, and the task priority of candidate data table A is p0; candidate data table corresponds to task t2, and the task priority of candidate data table B is p1; candidate data table C corresponds to task t3, and the task priority of candidate data table C is p2; that is, t1=p0, t2=p1, t3=p3, priority p0 is higher than priority p1, and priority p1 is higher than priority p2.
[0119] The queues are placed according to priority:
[0120] redis.lpush('priority',t1)
[0121] redis.lpush('priority',t2)
[0122] redis.lpush('priority',t3)
[0123] Step 508: Obtain target table identifiers from the task queue in sequence, and determine the candidate data table corresponding to the target table identifier as the first data table.
[0124] As described above, take out the tasks for execution: redis.rpop('priority') will take out the t1, t2, and t3 tasks in sequence.
[0125] Step 510: Determine the target field corresponding to the cold data according to the configuration parameters of the first data table.
[0126] Step 512: Generate a query statement according to the target field, and obtain cold data from the first data table based on the query statement.
[0127] The target field in the configuration parameters is tableFiledExtend:
[0128] {"id":"int","name":"varchar","description":"varchar","create_time":"datetime"}
[0129] Generate a query statement based on the target field in the configuration parameters, that is, generate an SQL statement. SQL select id, name, description, create_time from mbp_hot_table1 (hot table name) where update_time (time index field) < current time - day (configured separation number of days).
[0130] Furthermore, a target limit length may be determined, and the query statement may be updated according to the target limit length. Determining the target limit length and updating the query statement according to the target limit length includes (a1) to (a5):
[0131] (a1) Determine the sum of the field lengths of the target fields in the Lth row of the first data table, where L is any integer from 1 to M, and M represents the total number of rows of the target fields in the first data table, and M is a natural number.
[0132] For example, the target fields of the hot data table are shown in Table 2, and M is 3.
[0133] Table 2
[0134]
[0135] The length of each field is: id: integer id usually ignores the length; name: 8('aaaaaaaa'), 9('bbbbbbbbb'), 5('vvvcc'); description: 15, 13, 14; create_time: 19 (date and time format).
[0136] Calculate the sum of the lengths of the fields in a single line:
[0137] First row: 8+15+19=42
[0138] Second row: 9+13+19=41
[0139] Third row: 5+14+19=38
[0140] (a2) Determine the total field length of the target field based on the sum of the field lengths of the target fields from the 1st row to the Mth row, and obtain the total field length score of the target field based on the total field length, the number of M rows and the preset maximum score value.
[0141] Total field length: 42+41+38=121
[0142] The formula for the total length score of the normalized field is score=totalComplexity / tableData.size() / maxScore.
[0143] The maximum limit of Score is score<=1, totalComplexity indicates the total length of the fields in the data table, tableData.size() indicates the number of statistical rows in the data table, and maxScore is the preset maximum score value.
[0144] Taking the preset maximum score value as 1000 as an example, the total length score of the field after normalization is: 121 / 3 / 1000≈0.04 (retain two decimal places)
[0145] (a3) Determine the query limit length according to the total length score of the field, the single minimum query limit length and the single maximum query limit length.
[0146] The target relational expression may be a formula representing the reverse linear mapping of the total length score of the field to the query limit length. The formula representing the reverse linear mapping of the total length score of the field to the query limit length may be: queryLimit = (int) ((1 -score) * (maxLimit - minLimit) + minLimit)
[0147] Among them, queryLimit indicates the query limit length, maxLimit indicates the maximum query limit length for a single query, and minLimit indicates the minimum query limit length for a single query.
[0148] Calculate with maxLimit as 1000 and minLimit as 100, queryLimit=(int)((1-0.04)*(1000-100)+100)=964
[0149] (a4) Compare the query limit length with the single maximum query limit length. If the query limit length is less than the single maximum query limit length, the query limit length is used as the target limit length; if the query limit length is greater than or equal to the single maximum query limit length, the single maximum query limit length is used as the target limit length.
[0150] Optionally, the smaller value of the query limit length and the single maximum query limit length is taken: Math.min(queryLimit, maxLimit)=Math.min(964,1000)=964.
[0151] Optionally, the target limit length may be rounded down to an integer multiple of 100, so that the final target limit length is 900.
[0152] (a5) Adding the target limit length to the query statement to obtain an updated query statement, wherein the updated query statement includes the target limit length.
[0153] Optionally, update the query statement according to the target limit length, and obtain the updated query statement SQL as follows:
[0154] select id, name, description, create from mbp_hot_table1 (hot table name) where update_time (time index field) < current time - day (number of days to configure separation) limit 964
[0155] Correspondingly, if the final target limit length is 900, the updated query SQL is
[0156] select id, name, description, create from mbp_hot_table1 (hot table name) where update_time (time index field) < current time - day (number of days to configure separation) limit 900
[0157] Step 514: Determine the cold-hot separation type of the first data table according to the configuration parameters.
[0158] Optionally, the separation type parameter can be represented by async. When the value of async is true, it indicates that the cold and hot separation type is different-database separation. When the value of async is false, it indicates that the cold and hot separation type is same-database separation.
[0159] Step 516: When the cold-hot separation type of the first data table is same-database separation, the cold data corresponding to the target field in the first data table is stored in the second data table using the same-database separation strategy.
[0160] The first data table is a hot data table, and the second data table is a cold data table. Optionally, in the same database, the data in the hot data table is separated into the cold data table, and the cold data corresponding to the target field in the hot data table is deleted at the same time when the transaction is started, and the cold data corresponding to the target field is inserted into the cold data table of the same database. Through the same transaction, the hot data table is searched for data within the transaction, and the searched data is inserted into the cold data table to ensure data consistency.
[0161] Step 518, when the hot and cold separation type of the first data table is heterogeneous database separation, determine the hash value corresponding to the table name of the first data table, take the modulus of the hash value to determine the message queue number corresponding to the first data table, and send the configuration parameters of the first data table and the cold data corresponding to the target field to the target message queue corresponding to the message queue number in the message middleware.
[0162] Optionally, in the case of heterogeneous database separation, the data of the hot data table in one database is separated into the cold data table of another database. Optionally, the message middleware may include multiple message queues, such as message queue 1, message queue 2, and message queue 3. The message middleware can respond to the business needs of different data processing applications, and the hot and cold data separation tasks of the same data processing application can be placed in the message queue of the corresponding data processing application. For example, the data processing application includes data processing application 1, data processing application 2, and data processing application 3. For example, the message middleware assigns the data table of hot and cold data separation belonging to data processing application 1 to the message queue of data processing application 1 for transmission, storage, etc. The message middleware is an independent system software or service, similar to kafka, rabbitMq, etc., which is used to implement efficient and reliable message delivery and asynchronous communication in distributed systems to meet the needs of asynchronous combing, traffic peak shaving, current limiting, caching, queuing, eventual consistency, message drive, etc. The data sets to be separated are grouped according to the table names of the hot data tables, and the data of the same data table are sent to the same message queue to ensure the consistency of the data order of the same data table and the use of the same queue by the receiving end for the same data table data, which can speed up the processing speed. The queried cold data and configuration parameters are first sent to the target message queue corresponding to the message queue sequence number in the message middleware. After the sending is successful, the cold data corresponding to the target field in the hot data table is deleted to ensure data consistency.
[0163] Step 520: Read the configuration parameters of the first data table and the cold data corresponding to the target field from the target message queue.
[0164] Optionally, the configuration parameters of the first data table and the cold data corresponding to the target field are read from the target message queue in order from high to low task priority, with data being read first from the list with high task priority, and then from the list with low task priority.
[0165] Step 522: determine the target field corresponding to the cold data according to the configuration parameters of the first data table, and generate an insert statement according to the target field.
[0166] Optionally, an insert statement is generated according to the target field in the configuration parameters of the read first data table.
[0167] Generate insert into mbp_cold_table_history (id,name,description,create_time) values (1,'aaaaaaaa','Assume length 15','Fixed length 19'), (2,'bbbbbbbbb','Assume length 13','Fixed length 19'), (3,'vvvcc','Assume length 14','Fixed length 19').
[0168] Step 524: insert the cold data corresponding to the target field in the first data table into the second data table according to the insert statement.
[0169] When the computer device inserts the cold data in the first data table into the second data table according to the insert statement, if the ID key is repeated, it means that the cold data already exists and the cold data is directly discarded. If other exceptions are prompted and the insertion fails, the exception is saved in the error record table and is subsequently processed manually.
[0170] The data processing method in this embodiment uses JSON data to configure the configuration data of the hot and cold separation of the data table, so as to realize the generalization of configuration. When there is a need for hot and cold separation, only one new configuration needs to be added to take effect, and there is no need to encode and upgrade the system, thereby improving the system operation efficiency; it supports the separation of fields that need to be saved in the configuration business, and redundant or abandoned fields do not need to be stored in the cold data table, saving network interface resources and hard disk storage resources; by configuring the task priority, high-priority table tasks can be processed first to ensure that the data table can process cold data as soon as possible; it supports hot and cold separation in multiple scenarios such as same-database separation, asynchronous different-database separation, and multi-table integration, providing support for different scenarios and different requirements, and improving the flexibility of the system; the query limit length is dynamically determined by the length of the data table field, and the query statement length in different scenarios is dynamically adapted to avoid the reduction of database performance due to the increase of data table fields and business in the later stage, thereby improving the robustness of the system; asynchronous configuration tasks can be sent to a fixed message queue according to the table name modulus to ensure the order of business data; according to different business data requirements, the data table is configured periodically to achieve different business scenarios and perform hot and cold separation tasks of different periods.
[0171] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0172] Based on the same inventive concept, the embodiment of the present application also provides a data device for implementing the data processing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the one or more data processing device embodiments provided below can refer to the limitations on the data processing method above, and will not be repeated here.
[0173] In an exemplary embodiment, Figure 6 As shown, a data processing device is provided, including: a target field determination module 610, a query module 620 and a storage module 630, wherein:
[0174] The target field determination module 610 is used to determine the target field corresponding to the cold data according to the configuration parameters of the first data table.
[0175] The query module 620 is used to generate a query statement according to the target field, and obtain cold data from the first data table based on the query statement.
[0176] The storage module 630 is used to store the cold data in the first data table into the second data table.
[0177] The above data processing device first determines the target field corresponding to the cold data according to the configuration parameters of the first data table, then generates a query statement according to the target field, obtains the cold data from the first data table according to the query statement, stores the cold data in the first data table in the second data table, filters out the cold data based on the target field, and stores the cold data in the second data table. By determining the target field through the configuration parameters and filtering the cold data based on the target field, it is only necessary to select the cold data corresponding to the target field for storage, and it is not necessary to store the cold data of all fields, thus saving network interface resources and hard disk storage resources. Furthermore, by implementing the configuration parameters, it is not necessary to carry out point-to-point code development and system upgrades, thus realizing configuration generalization and saving computer hardware resources and software resources consumed by re-development.
[0178] In an exemplary embodiment, the above-mentioned data processing device further includes a task priority determination module, an adding module and a data table determination module.
[0179] A task priority determination module is used to determine a candidate data table and determine the task priority of the candidate data table according to the configuration parameters of the candidate data table;
[0180] An adding module is used to add the data table identifiers of the candidate data tables to the task queue in the order of task priority from high to low;
[0181] The data table determination module is used to obtain the target table identifier from the task queue in sequence, and determine the candidate data table corresponding to the target table identifier as the first data table.
[0182] In an exemplary embodiment, the data processing device further includes a limit length determination module:
[0183] The limit length determination module is used to determine the total field length score of the target field and determine the target limit length according to the total field length score of the target field.
[0184] The query module 620 is further configured to add the target limit length to the query statement to obtain an updated query statement, and obtain cold data from the first data table according to the updated query statement.
[0185] In an exemplary embodiment, the restriction length determination module is also used to determine the query restriction length based on the total field length score of the target field, the minimum single query restriction length and the maximum single query restriction length; and determine the target restriction length based on the query restriction length and the maximum single query restriction length.
[0186] In an exemplary embodiment, the limit length determination module is also used to determine the sum of the field lengths of the target fields in the Lth row of the first data table, where L is any integer from 1 to M, where M represents the total number of rows of the target fields in the first data table, and where M is a natural number; based on the sum of the field lengths of the target fields in the 1st to Mth rows, the total field length of the target field is determined; based on the total field length, the number of M rows and the preset maximum score value, the total field length score of the target field is determined.
[0187] In an exemplary embodiment, the storage module includes a type determination unit, a same-library storage unit, and a different-library storage unit.
[0188] The type determination unit is used to determine the cold and hot separation type of the first data table according to the configuration parameters.
[0189] The same-database storage unit is used to store the cold data in the first data table into the second data table by adopting the same-database separation strategy when the cold-hot separation type of the first data table is the same-database separation.
[0190] The heterologous storage unit is used for storing the cold data in the first data table into the second data table by adopting the heterologous separation strategy when the cold-hot separation type of the first data table is heterologous separation.
[0191] In an exemplary embodiment, the heterologous storage unit is also used to determine the hash value corresponding to the table name of the first data table, and to take the modulus of the hash value to determine the message queue sequence number corresponding to the first data table; send the configuration parameters of the first data table and the cold data to the target message queue corresponding to the message queue sequence number; read the configuration parameters of the first data table and the cold data from the target message queue; determine the target field corresponding to the cold data according to the configuration parameters of the first data table, and generate an insert statement according to the target field; and insert the cold data in the first data table into the second data table according to the insert statement.
[0192] In an exemplary embodiment, the heterologous storage unit is also used to obtain the task priority in the configuration parameters of each first data table when there are multiple first data tables corresponding to the same message queue sequence number, and place the first data table into the corresponding list in the message queue according to the task priority.
[0193] In an exemplary embodiment, the heterologous storage unit is further used to configure multiple groups in the message queue when there are multiple first data tables corresponding to the same message queue sequence number, and put the cold data of the same first data table into the same group.
[0194] In an exemplary embodiment, the data processing device further includes one or more of a deletion module, a prompt module, a discarding module, and an abnormal recording module.
[0195] The deletion module is used to delete the cold data stored in the second data table from the first data table when the same database is separated, and to delete the cold data stored in the message queue from the first data table when the different databases are separated.
[0196] The prompt module is used to prompt that the id key is repeated abnormally when inserting cold data into the second data table according to the insert statement, indicating that the cold data already exists. The discard module is used to directly discard the cold data when indicating that the cold data already exists.
[0197] The exception record module is used to save the exception to the error record table if other exceptions are prompted that lead to failure of insertion.
[0198] Each module in the above-mentioned separation processing device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.
[0199] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 7 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data tables. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data processing method is implemented.
[0200] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0201] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps of the data processing method when executing the computer program.
[0202] In an exemplary embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the data processing method are implemented.
[0203] In an exemplary embodiment, a computer program product is provided, comprising a computer program, which implements the steps of the data processing method when executed by a processor.
[0204] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0205] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0206] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0207] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the present application. It should be noted that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A data processing method, characterized in that: The method comprises: Determine the target field corresponding to the cold data according to the configuration parameters of the first data table; Generate a query statement according to the target field, and acquire cold data from the first data table based on the query statement; The cold data in the first data table is stored in the second data table.
2. The method according to claim 1, characterized in that The method further comprises: Determine a candidate data table, and determine a task priority of the candidate data table according to configuration parameters of the candidate data table; Adding the data table identifiers of the candidate data tables to the task queue in descending order of the task priorities; The target table identifiers are obtained from the task queue in sequence, and the candidate data table corresponding to the target table identifier is determined as the first data table.
3. The method according to claim 1, characterized in that The acquiring cold data from the first data table based on the query statement includes: Determine a total field length score of the target field, and determine a target limit length according to the total field length score of the target field; Adding the target limit length to the query statement to obtain an updated query statement; According to the updated query statement, cold data is obtained from the first data table.
4. The method according to claim 3, characterized in that The determining the target limit length according to the total field length score of the target field includes: Determine the query limit length according to the total field length score of the target field, the single minimum query limit length, and the single maximum query limit length; A target limit length is determined according to the query limit length and the single maximum query limit length.
5. The method according to claim 3 or 4, characterized in that: The determining of the total field length score of the target field includes: Determine the sum of the field lengths of the target fields in the Lth row of the first data table, where L is any integer from 1 to M, where M represents the total number of rows of the target fields in the first data table, and M is a natural number; Determine the total field length of the target field according to the sum of the field lengths of the target fields from the 1st line to the Mth line; The total field length score of the target field is determined based on the total field length, the number of M rows, and a preset maximum score value.
6. The method according to claim 1, characterized in that The storing the cold data in the first data table into the second data table includes: Determining the hot and cold separation type of the first data table according to the configuration parameters; In the case where the cold and hot separation type of the first data table is same-database separation, the cold data in the first data table is stored in the second data table using the same-database separation strategy; In the case where the cold and hot separation type of the first data table is heterogeneous database separation, a heterogeneous database separation strategy is adopted to store the cold data in the first data table into the second data table.
7. The method according to claim 6, characterized in that The adopting of a different database separation strategy to store the cold data in the first data table into the second data table includes: Determine a hash value corresponding to the table name of the first data table, and perform modulo operation on the hash value to determine a message queue sequence number corresponding to the first data table; Sending the configuration parameters of the first data table and the cold data to the target message queue corresponding to the message queue sequence number; Reading the configuration parameters of the first data table and the cold data from the target message queue; Determine a target field corresponding to the cold data according to the configuration parameters of the first data table, and generate an insert statement according to the target field; Insert the cold data in the first data table into the second data table according to the insert statement.
8. A data processing device, characterized in that: The device comprises: A target field determination module, used to determine a target field corresponding to the cold data according to configuration parameters of the first data table; A query module, used to generate a query statement according to the target field, and obtain cold data from the first data table based on the query statement; The storage module is used to store the cold data in the first data table into the second data table.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
