Database changing method and device, equipment, medium and product
By acquiring database resource usage data during off-peak and peak periods, generating simulated usage data, and building predictive models, the problems of high resource consumption and insufficient evaluation accuracy in database change operations are solved. This achieves efficient and accurate evaluation of change operations, improving system stability and operational efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-18
- Publication Date
- 2026-04-24
AI Technical Summary
Existing technologies suffer from high resource consumption, poor real-time performance, and insufficient evaluation accuracy in database change operations, making it difficult to adapt to dynamic changes in the production environment, resulting in low operational efficiency and increased risks.
By acquiring resource usage data during off-peak and peak business periods, simulated usage data is generated, a target prediction model is built, and the performance metrics of change operations during peak periods are evaluated to determine whether change operations can be executed during peak business periods.
It enables intelligent, efficient, and real-time evaluation of database change operations, improves prediction accuracy and real-time performance, reduces the risk of misjudgment, reduces resource and time costs, and enhances system stability and operational efficiency.
Smart Images

Figure CN121919191A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of IT production technology, and in particular to a method, apparatus, device, medium and product for modifying a database. Background Technology
[0002] During the operation and maintenance of database systems, in order to adapt to changes in business needs or optimize performance, it is often necessary to modify database objects or data. These operations usually involve Data Definition Language (DDL) or Data Manipulation Language (DML). If the modification is not done properly, it may cause problems such as system resource contention, performance degradation or even service interruption.
[0003] In related technologies, offline windows or simulation tests are usually used to evaluate change operations. However, these methods rely on human experience and static rules, which have problems such as high resource consumption, poor real-time performance and insufficient evaluation accuracy. They are difficult to accurately adapt to the dynamic changes in the production environment, which in turn leads to low operation and maintenance efficiency and increased operation and maintenance risks. Summary of the Invention
[0004] This disclosure provides a method, apparatus, device, medium, and product for modifying a database.
[0005] According to a first aspect of this disclosure, a method for modifying a database is provided, the method comprising: Obtain the first usage data of resource data when the database is modified during off-peak business periods, and obtain the second usage data of resource data when the database is not modified during peak business periods; Simulated usage data is generated based on the first usage data; the simulated usage data is used to characterize the resource status of the resource data when the database performs the change operation during the peak business period. A target prediction model is constructed based on the simulated usage data and the second usage data; The target change operation is input into the target prediction model to obtain the performance index of the resource data, and the target change operation can be executed during peak business periods based on the performance index.
[0006] Further, the step of generating simulated usage data based on the first usage data includes: The first data in use is grouped according to the operation type of the change operation to obtain multiple subsets; wherein, each subset corresponds to a resource performance index of the database under one operation type; Determine the statistical parameters corresponding to each of the aforementioned subsets; Based on the second usage data, the statistical parameters are processed to obtain the data to be merged corresponding to each statistical parameter; The data to be merged corresponding to all the statistical parameters are merged to obtain the simulated usage data.
[0007] Further, the step of processing the statistical parameters based on the second usage data to obtain the data to be merged corresponding to each statistical parameter includes: The adjustment coefficient for the corresponding operation type is determined based on the statistical parameters and the second usage data; wherein, the adjustment coefficient is used to quantify the difference in the level of resource data when the database performs the corresponding change operation during the peak business period and when the change operation is not performed during the off-peak business period; The statistical parameters are scaled based on the adjustment coefficient to obtain scaled statistical parameters. Based on the scaled statistical parameters, obtain the data to be merged corresponding to each statistical parameter.
[0008] Further, determining the adjustment coefficient for the corresponding operation type based on the statistical parameters and the second usage data includes: Calculate the global average value of resource performance indicators in the second usage data; The ratio of the global average to the mean of the statistical parameters is determined as the adjustment coefficient.
[0009] Further, scaling the statistical parameters based on the adjustment coefficient to obtain scaled statistical parameters includes: Calculate the product of the mean of the statistical parameters and the adjustment coefficient to obtain the first scaled parameter; The product of the standard deviation and the adjustment coefficient in the statistical parameters is calculated to obtain the second scaled parameter.
[0010] Further, the step of obtaining the data to be merged corresponding to each of the scaled statistical parameters includes: The data to be merged corresponding to each statistical parameter is obtained by means of a normal distribution sampling function; wherein, the first scaled parameter and the second scaled parameter are the sampling parameters of the normal distribution sampling function.
[0011] Further, the step of constructing a target prediction model based on the simulated usage data and the second usage data includes: The simulated usage data is subjected to feature processing to obtain a target feature set; wherein, the target feature set contains the interaction features between multiple resource performance indicators in the simulated usage data; Based on the target feature set and the second usage data, a training dataset is generated; The random forest regression model is trained based on the training dataset to obtain the target prediction model.
[0012] Further, the step of performing feature processing on the simulated data to obtain the target feature set includes: Based on multiple resource performance indicators in the simulated usage data, interactive features reflecting the degree of joint influence among the multiple resource performance indicators are generated. Extract time period features from the timestamps of the simulated data, and normalize the time period features to obtain normalized features; The interaction features and the normalized features are added to the simulated usage data to obtain the target feature set.
[0013] Further, the step of generating a training dataset based on the target feature set and the second set of used data includes: The target feature set is matched and aligned with the actual usage data to obtain the matched data; wherein, the actual usage data is the actual usage data of resource data when performing change operations during the peak business period; The training dataset is determined based on the matched data; wherein the training dataset contains multiple training samples, the input features of each training sample are determined based on the target feature set in the matched data, and the label value of the training sample is determined based on the actual usage data in the matched data.
[0014] Further, the step of training the random forest regression model based on the training dataset to obtain the target prediction model includes: The training dataset is divided into a training set and a test set according to a preset ratio; The random forest regression model is trained using the training set to obtain an initial model, and the hyperparameters of the initial model are tuned to obtain an optimized model. The mean square error of the optimized model is calculated using the test set. When the mean square error is less than a preset threshold, the optimized model is determined as the target prediction model.
[0015] Furthermore, determining whether the target change operation can be executed during peak business periods based on the performance indicators includes: The performance indicators are compared with multiple preset safety thresholds; If the comparison result shows that none of the performance indicators exceed the corresponding preset security threshold, then it is determined that the target change operation can be executed during the peak business period.
[0016] According to a second aspect of this disclosure, a database modification apparatus is provided, the apparatus comprising: The acquisition module is used to acquire the first usage data of resource data when the database performs a change operation during non-peak business periods, and to acquire the second usage data of resource data when the database does not perform the change operation during peak business periods; The generation module is used to generate simulated usage data based on the first usage data; the simulated usage data is used to characterize the resource status of the resource data when the database performs the change operation during the peak business period; A building module is used to build a target prediction model based on the simulated usage data and the second usage data; The evaluation module is used to input the target change operation into the target prediction model, obtain the performance index of the resource data, and determine whether the target change operation can be executed during peak business periods based on the performance index.
[0017] According to a third aspect of this disclosure, an electronic device is provided. The electronic device includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the program to implement the method described above.
[0018] According to a fourth aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the methods described above.
[0019] According to a fifth aspect of this disclosure, a computer program product is provided. The computer program product includes a computer program that, when executed by a processor, implements the methods described above.
[0020] This disclosure provides a database modification method, apparatus, device, medium, and product. In this embodiment, firstly, first usage data of resource data is obtained when a database modification operation is performed during a non-peak business period, and second usage data of resource data is obtained when no modification operation is performed during a peak business period. Then, simulated usage data is generated based on the first usage data. The simulated usage data characterizes the resource status of resource data when a database modification operation is performed during a peak business period. Next, a target prediction model is constructed based on the simulated usage data and the second usage data. Finally, the target modification operation is input into the target prediction model to obtain performance indicators of the resource data, and the performance indicators are used to determine whether the target modification operation can be performed during a peak business period.
[0021] As described above, the technical solution disclosed herein first obtains first usage data when database change operations are performed during non-peak business periods and second usage data when no change operations are performed during peak business periods. Based on the first usage data, simulated usage data that can characterize the resource status during change operations during peak business periods is generated. Then, a target prediction model is constructed by combining the simulated usage data and the second usage data. Finally, the model is used to predict performance indicators based on the input target change operation and determine whether it can be executed during peak business periods. This achieves intelligent, efficient, and real-time assessment of the impact of database change operations, significantly improving prediction accuracy and real-time performance. At the same time, it reduces the risk of misjudgment due to environmental differences, reduces resource and time costs, simplifies the change operation process, effectively avoids unnecessary business interruptions, and thus improves system stability and operational efficiency. Attached Figure Description
[0022] The above and other objects, features, and advantages of this disclosure will become more apparent from the more detailed description of the embodiments thereof in conjunction with the accompanying drawings. The drawings are provided to further illustrate the embodiments of this disclosure and form part of the specification. They are used together with the embodiments of this disclosure to explain the disclosure and do not constitute a limitation thereof. In the drawings, the same reference numerals generally represent the same components or steps.
[0023] Figure 1 A flowchart illustrating a method for modifying a database as provided in an exemplary embodiment of this disclosure; Figure 2 One of the flowcharts for a method of modifying a database provided as another exemplary embodiment of this disclosure; Figure 3 A second flowchart of a method for modifying a database provided as another exemplary embodiment of this disclosure; Figure 4 A third flowchart of a database modification method provided for another exemplary embodiment of this disclosure; Figure 5 A schematic block diagram of the functional modules of a database modification device provided for an exemplary embodiment of the present disclosure; Figure 6 A structural block diagram of an electronic device provided as an exemplary embodiment of this disclosure; Figure 7 A structural block diagram of a computer system provided as an exemplary embodiment of this disclosure; Figure 8 A structural block diagram of a computer program product provided for an exemplary embodiment of this disclosure. Detailed Implementation
[0024] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0025] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0026] The term "comprising" and its variations as used herein are open-ended, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below. It should be noted that the concepts of "first", "second", etc., used in this disclosure are only used to distinguish different devices, modules, or units, and are not intended to limit the order of functions performed by these devices, modules, or units or their interdependencies.
[0027] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more". The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0028] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0029] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution, based on the prompt message.
[0030] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device. It is understood that the above notification and user authorization process is merely illustrative and does not constitute a limitation on the implementation of this disclosure; other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.
[0031] In one embodiment, such as Figure 1 As shown, a method for modifying a database is provided, including the following steps: Step 101: Obtain the first usage data of resource data when the database is modified during off-peak business periods, and obtain the second usage data of resource data when the database is not modified during peak business periods.
[0032] Here, the executing entity can obtain the first usage data of resource data when performing change operations on the database during non-peak business periods, and obtain the second usage data of resource data when no change operations are performed on the database during peak business periods. The first and second usage data include at least: CPU utilization, memory utilization, I / O utilization, wait event type, wait event duration, wait event occurrence frequency, lock type, lock duration, and lock wait time. Change operations include, but are not limited to: creating tables, modifying table structures, deleting tables / partitions, creating indexes, deleting indexes, and large-scale data cleanup.
[0033] In one possible embodiment, the executing entity collects initial resource usage data during non-peak business periods when database modification operations are performed, either by integrating monitoring tools such as Prometheus and Grafana or by executing custom scripts. These non-peak business periods can be from 00:00 to 06:00 daily. It should be noted that the specific range of these non-peak periods can be flexibly set according to actual circumstances and is not limited here. For example, the executing entity stores the collected initial data in a two-dimensional table, as shown below:
[0034] Wherein, timestamp is the timestamp of the change operation, operation_type is the type of change operation, including but not limited to create a table (create_table), modify a table structure (alter_table), delete a table / partition (drop_partition), create an index (create_index), delete an index (drop_index), and bulk data cleanup (bulk_data_cleanup), cpu_usage is the CPU usage rate, representing the CPU utilization during the change operation, memory_usage is the memory usage rate, representing the memory utilization during the change operation, and io_usage is the I / O usage rate, representing the I / O utilization during the change operation. The disk read / write speed is specified by the following parameters: wait_event_type (e.g., io_wait, lock_wait, cpu_wait), wait_event_duration (in milliseconds), wait_event_frequency (in milliseconds), lock_type (e.g., table_lock, row_lock, page_lock), lock_duration (in milliseconds), and lock_wait_time (in milliseconds).
[0035] In one possible embodiment, the executing entity collects second usage data of resource data during peak business periods when no changes have been performed on the database, either by integrating monitoring tools or executing custom scripts. For example, peak business periods could be from 10:00 AM to 12:00 PM daily, with a sampling frequency of 5 minutes and a sampling duration covering at least one complete business cycle, such as one week or one month, to ensure data representativeness. Taking data collected from 10:00 AM to 10:25 AM as an example, the executing entity stores the collected second usage data as a two-dimensional table with timestamps, as shown below:
[0036] It should be noted that the first and second usage data mentioned above are only partial data shown in the table as an example. In actual scenarios, the first and second usage data may contain more content.
[0037] In one possible embodiment, after obtaining the first usage data of resource data when performing change operations on the database during non-peak business periods, and the second usage data of resource data when no change operations are performed on the database during peak business periods, the executing entity can clean the first usage data and the second usage data to remove outliers and noise, so as to ensure data quality and consistency.
[0038] For example, the executing entity first checks the data integrity of the first and second usage data, that is, checks whether all fields of each record in the first and second usage data have values, marks records with missing values or incomplete records, and decides to fill in missing values as appropriate, such as mean imputation, median imputation, forward imputation, etc., deletes incomplete records, or uses other methods to process missing data. Then, the executing entity uses the Z-score method to detect and process outliers. For each specific value of each type of indicator in the first and second usage data, its Z-Score value is calculated, and the specific formula is as follows:
[0039]
[0040] in, For the i-th value in the sample, The mean of the sample. The standard deviation of the sample is 1. This indicates the dispersion of the sample data, where N is the number of samples. The Z-Score value is the current specific value. Taking the first usage data of the change operation performed during off-peak hours as an example, the example data is as follows:
[0041] The calculated Z-Score is as follows:
[0042] If the absolute value of the Z-score exceeds 3, it is considered an outlier. The execution entity replaces or deletes it using the median. In the data shown in the above embodiments, no data points are marked as outliers. If data points are marked as outliers, the above method is used to process the outliers.
[0043] For example, after the executing entity performs data integrity verification and outlier detection on the first usage data, it obtains the processed first usage data, as shown below:
[0044] Step 102: Generate simulated usage data based on the first usage data.
[0045] Here, after obtaining the first usage data of resource data when performing change operations on the database during non-peak business periods, the executing entity can generate simulated usage data based on the first usage data. The simulated usage data is used to characterize the resource status of resource data when performing change operations on the database during peak business periods.
[0046] In one possible embodiment, such as Figure 2 As shown, generating simulated usage data based on the first usage data includes the following steps: Step 201: Group the first data according to the operation type of the change operation to obtain multiple subsets.
[0047] Here, after obtaining the first usage data, the executing entity can group the first usage data according to the operation type of the change operation to obtain multiple subsets. Each subset corresponds to the database resource performance index under a certain operation type.
[0048] In one possible implementation, the executing entity imports the collected initial usage data into a dataset and processes the data using the Python programming language combined with the pandas library: First, the executing entity creates a dictionary named 'data', which consists of multiple key-value pairs. Each key corresponds to a column name in the dataset, and each value is a list containing the specific data for that column. An example of the structure of the dictionary 'data' is shown below: data = { 'TIMESTAMP': ['00:00', '00:00', '00:00', '00:00', '00:00', '00:00', '00:05', '00:05', '00:05', '00:05', '00:05', '00:05'], 'OPERATION_TYPE': ['create_table', 'alter_table', 'drop_partition', 'create_index', 'drop_index', 'bulk_data_cleanup', 'create_table', 'alter_table', 'drop_partition', 'create_index', 'drop_index', 'bulk_data_cleanup'], 'CPU_USAGE': [0.40, 0.45, 0.35, 0.50, 0.30, 0.55, 0.42, 0.47, 0.37,0.52, 0.32, 0.57], 'MEMORY_USAGE': [0.50, 0.55, 0.45, 0.60, 0.40, 0.65, 0.52, 0.57,0.47, 0.62, 0.42, 0.67], 'IO_USAGE': [100, 110, 90, 120, 80, 130, 105, 115, 95, 125, 85, 135], 'WAIT_EVENT_DURATION': [50, 70, 60, 80, 40, 90, 52, 72, 62, 82, 42,92], 'WAIT_EVENT_FREQUENCY': [5, 7, 6, 8, 4, 9, 5, 7, 6, 8, 4, 9], 'LOCK_DURATION': [60, 80, 50, 100, 40, 110, 62, 82, 52, 102, 42,112], 'LOCK_WAIT_TIME': [30, 40, 25, 50, 20, 55, 32, 42, 27, 52, 22, 57] } Then, the execution entity uses the DataFrame constructor of the pandas library to convert the dictionary `data` into a DataFrame. The converted DataFrame is stored in the dataset variable `df`, serving as the core dataset for subsequent processing. Next, to facilitate targeted analysis by operation type, the execution entity groups the dataset: using the `groupby` method of the pandas library, data of the same operation type are grouped together based on the `OPERATION_TYPE` column. The grouping results are stored in the variable `grouped`. Finally, the execution entity extracts data groups of specific operation types from the grouped objects: by calling the `get_group` method and passing in the operation type parameters (including `create_table`, `alter_table`, `drop_partition`, `create_index`, `drop_index`, and `bulk_data_cleanup`), the execution entity extracts the corresponding data subsets from the `grouped` object. The extracted data is stored in the variables `create_table_df`, `alter_table_df`, `drop_partition_df`, `create_index_df`, `drop_index_df`, and `bulk_data_cleanup_df`, thus forming multiple subsets of data subdivided by operation type.
[0049] For example, the sub-dataset create_table_df created by the execution entity for the operation type create_table is shown in the following table:
[0050] It should be noted that the structures of other subsets such as alter_table_df, drop_partition_df, create_index_df, drop_index_df, and bulk_data_cleanup_df are the same as those of create_table_df provided in the above embodiments, and the specific details will not be repeated.
[0051] Step 202: Determine the statistical parameters corresponding to each subset of data.
[0052] Here, after the executing entity groups the first data according to the operation type of the change operation to obtain multiple subsets, it can determine the statistical parameters corresponding to each subset.
[0053] In one possible implementation, continuing from the previous example, the execution entity uses the `describe` method of the pandas dataframe to calculate descriptive statistics for each indicator in `create_table_df`. For example, the descriptive statistics for each indicator in `create_table_df` are shown in the table below:
[0054] Where count is the number of samples, representing the number of non-null values in each column; mean is the mean, representing the average value of each column; std is the standard deviation, representing the dispersion of each column; min is the minimum value, representing the minimum value of each column; 25% is the first quartile, representing 25% of the data points in each column that are below this value; 50% is the median, representing the middle value of each column, with 50% of the data points below this value; 75% is the third quartile, representing 75% of the data points in each column that are below this value; and max is the maximum value, representing the maximum value of each column.
[0055] After calculating the descriptive statistics of each indicator in create_table_df, the executing entity extracts the mean and standard deviation (std) rows from the descriptive statistics data frame, and then saves the mean and standard deviation (std) into the variable mean_std_create_table. This yields the statistical parameters of the subset create_table_df. For example, the statistical parameters of the subset create_table_df are shown below:
[0056] It should be noted that the table above only shows the statistical parameters of the sub-dataset create_table_df. The structure of the statistical parameters of other sub-datasets alter_table_df, drop_partition_df, create_index_df, drop_index_df, and bulk_data_cleanup_df is the same as that in the table above, and the specific details will not be repeated here.
[0057] Step 203: Process the statistical parameters based on the second set of data to obtain the data to be merged corresponding to each statistical parameter.
[0058] Here, after determining the statistical parameters corresponding to each subset, the executing entity can process the statistical parameters based on the second set of data to obtain the data to be merged corresponding to each statistical parameter.
[0059] In one possible embodiment, such as Figure 3As shown, based on the second set of data, the statistical parameters are processed to obtain the data to be merged corresponding to each statistical parameter, including the following steps: Step 2031: Determine the adjustment coefficient for the corresponding operation type based on statistical parameters and second usage data.
[0060] Here, after determining the statistical parameters corresponding to each subset of data, the executing entity can determine the adjustment coefficient for the corresponding operation type based on the statistical parameters and the second data used. The adjustment coefficient is used to quantify the difference in the level of resource data when the database performs the corresponding change operation during peak business periods and when the change operation is not performed during off-peak business periods.
[0061] In one possible embodiment, determining the adjustment coefficient for the corresponding operation type based on statistical parameters and second usage data includes the following steps: Calculate the global average value of resource performance indicators in the second usage data; The ratio of the global average to the mean of the statistical parameters is determined as the adjustment factor.
[0062] Specifically, after determining the statistical parameters corresponding to each subset of data, the executing entity first calculates the global average value of the resource performance indicators in the second set of data, and then determines the ratio of the global average value to the mean value in the statistical parameters as the adjustment coefficient.
[0063] In one possible embodiment, firstly, the executing entity calculates the global average value of each resource indicator from the second usage data as a baseline level for normal business load during peak periods. Then, it extracts the mean value of each resource indicator from a specific operation type subset of the first usage data, such as the statistical parameters corresponding to `create_table_df`, as the typical load level of the change operation during non-peak business periods. Next, the executing entity determines the adjustment coefficient as the ratio of the global average value to the mean value in the statistical parameters. The formula for calculating the adjustment coefficient is: Adjustment Coefficient = Global Average Value / Mean Value of Each Indicator in the Statistical Parameters. For example, for each resource indicator of the operation type `create_table`, the obtained adjustment coefficient is: 'CPU_USAGE': 1.75, 'MEMORY_USAGE': 1.6, 'IO_USAGE': 2.0, 'WAIT_EVENT_DURATION': 2.0, 'WAIT_EVENT_FREQUENCY': 2.5, 'LOCK_DURATION': 2.0, 'LOCK_WAIT_TIME': 2.0 It should be noted that the above embodiments are merely illustrative examples of the adjustment coefficients for each resource metric with the operation type create_table. The execution entity will repeat the above steps for each change operation type such as alter_table and drop_partition to calculate its corresponding set of adjustment coefficients.
[0064] Step 2032: Scale the statistical parameters based on the adjustment coefficient to obtain the scaled statistical parameters.
[0065] Here, after determining the adjustment coefficient for the corresponding operation type based on the statistical parameters and the second set of data, the executing entity can scale the statistical parameters based on the adjustment coefficient to obtain the scaled statistical parameters.
[0066] In one possible embodiment, scaling the statistical parameters based on an adjustment factor to obtain scaled statistical parameters includes the following steps: The product of the mean and the adjustment coefficient in the statistical parameters is calculated to obtain the first scaled parameter; The product of the standard deviation and the adjustment factor in the statistical parameters is calculated to obtain the second scaled parameter.
[0067] Specifically, after determining the adjustment coefficient for the corresponding operation type based on statistical parameters and second usage data, the executing entity calculates the product of the mean and the adjustment coefficient in the statistical parameters to obtain the first scaled parameter, and calculates the product of the standard deviation and the adjustment coefficient in the statistical parameters to obtain the second scaled parameter.
[0068] In one possible embodiment, for each operation type, the executing entity calculates a first scaled parameter and a second scaled parameter, wherein the first scaled parameter is equal to the mean of the statistical parameters. Adjustment factor, second scaled parameter = standard deviation of statistical parameters Adjustment coefficient.
[0069] Step 2033: Obtain the data to be merged corresponding to each statistical parameter based on the scaled statistical parameters.
[0070] Here, the executing entity scales the statistical parameters based on the adjustment coefficient. After obtaining the scaled statistical parameters, it can obtain the data to be merged corresponding to each statistical parameter based on the scaled statistical parameters.
[0071] In one possible embodiment, the data to be merged corresponding to each statistical parameter is obtained based on the scaled statistical parameters, including the following steps: The data to be merged for each statistical parameter is obtained by using a normal distribution sampling function.
[0072] Here, the executing entity scales the statistical parameters based on the adjustment coefficient. After obtaining the scaled statistical parameters, the data to be merged corresponding to each statistical parameter can be obtained through the normal distribution sampling function. The first scaled parameter and the second scaled parameter are the sampling parameters of the normal distribution sampling function.
[0073] In one possible implementation, firstly, the executing entity creates a function `generate_simulated_data`, which accepts three parameters: `mean_std`, `factors`, and `num_samples`. `mean_std` contains statistical parameters of the mean and standard deviation of each resource indicator for a specific change operation type. `factors` are the adjustment parameters for the corresponding resource indicators. `num_samples` is the number of samples to be generated, typically equal to the number of samples of the first usage data for that operation type during off-peak periods. The executing entity iterates through each resource indicator. For each resource indicator in the statistical parameters, such as `CPU_USAGE` and `MEMORY_USAGE`, the executing entity can calculate the first and second scaled parameters corresponding to each resource indicator using the previous embodiment. Then, the executing entity generates simulated data using a normal distribution: using the first and second scaled parameters as parameters of the normal distribution, it uses a normal distribution sampling function, such as `numpy.random.normal`, to generate a specified number of simulated data for each resource indicator. Finally, all the generated simulated data are combined into a structured DataFrame to obtain the data to be merged.
[0074] Step 204: Merge all the data to be merged corresponding to the statistical parameters to obtain the simulated usage data.
[0075] Here, after the executing entity obtains the data to be merged corresponding to each statistical parameter based on the scaled statistical parameters, it can merge the data to be merged corresponding to all statistical parameters to obtain the simulated usage data.
[0076] In one possible embodiment, the executing entity collects the datasets to be merged generated in the previous embodiment for each change operation type, such as create_table, alter_table, drop_partition, etc., into a list to obtain simulated usage data. For example, the simulated usage data is shown in the table below:
[0077] It should be noted that the simulated usage data shown in the table above is only a partial example. In actual applications, the simulated usage data can include more data.
[0078] Step 103: Construct a target prediction model based on simulated usage data and second usage data.
[0079] Here, after generating simulated usage data based on the first usage data, the executing entity can construct a target prediction model based on the simulated usage data and the second usage data.
[0080] In one possible embodiment, such as Figure 4 As shown, the target prediction model is constructed based on simulated usage data and second usage data, including the following steps: Step 1031: Perform feature processing on the simulated data to obtain the target feature set.
[0081] Here, after generating simulated usage data based on the first usage data, the executing entity can perform feature processing on the simulated usage data to obtain a target feature set, wherein the target feature set contains the interaction features between multiple resource performance indicators in the simulated usage data.
[0082] In one possible embodiment, feature processing is performed on the simulated data to obtain a target feature set, including the following steps: Based on multiple resource performance indicators in simulated usage data, interactive features reflecting the degree of joint influence among multiple resource performance indicators are generated. Extract time period features from the timestamps of the simulated data, and normalize the time period features to obtain normalized features. The interaction features and normalized features are added to the simulated usage data to obtain the target feature set.
[0083] Specifically, after generating simulated usage data based on the first usage data, the executing entity first generates interactive features reflecting the degree of joint influence among multiple resource performance indicators based on multiple resource performance indicators in the simulated usage data; then, the executing entity extracts time period features from the timestamps of the simulated usage data and normalizes the time period features to obtain normalized features; finally, the executing entity adds the interactive features and normalized features to the simulated usage data to obtain the target feature set.
[0084] In one possible embodiment, the executing entity generates interaction features reflecting the degree of joint influence among multiple resource performance indicators based on multiple resource performance indicators in the simulated usage data. These interaction features may include: interaction features between CPU utilization and memory utilization, interaction features between CPU utilization and I / O utilization, interaction features between memory utilization and I / O utilization, interaction features between wait event duration and wait event frequency, and interaction features between lock duration and lock wait time. For the interaction feature between CPU utilization and memory utilization, the CPU_MEM_INTERACTION feature is generated by calculating the product of CPU utilization and memory utilization, which is used to reflect performance changes under high CPU and memory usage conditions. For the interaction feature between CPU utilization and I / O utilization, the CPU_MEM_INTERACTION feature is generated by calculating the product of CPU utilization and I / O utilization. The IO_INTERACTION feature is used to capture the synergistic effect between CPU and disk I / O. For the interaction feature between memory utilization and I / O utilization, the MEM_IO_INTERACTION feature is generated by multiplying memory utilization and I / O utilization, reflecting the joint effect between memory and disk I / O. For the interaction feature between wait event duration and wait event frequency, the WAIT_DURATION_FREQUENCY feature is generated by multiplying wait event duration and wait event frequency, reflecting the comprehensive impact of wait events on system response time. For the interaction feature between lock duration and lock wait time, the LOCK_DURATION_WAIT feature is generated by multiplying lock duration and lock wait time, reflecting the composite impact of lock events on system performance.
[0085] After identifying interaction characteristics from the simulated usage data, the executing entity extracts time period features from the timestamps of the simulated usage data. These time period features include hourly, minutely, and weekday features. For hourly features, the executing entity extracts the hour portion from the TIMESTAMP field of the simulated usage data and uses this extracted hourly information as a new feature, HOUR. The hourly feature HOUR helps the target prediction model identify patterns in system load changes throughout the day; for example, the system may have higher loads during peak business hours and lower loads at night. For minutely features, the executing entity extracts the minute portion from the TIMESTAMP field of the simulated usage data and uses this extracted minutely information as a new feature, MINUTE. The minute feature MINUTE further refines the time features, helping the target prediction model more accurately capture subtle patterns in load changes, such as periodic fluctuations in system load at the top of the hour. For weekday features, the executing entity extracts the day of the week portion from the TIMESTAMP field of the simulated usage data and uses this extracted day of the week information as a new feature, DAY_OF_WEEK, where Monday is 0, Tuesday is 1, and so on, with Sunday being 6.
[0086] After obtaining the time-period features, the execution entity needs to normalize them, adjusting the value ranges of different features to the same scale to improve the training effect and prediction accuracy of the model. The execution entity uses a min-max normalization method; for example, it uses the MinMaxScaler class for processing. MinMaxScaler is suitable for normalizing various types of data, including integers, floating-point numbers, and time features, and can linearly transform feature values to a specified range. Specifically, the execution entity imports the MinMaxScaler class from the sklearn.preprocessing module and initializes a scaler object, i.e., creates a... A `MinMaxScaler` object (`scaler`) scales the three time features: HOUR, MINUTE, and DAY_OF_WEEK. Specifically, the execution body uses the `fit_transform` method of the `scaler` object to calculate and apply the scaler, scaling the values of these three features to the range [0,1]. The scaled feature values then replace the original values in the data frame, completing the normalization process. The normalized time period features have a uniform numerical range, eliminating the dimensional differences between different time features. This allows the subsequent target prediction model to converge more stably and efficiently during training, while also improving the model's sensitivity to time features and prediction accuracy.
[0087] After obtaining the interaction features and normalized features, the executing entity creates a copy of the original simulation dataset and adds the interaction features and normalized features to this copy, thereby obtaining the target feature set. By creating a copy, the integrity of the original data can be preserved, and feature engineering operations can be performed on the copy, which facilitates subsequent data analysis and model training. For example, the target feature set is shown in the table below:
[0088] Among them, CPU_MEM_INTERACTION represents the interaction characteristics of CPU utilization and memory utilization, CPU_IO_INTERACTION represents the interaction characteristics of CPU utilization and I / O utilization, MEM_IO_INTERACTION represents the interaction characteristics of memory utilization and I / O utilization, WAIT_DURATION_FREQUENCY represents the interaction characteristics of wait event duration and wait event frequency, LOCK_DURATION_WAIT represents the interaction characteristics of lock duration and lock wait time, HOUR is the hour feature extracted from the timestamp, MINUTE is the minute feature extracted from the timestamp, and DAY_OF_WEEK is the weekday feature extracted from the timestamp. It should be noted that the above table only shows a portion of the data as an example. In practical applications, the target feature set can contain more data.
[0089] Step 1032: Generate a training dataset based on the target feature set and the second set of data used.
[0090] Here, after performing feature processing on the simulated usage data to obtain the target feature set, the executing entity can generate a training dataset based on the target feature set and the second usage data.
[0091] In one possible embodiment, generating a training dataset based on the target feature set and the second usage data includes the following steps: The target feature set is matched and aligned with the actual data used to obtain the matched data; The training dataset is determined based on the matched data.
[0092] Specifically, after performing feature processing on the simulated usage data to obtain the target feature set, the executing entity first matches and aligns the target feature set with the actual usage data to obtain matched data. The actual usage data refers to the actual usage data of resource data when performing change operations during peak business periods. Then, the executing entity determines the training dataset based on the matched data. The training dataset contains multiple training samples, and the input features in each training sample are determined based on the target feature set in the matched data. The label values in the training sample are determined based on the actual usage data in the matched data.
[0093] In one possible embodiment, the executing entity matches and aligns the target feature set with the actual usage data based on the timestamp and the operation type of the change operation, so that the target feature set data and the actual usage data of the same time point and change type are on the same line. Specifically, the executing entity uses the pd.merge function to merge the target feature set data and the actual usage data based on the timestamp. The data fields of the target feature set are appended with the suffix "_sim", and the data fields of the actual usage data are appended with the suffix "_peak" for distinction. The merged data is the matched data. For example, the matched data is shown in the table below:
[0094] It should be noted that, due to the large number of data columns in the matched data, which makes it inconvenient to display, the table above has swapped the rows and columns of the matched data and only shows a portion of the data. In practical applications, the matched data should contain more data.
[0095] After obtaining the matched data, the executing entity determines the training dataset based on the matched data. The training dataset contains multiple training samples. The input features of each training sample are determined based on the target feature set in the matched data, and the label values of the training samples are determined based on the actual usage data in the matched data. For example, the training dataset determined by the executing entity based on the matched data includes input features X and label values Y. The input features X include: 'CPU_USAGE_sim', 'MEMORY_USAGE_sim', 'IO_USAGE_sim', 'WAIT_EVENT_DURATION_sim', 'WAIT_EVENT_FREQUENCY_sim', 'LOCK_DURATION_sim', 'LOCK_WAIT_TIME_sim', and 'CPU_MEM_IN'. TERACTION', 'CPU_IO_INTERACTION', 'MEM_IO_INTERACTION', 'WAIT_DURATION_FREQUENCY', 'LOCK_DURATION_WAIT', 'HOUR', 'MINUTE', 'DAY_OF_WEEK', 'OPERATION_TYPE', tag value Y package Contains: 'CPU_USAGE_peak', 'MEMORY_USAGE_peak', 'IO_USAGE_peak', 'WAIT_EVENT_DURATION_peak', 'WAIT_EVENT_FREQUENCY_peak', 'LOCK_DURATION_peak', 'LOCK_WAIT_TIME_peak'.
[0096] Step 1033: Train the random forest regression model based on the training dataset to obtain the target prediction model.
[0097] Here, after generating a training dataset based on the target feature set and the second set of data, the executing entity can train the random forest regression model based on the training dataset to obtain the target prediction model.
[0098] In one possible implementation, the random forest regression model is trained based on the training dataset to obtain the target prediction model, including the following steps: The training dataset is divided into a training set and a test set according to a preset ratio; The random forest regression model is trained using the training set to obtain the initial model, and the hyperparameters of the initial model are tuned to obtain the optimized model. The mean squared error of the optimized model is calculated using the test set; When the mean square error is less than the preset threshold, the optimized model is determined as the target prediction model.
[0099] Specifically, after generating a training dataset based on the target feature set and the second set of data, the executing entity first divides the training dataset into a training set and a test set according to a preset ratio. Then, the executing entity trains the random forest regression model using the training set to obtain an initial model and performs hyperparameter tuning on the initial model to obtain an optimized model. After that, the executing entity calculates the mean squared error of the optimized model using the test set. When the mean squared error is less than a preset threshold, the optimized model is determined as the target prediction model.
[0100] In one possible implementation, the executing agent first splits the training dataset into training and test sets: using the `train_test_split` method from the scikit-learn library, the training dataset is divided into training and test sets. For example, 80% of the data is used for training and 20% for testing. The training set contains the feature variable `X_train` and the label value `y_train`, and the test set contains the feature variable `X_test` and the label value `y_test`. Then, the executing agent defines a random forest regression model. Taking Python as an example, the executing agent uses the `RandomForestRegress` method from the scikit-learn library. The `or` class is used to define a random forest regression model. The specific process includes: First, importing the necessary libraries, including the `RandomForestRegressor` class and the `train_test_split` function from the scikit-learn library; then, creating a `RandomForestRegressor` object and setting the model's hyperparameters. For example, the execution entity selects 100 trees to balance model performance and computational cost, and sets a random seed of 42 to ensure reproducible results; finally, the execution entity trains the model using the training set data. By calling the `fit` method, the training set (X_train, y_train) is input into the model for training, resulting in the initial model.
[0101] After obtaining the initial model, the execution entity uses the initial model to predict the test set, obtains the predicted values, and uses the mean squared error (MSE) to measure the prediction accuracy of the initial model. The MSE formula is:
[0102] Where n is the number of test samples. This is the actual value. This is the predicted value. The preset mean squared error threshold is 0.1. If MSE < 0.1, it means that the average prediction error is small and meets the accuracy requirements. In this case, the model is determined as the target prediction model. If the above conditions are not met, grid search is used to fine-tune the parameters of the initial model. It should be noted that the choice of 0.1 as the evaluation standard for MSE is based on the specific needs of database management and operation scenarios. For example, changes in CPU utilization within 5% usually do not have a significant impact on system performance. Therefore, choosing a smaller MSE value can keep the model's prediction error within the acceptable range for business. In addition, for peak load prediction models, choosing 0.1 as the evaluation standard for MSE means that the average prediction error of the model is required to be small, thereby ensuring the accuracy of the prediction results.
[0103] The execution entity uses grid search to fine-tune the parameters of the initial model as follows: First, the execution entity defines the hyperparameters to be adjusted and their possible value ranges. The number of trees, `n_estimators`, is set to 100, 200, and 300 to find a balance between performance and computational cost. The maximum tree depth, `max_depth`, is set to None, 10, and 20, where None indicates no limit on the maximum tree depth, and setting it to 10 and 20 prevents overfitting and improves the model's generalization ability. The sample splitting strategy, `min_samples_split`, is set to 2, 5, and 10, representing the minimum number of samples required for node splitting, which simplifies the model and prevents overfitting. Then, the execution entity initializes the grid search object, creating a `GridSearchCV`. The system takes a random forest regression model, a parameter grid, cross-validation folds (cv=5), and an evaluation metric as input. Then, the execution entity performs a grid search using the training set data, extracting the model with the minimum mean squared error (MSE) from the grid search results. If the model's MSE < 0.1, the model is determined as the target prediction model. If the model's MSE does not meet the preset MSE threshold of 0.1, the grid search continues to fine-tune the parameters until the model's MSE < 0.1, thus obtaining the target prediction model. After obtaining the target prediction model, the execution entity uses the joblib module to persist the hyperparameter-tuned target prediction model to a file.
[0104] Step 104: Input the target change operation into the target prediction model to obtain the performance index of the resource data, and determine whether the target change operation can be executed during peak business periods based on the performance index.
[0105] Here, after the executing entity constructs the target prediction model based on the simulated usage data and the second usage data, it can input the target change operation into the target prediction model to obtain the performance indicators of the resource data, and determine whether the target change operation can be executed during the peak business period based on the performance indicators.
[0106] In one possible embodiment, inputting the target change operation into the target prediction model to obtain performance metrics of the resource data includes the following steps: The executing entity obtains the initial change operation, which includes the specific operation type of the change operation and the timestamp of executing the change operation. For example, the initial change operation may be: "timestamp, operation_type" 12:00, create_table 12:05, alter_table …,…” After obtaining the initial change operation, the executing entity extracts time features from the initial change operation and performs normalization processing, that is, extracts features such as hour, minute, and weekday from the timestamp. It should be noted that the extraction method is the same as the method for extracting time features in the above embodiment, and will not be repeated here. After obtaining the initial change operation and the time features of the initial change operation, the executing entity calculates the mean of each feature based on the second usage data, and uses these mean values to fill the default system load feature value. Specifically, the executing entity reads the second usage data of resource data when no change operation is performed in the database during the peak business period, calculates the mean of each feature in the second usage data, and uses the feature mean to fill the default system load feature value. For example, the feature values are as follows: default_values = { 'cpu_usage': 0.70, # Peak CPU utilization averages 70% 'memory_usage': 0.75, # Peak memory usage averages 75% 'io_usage': 200, # Peak I / O usage averages 200MB / s 'wait_event_duration': 50, # The average duration of the wait event is 50ms. 'wait_event_frequency': 10, # The average frequency of waiting events is 10 times. 'lock_duration': 60, # The average lock duration is 60ms 'lock_wait_time': 30# The average lock wait time is 30ms. 'timestamp': 00:00 # Timestamp } After obtaining the default system load characteristic value, the executing entity calculates its interaction characteristics based on the filled default system load characteristic value. The processing method is the same as the method for calculating interaction characteristics in the above embodiment, and will not be repeated here. Finally, the executing entity inputs the initial change operation, the time characteristics of the initial change operation, the default system load characteristic value, and the interaction characteristics as the target change operation into the target prediction model. For example, the target change operation is as follows: Feature name / value --------------------------------- TIMESTAMP / 00:00 OPERATION_TYPE / create_table CPU_USAGE / 0.70 MEMORY_USAGE / 0.65 IO_USAGE / 210 WAIT_EVENT_DURATION / 100 WAIT_EVENT_FREQUENCY / 12 LOCK_DURATION / 110 LOCK_WAIT_TIME / 55 HOUR / 0 MINUTE / 0 DAY_OF_WEEK / 1 CPU_MEM_INTERACTION / 0.455 CPU_IO_INTERACTION / 147.00 MEM_IO_INTERACTION / 136.50 WAIT_DURATION_FREQUENCY / 1200 LOCK_DURATION_WAIT / 6050 After the executing entity inputs the target change operation into the target prediction model, it obtains the performance indicators of the resource data. For example, the obtained performance indicators are as follows: Indicator Name / Predicted Value --------------------------------- CPU_USAGE_peak / 0.78 MEMORY_USAGE_peak / 0.72 IO_USAGE_peak / 220 WAIT_EVENT_DURATION_peak / 105 WAIT_EVENT_FREQUENCY_peak / 13 LOCK_DURATION_peak / 115 LOCK_WAIT_TIME_peak / 58” In one possible embodiment, determining whether a target change operation can be performed during peak business hours based on performance metrics includes the following steps: The performance metrics are compared with multiple preset safety thresholds; If the comparison results show that all performance indicators do not exceed the corresponding preset security thresholds, then the target change operation can be performed during peak business hours.
[0107] Specifically, after the executing entity constructs a target prediction model based on simulated usage data and second usage data, the executing entity compares the performance indicators with multiple preset safety thresholds. When the comparison result shows that none of the performance indicators exceed the corresponding preset safety thresholds, it is determined that the target change operation can be executed during peak business periods.
[0108] In one possible embodiment, following the previous example, several preset security thresholds are as follows: CPU_USAGE_peak<0.85 MEMORY_USAGE_peak<0.80 IO_USAGE_peak<250 MB / s WAIT_EVENT_DURATION_peak<120 ms WAIT_EVENT_FREQUENCY_peak<15 times LOCK_DURATION_peak<130 ms LOCK_WAIT_TIME_peak<70 ms The executing entity compares the performance indicators generated by the target prediction model in the above embodiments with multiple preset safety thresholds. When the comparison result shows that all performance indicators do not exceed the corresponding preset safety thresholds, it is determined that the target change operation can be executed during peak business hours; otherwise, it is determined that the target change operation cannot be executed during peak business hours.
[0109] This disclosure provides a database modification method, apparatus, device, medium, and product. In this embodiment, firstly, first usage data of resource data is obtained when a database modification operation is performed during a non-peak business period, and second usage data of resource data is obtained when no modification operation is performed during a peak business period. Then, simulated usage data is generated based on the first usage data. The simulated usage data characterizes the resource status of resource data when a database modification operation is performed during a peak business period. Next, a target prediction model is constructed based on the simulated usage data and the second usage data. Finally, the target modification operation is input into the target prediction model to obtain performance indicators of the resource data, and the performance indicators are used to determine whether the target modification operation can be performed during a peak business period.
[0110] As described above, this embodiment of the present disclosure first obtains first usage data when database change operations are performed during non-peak business periods and second usage data when no change operations are performed during peak business periods. Based on the first usage data, simulated usage data that can characterize the resource status during change operations under peak business periods is generated. Then, a target prediction model is constructed by combining the simulated usage data and the second usage data. Finally, the model is used to predict performance indicators based on the input target change operation and determine whether it can be executed during peak business periods. This achieves intelligent, efficient, and real-time evaluation of the impact of database change operations, significantly improving prediction accuracy and real-time performance. At the same time, it reduces the risk of misjudgment due to environmental differences, reduces resource and time costs, simplifies the change operation process, effectively avoids unnecessary business interruptions, and thus improves system stability and operational efficiency.
[0111] As described above, the technical solution disclosed herein effectively overcomes the shortcomings of traditional database change operation management, such as high cost, high complexity, and insufficient real-time performance, by introducing an intelligent evaluation method based on machine learning. Furthermore, by using real data from both peak and off-peak periods for modeling, and combining random forest regression algorithm with feature interaction technology, this technical solution achieves accurate prediction of the impact of change operations. This not only significantly reduces resource and time consumption and the risk of misjudgment due to environmental differences, but also significantly simplifies the operation and maintenance process and avoids unnecessary business interruptions. Thus, while improving the accuracy and real-time performance of the evaluation, it ensures system stability and business continuity.
[0112] In the case of dividing each functional module according to its corresponding functions, this disclosure provides a database modification device, which can be a server or a chip applied to a server. Figure 5 A schematic block diagram of the functional modules of a database modification device provided for an exemplary embodiment of this disclosure. Figure 5 As shown, the database modification device includes: The acquisition module 501 is used to acquire the first usage data of resource data when the database performs a change operation during non-peak business periods, and to acquire the second usage data of resource data when the database does not perform the change operation during peak business periods; The generation module 502 is used to generate simulated usage data based on the first usage data; the simulated usage data is used to characterize the resource status of the resource data when the database performs the change operation during the peak business period; Module 503 is used to construct a target prediction model based on the simulated usage data and the second usage data; The evaluation module 504 is used to input the target change operation into the target prediction model, obtain the performance index of the resource data, and determine whether the target change operation can be executed during peak business periods based on the performance index.
[0113] In one embodiment, the generation module 502 includes: The first grouping unit is used to group the first usage data according to the operation type of the change operation to obtain multiple subsets; wherein, each subset corresponds to a resource performance index of the database under one operation type; The first determining unit is used to determine the statistical parameters corresponding to each of the subset datasets; The first processing unit is configured to process the statistical parameters based on the second usage data to obtain the data to be merged corresponding to each statistical parameter; The merging unit is used to merge all the data to be merged corresponding to the statistical parameters to obtain the simulated usage data.
[0114] In one embodiment, the generation module 502 includes: The second determining unit is used to determine the adjustment coefficient for the corresponding operation type based on the statistical parameters and the second usage data; wherein, the adjustment coefficient is used to quantify the difference in the level of resource data when the database performs the corresponding change operation during the peak business period and when the change operation is not performed during the non-peak business period; A scaling unit is used to scale the statistical parameters based on the adjustment coefficient to obtain scaled statistical parameters; The first acquisition unit is used to acquire the data to be merged corresponding to each of the statistical parameters based on the scaled statistical parameters.
[0115] In one embodiment, the generation module 502 includes: The first calculation unit is used to calculate the global average value of resource performance indicators in the second usage data; The third determining unit is used to determine the ratio of the global average value to the mean value in the statistical parameters as the adjustment coefficient.
[0116] In one embodiment, the generation module 502 includes: The second calculation unit is used to calculate the product of the mean of the statistical parameters and the adjustment coefficient to obtain the first scaled parameter; The third calculation unit is used to calculate the product of the standard deviation and the adjustment coefficient in the statistical parameters to obtain the second scaled parameters.
[0117] In one embodiment, the generation module 502 includes: The second acquisition unit is used to acquire the data to be merged corresponding to each statistical parameter through a normal distribution sampling function; wherein the first scaled parameter and the second scaled parameter are the sampling parameters of the normal distribution sampling function.
[0118] In one embodiment, the building module 503 includes: The second processing unit is used to perform feature processing on the simulated usage data to obtain a target feature set; wherein, the target feature set includes the interaction features between multiple resource performance indicators in the simulated usage data; The third acquisition unit is used to generate a training dataset based on the target feature set and the second usage data; The first model training unit is used to train the random forest regression model based on the training dataset to obtain the target prediction model.
[0119] In one embodiment, the building module 503 includes: The fourth acquisition unit is used to generate interactive features that reflect the degree of joint influence among the multiple resource performance indicators based on the multiple resource performance indicators in the simulated usage data. The extraction unit is used to extract time period features from the timestamps of the simulated usage data and normalize the time period features to obtain normalized features. The fifth acquisition unit is used to add the interaction features and the normalized features to the simulated usage data to obtain the target feature set.
[0120] In one embodiment, the building module 503 includes: A matching unit is used to match and align the target feature set with the actual usage data to obtain matched data; wherein, the actual usage data is the actual usage data of resource data when performing change operations during the peak business period; The fourth determining unit is used to determine the training dataset based on the matched data; wherein the training dataset contains multiple training samples, the input features in each training sample are determined based on the target feature set in the matched data, and the label value in the training sample is determined based on the actual usage data in the matched data.
[0121] In one embodiment, the building module 503 includes: The second grouping unit is used to divide the training dataset into a training set and a test set according to a preset ratio; The second model training unit is used to train the random forest regression model using the training set to obtain an initial model, and to perform hyperparameter tuning on the initial model to obtain an optimized model. The fourth calculation unit is used to calculate the mean square error of the optimized model using the test set; The fifth determining unit is used to determine the optimized model as the target prediction model when the mean square error is less than a preset threshold.
[0122] In one embodiment, the evaluation module 504 includes: A comparison unit is used to compare the performance indicators with multiple preset safety thresholds; An evaluation unit is used to determine that the target change operation can be performed during the peak business period when the comparison result shows that none of the performance indicators exceed the corresponding preset security threshold.
[0123] This disclosure also provides an electronic device, including: at least one processor; a memory for storing processor-executable instructions; wherein the at least one processor is configured to execute the instructions to implement the methods disclosed in this disclosure.
[0124] Figure 6 This is a schematic diagram of the structure of an electronic device provided as an exemplary embodiment of this disclosure. For example... Figure 6 As shown, the electronic device 600 includes at least one processor 601 and a memory 602 coupled to the processor 601. The processor 601 can perform the corresponding steps in the methods disclosed in the embodiments of this disclosure.
[0125] The processor 601 described above can also be called a central processing unit (CPU), which can be an integrated circuit chip with signal processing capabilities. Each step in the method disclosed in this embodiment can be implemented by the integrated logic circuitry in the processor 601 or by software instructions. The processor 601 can be a general-purpose processor, a digital signal processor (DSP), an ASIC, a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this embodiment can be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software modules can be located in the memory 602, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The processor 601 reads information from the memory 602 and, in conjunction with its hardware, completes the steps of the method described above.
[0126] Furthermore, various operations / processes according to this disclosure, implemented via software and / or firmware, can be transmitted from a storage medium or network to a computer system with a dedicated hardware architecture, such as... Figure 7 The computer system 700 shown is equipped with the programs that constitute the software. When various programs are installed, the computer system is able to perform various functions, including functions such as those described above. Figure 7 A block diagram of a computer system provided for an exemplary embodiment of this disclosure.
[0127] Computer system 700 is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0128] like Figure 7As shown, the computer system 700 includes a computing unit 701, which can perform various appropriate actions and processes based on a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. The RAM 703 may also store various programs and data required for the operation of the computer system 700. The computing unit 701, ROM 702, and RAM 703 are interconnected via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0129] Multiple components in the computer system 700 are connected to the I / O interface 705, including: an input unit 706, an output unit 707, a storage unit 708, and a communication unit 709. The input unit 706 can be any type of device capable of inputting information into the computer system 700. The input unit 706 can receive input numerical or character information and generate key signal inputs related to user settings and / or function control of the electronic device. The output unit 707 can be any type of device capable of presenting information and may include, but is not limited to, a monitor, speaker, video / audio output terminal, vibrator, and / or printer. The storage unit 708 may include, but is not limited to, a hard disk and an optical disk. The communication unit 709 allows the computer system 700 to exchange information / data with other devices via a network such as the Internet, and may include, but is not limited to, a modem, network card, infrared communication device, wireless communication transceiver, and / or chipset, such as Bluetooth™ device, WiFi device, WiMax device, cellular communication device, and / or the like.
[0130] The computing unit 701 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 701 performs the various methods and processes described above. For example, in some embodiments, the methods disclosed in this disclosure can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 708. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 600 via ROM 702 and / or communication unit 709. In some embodiments, the computing unit 701 can be configured to perform the methods disclosed in this disclosure by any other suitable means (e.g., by means of firmware).
[0131] This disclosure also provides a computer-readable storage medium, wherein when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is able to perform the methods disclosed in this disclosure.
[0132] The computer-readable storage medium in this disclosure can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. The aforementioned computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specifically, the aforementioned computer-readable storage medium may include electrical connections based on one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0133] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0134] Figure 8 A computer program product 800 is provided as an exemplary embodiment of the present disclosure. The computer program product 800 includes a computer program 801, wherein the computer program 801, when executed by a processor, implements the methods disclosed in the embodiments of the present disclosure.
[0135] In embodiments of this disclosure, computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof. These programming languages include, but are not limited to, object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network (including a local area network (LAN) or a wide area network (WAN)), or it can be connected to an external computer.
[0136] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0137] The modules, components, or units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the modules, components, or units do not necessarily constitute a limitation on the module, component, or unit itself.
[0138] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary hardware logic components that can be used include: field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), system-on-a-chip (SoCs), complex programmable logic devices (CPLDs), and so on.
[0139] The above description is merely an embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0140] While specific embodiments of this disclosure have been described in detail by way of example, those skilled in the art should understand that the examples are for illustrative purposes only and not intended to limit the scope of this disclosure. Those skilled in the art should understand that modifications can be made to the above embodiments without departing from the scope and spirit of this disclosure. The scope of this disclosure is defined by the appended claims.
Claims
1. A method for modifying a database, characterized in that, include: Obtain the first usage data of resource data when the database is modified during off-peak business periods, and obtain the second usage data of resource data when the database is not modified during peak business periods; Simulated usage data is generated based on the first usage data; the simulated usage data is used to characterize the resource status of the resource data when the database performs the change operation during the peak business period. A target prediction model is constructed based on the simulated usage data and the second usage data; The target change operation is input into the target prediction model to obtain the performance index of the resource data, and the target change operation can be executed during peak business periods based on the performance index.
2. The method according to claim 1, characterized in that, The step of generating simulated usage data based on the first usage data includes: The first data in use is grouped according to the operation type of the change operation to obtain multiple subsets; wherein, each subset corresponds to a resource performance index of the database under one operation type; Determine the statistical parameters corresponding to each of the aforementioned subsets; Based on the second usage data, the statistical parameters are processed to obtain the data to be merged corresponding to each statistical parameter; The data to be merged corresponding to all the statistical parameters are merged to obtain the simulated usage data.
3. The method according to claim 2, characterized in that, The step of processing the statistical parameters based on the second usage data to obtain the data to be merged corresponding to each statistical parameter includes: The adjustment coefficient for the corresponding operation type is determined based on the statistical parameters and the second usage data; wherein, the adjustment coefficient is used to quantify the difference in the level of resource data when the database performs the corresponding change operation during the peak business period and when the change operation is not performed during the off-peak business period; The statistical parameters are scaled based on the adjustment coefficient to obtain scaled statistical parameters. Based on the scaled statistical parameters, obtain the data to be merged corresponding to each statistical parameter.
4. The method according to claim 3, characterized in that, The step of determining the adjustment coefficient for the corresponding operation type based on the statistical parameters and the second usage data includes: Calculate the global average value of resource performance indicators in the second usage data; The ratio of the global average to the mean of the statistical parameters is determined as the adjustment coefficient.
5. The method according to claim 3, characterized in that, The scaling of the statistical parameters based on the adjustment coefficient to obtain scaled statistical parameters includes: Calculate the product of the mean of the statistical parameters and the adjustment coefficient to obtain the first scaled parameter; The product of the standard deviation and the adjustment coefficient in the statistical parameters is calculated to obtain the second scaled parameter.
6. The method according to claim 5, characterized in that, The step of obtaining the data to be merged corresponding to each of the scaled statistical parameters includes: The data to be merged corresponding to each statistical parameter is obtained by means of a normal distribution sampling function; wherein, the first scaled parameter and the second scaled parameter are the sampling parameters of the normal distribution sampling function.
7. The method according to claim 1, characterized in that, The construction of the target prediction model based on the simulated usage data and the second usage data includes: The simulated usage data is subjected to feature processing to obtain a target feature set; wherein, the target feature set contains the interaction features between multiple resource performance indicators in the simulated usage data; Based on the target feature set and the second usage data, a training dataset is generated; The random forest regression model is trained based on the training dataset to obtain the target prediction model.
8. The method according to claim 7, characterized in that, The step of performing feature processing on the simulated data to obtain the target feature set includes: Based on multiple resource performance indicators in the simulated usage data, interactive features reflecting the degree of joint influence among the multiple resource performance indicators are generated. Extract time period features from the timestamps of the simulated data, and normalize the time period features to obtain normalized features; The interaction features and the normalized features are added to the simulated usage data to obtain the target feature set.
9. The method according to claim 7, characterized in that, The step of generating a training dataset based on the target feature set and the second set of data includes: The target feature set is matched and aligned with the actual usage data to obtain the matched data; wherein, the actual usage data is the actual usage data of resource data when performing change operations during the peak business period; The training dataset is determined based on the matched data; wherein the training dataset contains multiple training samples, the input features of each training sample are determined based on the target feature set in the matched data, and the label value of the training sample is determined based on the actual usage data in the matched data.
10. The method according to claim 7, characterized in that, The step of training the random forest regression model based on the training dataset to obtain the target prediction model includes: The training dataset is divided into a training set and a test set according to a preset ratio; The random forest regression model is trained using the training set to obtain an initial model, and the hyperparameters of the initial model are tuned to obtain an optimized model. The mean square error of the optimized model is calculated using the test set. When the mean square error is less than a preset threshold, the optimized model is determined as the target prediction model.
11. The method according to claim 1, characterized in that, The step of determining whether the target change operation can be executed during peak business periods based on the performance indicators includes: The performance indicators are compared with multiple preset safety thresholds; If the comparison result shows that none of the performance indicators exceed the corresponding preset security threshold, then it is determined that the target change operation can be executed during the peak business period.
12. A database modification device, characterized in that, include: The acquisition module is used to acquire the first usage data of resource data when the database performs a change operation during non-peak business periods, and to acquire the second usage data of resource data when the database does not perform the change operation during peak business periods; The generation module is used to generate simulated usage data based on the first usage data; the simulated usage data is used to characterize the resource status of the resource data when the database performs the change operation during the peak business period; A building module is used to build a target prediction model based on the simulated usage data and the second usage data; The evaluation module is used to input the target change operation into the target prediction model, obtain the performance index of the resource data, and determine whether the target change operation can be executed during peak business periods based on the performance index.
13. An electronic device, characterized in that, include: At least one processor; Memory for storing the at least one processor-executable instruction; The at least one processor is configured to execute the instructions to implement the method as described in any one of claims 1-11.
14. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is enabled to perform the method as described in any one of claims 1-11.
15. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-11.