Database index determination and verification

By analyzing the database workload, automated index management tools realize automatic tuning of database performance on the cloud database platform, solving the problems of existing tools being difficult to expand and relying on manual intervention, and improving the efficiency and accuracy of index optimization.

CN113597606BActive Publication Date: 2024-10-01MICROSOFT TECHNOLOGY LICENSING LLC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201980088776.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2019-01-14
Filing Date
2019-12-23
Publication Date
2024-10-01
Estimated Expiration
2039-12-23

AI Technical Summary

Technical Problem

Existing database index management tools are difficult to automate, cannot effectively scale to a large number of databases, and rely on manual intervention, resulting in low index optimization efficiency and difficulty in adapting to the needs of cloud database platforms and large-scale SaaS providers.

Method used

By analyzing the workload of the database, automatically determine the representative workload, create a clone database, perform optimization operations, verify the optimization effect, implement automated index management, ensure that the index has minimal impact on the application workload under resource constraints, and use model recommendation and verification services to Adjust index configuration.

Benefits of technology

It realizes automatic adjustment of database performance, reduces manual intervention, improves index optimization efficiency, is suitable for large-scale database environments, and ensures the accuracy of index configuration and resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113597606B_ABST
    Figure CN113597606B_ABST
Patent Text Reader

Abstract

Systems, methods, and computer executable instructions for reorganizing a physical layout of data of a database. A workload is selected from previously executed database operations. A total resource consumption of the previously executed database operations and the workload is determined. The total resource consumption of the workload is greater than a predetermined threshold of the total resource consumption of the previously executed database operations. Optimization operations for the database are determined using the workload. A clone database of the database is created. The optimization operations are performed on the clone database. Database operations for the database are received. Database operations are performed on the database and the clone database. Based on the execution of the database operations on the database and the clone database, it is verified that the performance of the clone database is improved compared to the performance of the database.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to database index determination and validation. Background Art

[0002] A database with an appropriate set of indexes typically results in orders of magnitude better performance and lower resource utilization than a database with fewer optimal indexes. Choosing the right set of indexes can depend on the workload, architecture, and data. Therefore, choosing the right set of indexes is a challenging task even for an expert database administrator (DBA). Being able to identify and implement indexes to improve query performance is an important added value of performance management for relational database management systems (RDBMS). This index identification may be more desirable in cloud database platforms because application developers who typically lack expertise in database performance tuning can provision databases without using a DBA. Another challenge is for software as a service (SaaS) providers and cloud software providers (CSV) that deploy hundreds to thousands of databases for their application customers. Managing such a large pool of databases is a daunting task even for expert DBAs whose individual database instances have different architectures, queries, and data distributions. Summary of the invention

[0003] In a first aspect, a computer-implemented method for tuning a database is provided, the method comprising: selecting a workload including a plurality of previously executed database operations from database operations previously executed on the database; determining a total computing resource consumption of the previously executed database operations; determining a total computing resource consumption of the workload; verifying that the total computing resource consumption of the workload is greater than a predetermined threshold of the total computing resource consumption of the previously executed database operations; determining an optimization operation for the database using the workload; creating a clone database of the database; performing the optimization operation on the clone database to tune the clone database; receiving a database operation for the database; performing the database operation on the database and the tuned clone database; determining the computing resource consumption of performing the database operation on the database and the tuned clone database; and verifying that the performance of the tuned clone database is improved compared to the performance of the database based on the determined computing resources consumed by performing the database operation on the database and the tuned clone database.

[0004] In a second aspect, a system for tuning a database is provided. The system includes: an electronic processor configured to: select a workload including a plurality of previously executed database operations from database operations previously executed on the database; determine the total computing resource consumption of the previously executed database operations; determine the total computing resource consumption of the workload; verify that the total computing resource consumption of the workload is greater than a predetermined threshold of the total computing resource consumption of the previously executed database operations; use the workload to determine an optimization operation for the database; create a clone database of the database; perform the optimization operation on the clone database to tune the clone database; receive a database operation for the database; perform the database operation on the database and the tuned clone database; determine the computing resource consumption of performing the database operation on the database and the tuned clone database; and verify that the performance of the clone database is improved compared to the performance of the database based on the determined computing resources consumed by performing the database operation on the database and the tuned clone database.

[0005] In a third aspect, a non-transitory computer-readable storage medium is provided, storing computer-executable instructions for tuning a database. The stored instructions include: instructions for selecting a workload including a plurality of previously executed database operations from database operations previously executed on the database; instructions for determining the total computing resource consumption of the previously executed database operations; instructions for determining the total computing resource consumption of the workload; instructions for verifying that the total computing resource consumption of the workload is greater than a predetermined threshold of the total computing resource consumption of the previously executed database operations; instructions for determining an optimization operation for the database using the workload; instructions for creating a clone database of the database; instructions for performing the optimization operation on the clone database to tune the clone database; instructions for receiving a database operation for the database; instructions for performing the database operation on the database and the tuned clone database; instructions for determining the computing resource consumption of performing the database operation on the database and the tuned clone database; and instructions for verifying that the performance of the clone database is improved compared to the performance of the database based on the determined computing resources consumed by performing the database operation on the database and the tuned clone database. BRIEF DESCRIPTION OF THE DRAWINGS

[0006] Figure 1 is a block diagram of a system for optimizing a database according to various examples.

[0007] Figure 2 is a block diagram of a system for validating database optimization according to various examples.

[0008] Figure 3 is a flow chart of a process for optimizing a database according to various examples.

[0009] Figure 4 is an example computing device that can be used in conjunction with the techniques described herein. DETAILED DESCRIPTION

[0010] Current query tuning tools help DBAs identify the appropriate set of indexes for only a specified set of inputs. These approaches rely on human intervention for several other key steps in index management. For example, a DBA may be responsible for several important tasks, such as: (i) identifying representative workloads; (ii) analyzing the database without affecting production instances; (iii) implementing index changes; (iv) ensuring that these actions do not adversely affect query performance; and (v) continuously tuning the database as workloads drift and data distribution changes. This human-in-the-loop approach cannot scale to large numbers of databases, such as thousands or millions. Therefore, a fully automated database tuning approach is desired.

[0011] Automating the tuning of databases via index management can simplify the performance management of databases. Automated indexing is an important pillar of performance tuning because the right set of indexes can result in orders of magnitude better performance. Previous systems provided information to the DBA, who provided input to the system. Such systems do not scale for CSVs with large databases. In various examples, the automatic indexing service analyzes the workload of the database, determines the workload to be optimized, identifies the appropriate set of indexes to build, implements the indexes, and ensures that query execution costs are improved after the indexes are implemented. This automatic indexing service can continuously tune the database as the workload and data distribution change.

[0012] One challenge in scaling index optimization is removing any input from the DBA. No system can scale to handle all of the databases that CSV will have with manual input. For example, some CSVs have multiple regions around the world hosting millions of databases for tens of thousands of customers. In addition to ensuring the health and operation of the automatic indexing service, the various samples allow for tuning the quality of the recommendations as workloads and databases change.

[0013] However, there are many challenges in removing the expertise provided by the DBA. For example, various examples generate high-quality recommendations without knowledge of application semantics or explicitly specified workloads. In previous DBA-involved tuning systems, the DBA has the context of the application being tuned, which is used to identify representative workloads and appropriately set the necessary inputs for the tuning task (e.g., the type of index to recommend, any constraints such as storage budget or number of indexes, etc.). In various examples, the inputs to these index tuners are identified without the knowledge used by the DBA.

[0014] Because optimizations are automatically determined and implemented, in various examples, the optimizations are validated using real-world database operations rather than estimated costs. For example, a known index recommender may rely on a query optimizer's cost estimates to determine the benefits of a new index configuration. However, the cost estimates may be inaccurate compared to actual query performance (e.g., query latency) or execution cost (e.g., CPU time for a query). Due to known limitations of the query optimizer's estimates, in some cases, an index that is estimated to improve based on the optimizer's costs may make query execution cost (or performance) worse after implementation. Validating implemented optimizations can be used to identify and correct these scenarios.

[0015] Various examples describe a technique and system design that uses index recommendation software in a fault-tolerant service that can run on thousands of servers and databases at a given moment. In addition, control logic can manage the state of these long-running tuning sessions in the presence of multiple failures. To tune a database, a representative workload is acquired, identifying key inputs for appropriate indexes, by analyzing previous query executions aggregated on the database servers. In addition, some examples point to techniques for "synchronizing" index recommendations with the query optimizer, ensuring that indexes will be used with minimal overhead after implementation, working under strict resource constraints, and ensuring minimal impact on application workloads running concurrently with the tuning process. In addition, if a tuning session is affecting or delaying application workloads it may be detected, and corrective actions can be taken to minimize the impact on the workload. To test optimizations, large-scale experiments can be conducted using different recommendation models, and additional replicas of the database where the workload is being replayed can be used to push new improvements or recommendation patterns without affecting production workloads on the primary replica.

[0016] Figure 11 is a block diagram of a system 100 for optimizing a database according to various examples. A control plane 110 may control an automatic indexing service used to optimize a database 120. The control plane 110 may handle management of the database 120. The control plane 110 may be implemented on one or more computing devices. The database 120 may be part of a CSV product and may include a database set up and managed by an end user. The end user may provide permission to the control plane 110 to optimize their database without any interaction with the end user. In one example, the control plane 110 may use an index recommender such as a missing index, such as Missing index features, Database Engine Tuning Advisors, such as , a database engine tuning advisor, or both to optimize database 120. For compliance reasons, the recommender can be run on a node in coordination with the end-user database. In some examples, the recommender is modified to avoid metadata contention with the workload. Metadata contention may occur when objects are created and destroyed within the database. Avoiding contention helps ensure that the recommender does not interfere with the end-user's use of the database because the recommender may interact with the end-user's live database.

[0017] The model recommendation 130 may be provided by a recommender. The model recommendation 130 may include indexes to create, indexes to drop, or both. For example, the model recommendation 130 may use a workload for a database to identify indexes that would reduce resource consumption of running the workload on the database. In one example, the workload includes database operations such as select, delete, update, etc. The resource consumption may be CPU time to execute the query, actual query performance, logical bytes read, etc.

[0018] The control plane 110 may adopt the model recommendation 130 and update the database 120 accordingly. In an example, the database 150 stores changes to the database. The end user may use the portal 160 to access the changes suggested by the model recommendation 130. The end user may then select which suggestions to implement on the database. The control plane 110 may implement the changes to the database, generate and store indexes included in the selected recommendations. In another example, the model recommendation 130 is implemented by the control plane 110 without the end user specifically providing authorization. In various examples, the end user previously authorized the automatic implementation of the model.

[0019] The control plane 110 can monitor the database to determine when to implement the model recommendations 130. For example, the control plane 110 can determine when database usage was minimal or below a resource threshold over a past time period and use that time to implement the model recommendations 130.

[0020] After implementing the model recommendation 130 on the database, the validation 140 service monitors the database. In an example, the validation 140 service determines whether resource consumption of the database increases over a period of time after the model recommendation 130 is implemented. If resource consumption increases, the model recommendation 130 or a portion of the model recommendation 130 may be restored. In some examples, the validation 140 service may first run the model recommendation 130 on an experimental database.

[0021] Figure 2 is a block diagram of a system 200 for validating database optimization according to various examples. The control plane 110 may receive database recommendations for all databases of the databases 120 or some number of the databases 120. The validation 140 service may validate the model recommendations 130 by implementing the model recommendations 130 on a subset of the databases 120, rather than implementing all of the model recommendations 130 at once. For example, the validation 140 service, which may be part of the experimental control 210, may create a clone of the database 204B as a clone database 206. In one example, the clone database 206 is a copy of the database 204B. The model recommendations 130 of the database 204B may be implemented on the clone database 206. In addition, the model recommendations for the databases 204B and the database 204C may be stored for later implementation. In some examples, the control plane 110 may validate the model recommendations 130.

[0022] In the example, application server 202B sends database operations to database 204B. These operations are performed on database 204B. In addition, experiment control 210 can then perform the same operations on clone database 206. Application server 202A and application server 202C also send database operations to their respective databases 204A and 204C. Experiment control 210 can monitor the resources consumed by database 204B and clone database 206. Experiment control 210 can monitor database 204B and clone database 206 over a period of time and determine whether clone database 206 with model recommendations consumes fewer resources than database 204B. If the consumed resources are less, model recommendations for databases 204A, 204B, and 204C can be implemented. If the consumed resources are not less, then experiment control 210 can determine one or more model recommendations that result in an increase in consumed resources. These model recommendations can be removed from the model recommendations of database 204B and can also be restored from clone database 206. Experiment control 210 may then continue to monitor clone database 206 for improvements to database 204B. Experiment control 210 may monitor hundreds or thousands of clone databases to ensure that model recommendations result in better database performance.

[0023] Figure 3300 is a flow chart of a process for optimizing a database according to various examples. Optimizing a database may include reconfiguring the indexes used by the database. Determining which indexes should be created and which indexes should be discarded is a challenging problem. Previous systems use the expertise of the DBA to select workloads for expensive database operations. An index recommender uses the workload and optimizes the database to minimize the estimated total cost of the workload. Therefore, workload selection is an important step in effectively optimizing a database.

[0024] For cloud service providers where end users may create millions of databases, a method for automatically determining representative workloads allows the database optimization process to scale across millions of databases. In one example, identifying an appropriate set of indexes for a given database uses an overall analysis of database operations that have been performed on the database, such as queries and updates. At 310, the workload is selected from previously executed database operations for the database. The workload will be used to optimize the database. Therefore, the workload can represent how the database is actually used, thereby optimizing the performance that affects the real world. In various examples, workload coverage is used to determine the workload. For example, workload coverage can be the percentage of resources consumed by the database operations of the workload as a percentage of the total resources consumed by all database operations performed on the database over a period of time. High workload coverage, (e.g., greater than 75%, 80%, 90%, etc.), means that the statements analyzed by the tuner account for a significant number of resources consumed by the database. In various examples, historical execution statistics stored in the query are used to calculate workload coverage.

[0025] At 320, the resource consumption of the workload is verified to be representative of previously executed database operations. In an example, this can be accomplished by determining the total resource consumption of previously executed database operations and determining the total resource consumption of the workload. The resource consumption can then be compared to each other. For example, if the resource consumption of the workload is 80% or more of all previously executed database operations within a certain time period, the workload is considered representative. In one example, the workload is generated by sorting database operations based on cost. Database operations can then be added to the workload until the workload consumes at least a resource threshold. Different types of operations can also be used to determine whether the workload is representative. For example, verification that the workload includes inserts, updates, discards, etc. can also be made. If any type of operation is missing, the corresponding operation can be found from the previously executed operations and added to the workload.

[0026] At 330, database optimization operations for the database are determined. Database optimization operations may include creating and dropping indexes. In one example, optimization operations can be found by using a missing index analyzer. In one example, the optimizer searches for an execution plan for a query. Query predicates are analyzed to identify the best indexes in terms of access cost to data associated with the predicates. If these indexes do not exist, the query optimizer will expose this information through the missing index function. These indexes are accumulated in a dynamic management view (DMV) set. Missing indexes are associated with predicates in the DMV, for example, which columns are accessed in equality predicates, which columns are accessed in inequality predicates, and which columns are required upstream in the query plan.

[0027] In some examples, the missing index feature provides only raw information about index candidates for a query. In order to use these candidates to generate final recommendations, the impact of the index on the entire workload is analyzed. DMVs may also not be persistent. Statistics accumulate over time, but may be reset after a server restart, failover, schema change, or major / secondary swap. In some examples, to overcome these limitations, periodic snapshots of the DMV may be taken. Final index recommendations can use the information in the DMV to generate database optimization operations. However, the DMV information may need to be modified. For example, the DMV may not specify any ordering of columns in the index. To illustrate this, a non-clustered (secondary) index candidate may be defined as an EQUALITY column, followed by an INEQUALITY column as a key column, and an INCLUDE column as an additional included column. If multiple columns are included in each type, the ordering within the type is arbitrary. DMVs may provide statistics such as the number of queries that triggered index recommendations, the average optimizer estimated cost per query that can be improved, and the expected improvement percentage of the index in the optimizer estimate. These statistics can be used to determine the aggregate impact of the index. Candidates that have few query executions (e.g., ad hoc queries) or have not appeared in several recent snapshots (e.g., due to significant architecture or workload changes) may be filtered out from recommendations.

[0028] Since the DMV may accumulate these statistics, truly beneficial indexes may have an impact over time. However, in order to tolerate the reset of the DMV, a statistically robust measure of this positive gradient of the impact score can be used. For example, a hypothesis test can be formulated to test the incremental impact of an index. Assuming that the error is normally distributed, a t-statistic can be calculated for the slope of the index impact over time that is above a configurable threshold. By analyzing these statistics for hundreds of thousands of databases, a few data points are sufficient to exceed the predetermined certainty limit for high-impact indexes. In addition, in order to identify factors that benefit indexes for multiple queries, factors for merging indexes can be explored. In the example, a simple rule of only performing conservative merges of indexes is used, for example, merging candidates with the same key columns but different included columns. In the example of determining an optimization operation, the top k indexes with the highest impact with an impact slope above a threshold can be identified as the indexes to be created for the database.

[0029] In another example, the optimization operation can be found by using the database engine tuning advisor (DTA). In another example, both the missing index analyzer and DTA are used to determine the optimization operation. DTA is a comprehensive physical design tool that finds the physical design that minimizes the workload cost estimated by the optimizer given a workload. The core of DTA is a cost-based search for alternative configurations. For each query in the workload, DTA starts with the candidate selection that finds the best configuration for the query. Candidates from all queries are used for workload-level enumeration and output the final recommendation. DTA may use the "hypothesis" API of the query optimizer to estimate the cost of the hypothetical configuration in its search process. DTA is designed to be called by an expert human administrator who provides a representative workload, sets appropriate options, and then analyzes the recommendation to determine which recommendation to implement. In order to use DTA for automatic indexing, DTA is run as an automated service. DTA's enhancements and design changes include the ability to run DTA with strict resource and cost budgets and with minimal impact on any production workload; automatically obtain representative workloads for tuning; and run DTA as a service.

[0030] During a tuning session, DTA can connect to the database to access metadata, build and read sampling statistics, and make query optimizer calls. Due to the number of calls DTA makes to the server, and to meet security and compliance requirements, DTA can run in conjunction with the primary replica of the database server. Therefore, DTA can run concurrently with the customer's workload. Therefore, DTA can run with a strict resource budget to ensure that DTA has minimal impact on customer workloads.

[0031] DTA can affect customer workloads in at least two ways. The resources consumed by DTA on the server through optimizer calls, creation of sampling statistics, etc. may affect customer workloads. For example, DTA uses the database's resource governance mechanism to limit the CPU, memory, and I / O consumed by DTA calls. Customer workloads may also be affected by lock and latch contention caused by the creation and discarding of hypothetical indexes and sampling statistics. Due to the first-in-first-out nature of the database lock scheduler, this lock contention, especially for modifying metadata, can cause a significant impact on user workloads. In various examples, low-priority lock support that allows requests for locks with lower priorities is used, and lock requests are not blocked due to user workloads. In one example, DTA is also modified to reduce the number of sampling statistics created by DTA without significantly affecting the quality of recommendations. To further reduce the resource footprint, the control plane can call DTA on demand only when the analysis database is needed.

[0032] As described above, DTA uses workload inputs that are used to tune the database. In one example, past execution statistics and query text captured by the query store are used to build the workload. For example, at the start of a DTA session, execution statistics for the past N hours are used to identify the K most expensive query statements (or templates) in terms of duration or resources (e.g., CPU time). Since such an analysis can be resource intensive for many queries of gigabytes of data accumulated in the query store, N and K are set based on the amount of resources available to the database.

[0033] Identifying database statements to tune is just the beginning. In some examples, DTA uses complete query statements in the workload to estimate the cost of different hypothetical index configurations. Although the query store captures query text, the query text may not be a complete statement. For example, the statement in the query store may lack variables, or only have fragments of complex conditional statements, etc. DTA may not be able to estimate the cost of such a statement. Another challenge comes from statements that cannot be optimized individually or where the "what-if" API is not supported. For example, in a batch of statements, one statement may store the results of a query into a temporary table, and then another statement may reference the temporary table. Such a batch may only be optimized during execution. These restrictions limit the set of statements that DTA can successfully tune, often significantly affecting DTA's workload coverage.

[0034] In various examples, some enhancements are made to overcome these limitations. First, database statements are augmented from other sources. For example, if the statement is part of a stored procedure or function whose definition is available in the system metadata, the statement is obtained from the metadata. Second, for incomplete T-SQL batches, the database server's query plan cache is used to obtain the complete batch definition. In addition, some statements are rewritten. For example, BULK INSERT statements used by bulk loading tools or APIs may not be optimized. However, these statements can be rewritten into equivalent INSERT statements that can be optimized, allowing DTA to calculate costs for index maintenance overhead due to these operations. In addition, since the above statement types are optimized by the database engine during execution, if these statements can benefit from indexes, the missing index feature may generate candidates. When missing index candidates are generated, DTA's search can be enhanced with these missing index candidates and the optimizer's cost estimate. Once DTA completes the analysis of the database, a detailed report is generated that specifies which statements DTA analyzed and which indexes in the recommendation will affect which statement. The report can be used to disclose the recommendation details to the user. Additionally, the report can be used to compute workload coverage, which provides an approximate measure of the effectiveness of the DTA recommendations.

[0035] A DTA tuning session for a database may run from several minutes to several hours, depending on the complexity of the workload, architecture, and available resources. Many types of failures may occur during a DTA session, whether on the database server, physical server, or within DTA. For CSV, there may be thousands of DTA sessions for the database at a given moment. In order to tolerate failures and manage the state of DTA sessions at scale, microservices can be used in the control plane dedicated to DTA session management. In addition, the DTA session state may be incremented along with the state of the database. The microservice can identify when a DTA session on a given database is called, track the progress of the DTA session, and ensure that the session reaches a terminal state of successful completion or an error that triggers cleanup and optional retry. The cleanup phase properly cleans up temporary objects (e.g., hypothetical indexes and statistics) created by DTA during the calibration and other calibration session-specific states such as temporary files.

[0036] The two consultants discussed above generate recommendations to create indexes. The recommendation provided to the customer comes from one of these consultants. Several factors determine which consultant's recommendation is presented, including the service tier (or SLO) of the database, the workload coverage of the two consultants, the activity level and resource consumption, etc. For example, the recommendation from the consultant with the greatest resource consumption coverage may be exposed. In another example, the recommendations from both consultants are combined. The combination of recommendations can be based on the index that has the greatest estimated impact on the workload.

[0037] As workloads, schemas, and data distribution evolve and new indexes are created, the benefits of existing indexes may decrease. It may be useful to identify and potentially drop low-impact indexes to reduce their maintenance overhead and storage space. In addition, a database may have multiple duplicate indexes, i.e., indexes with the same key columns (including the same order), which are also potential candidates to be dropped. However, dropping indexes poses several practical challenges. First, users often have indexes for occasional but important queries, such as those reported on a certain cadence, such as daily or weekly. Since the workload is automatically identified, such occasional events may not be part of the workload and therefore ignored in the analysis when determining the impact of the index. Dropping such indexes may cause a significant slowdown of these occasional queries, which is also difficult to detect in validation due to its infrequent nature. Second, when a user manually tunes a query or forces an execution plan, the query may hint at an index to be used. Dropping such a hinted index will prevent the query from executing, potentially breaking the application and causing serious outages. Third, even if duplicate indexes are detected, determining which index to drop can be a challenge. In many cases, retaining any one of them is acceptable, while in others a specific one (or more) is preferred.

[0038] In one example, a conservative approach is used to identify indexes to be dropped with minimal risk of regression. Other sources of information from the database server can be used to identify low-impact indexes, rather than being driven purely by workload. For example, execution statistics over a significantly longer time period (typically 60 days or longer) can be used. In some examples, the goal of dropping indexes is to reduce maintenance overhead, with reducing storage being another goal. Statistics from the database server, such as how often an index is accessed by queries, the number of database modifications, etc., are used to identify indexes that are not beneficial to queries but have significant maintenance overhead. Query hints and forced plans can be used to identify indexes to avoid dropping. Schema and database metadata can be analyzed to identify indexes that enforce specified constraints so that the index is not dropped.

[0039] In some examples, the recommendations can be applied based on end-user approval or automatically. In other examples, the recommendations are first tested before being implemented on a live database. When the user decides to apply the recommendation or automatic implementation is enabled, the control plane can coordinate the index implementation (creation or discard) and subsequent verification to ensure that no regression exists. Depending on the size of the index, creation can be a resource-intensive operation that scans the data (I / O intensive), sorts the data (CPU and memory intensive), and then creates the index (log intensive). By managing resources and scheduling most operations during periods of low activity on the database, the impact of creating the index can be reduced. In some examples, to further minimize the impact of concurrent workloads, only online operations are used, i.e., operations that can be completed with minimal or no blocking. Since this create operation may be long-running, in some examples, the microservices in the control plane track the state machine of the index implementation.

[0040] The goal of validation is to detect that creating or dropping indexes does not cause query regressions. If a regression is detected, any dropped indexes can be recreated and created indexes can be dropped. In various examples, the query store is used to analyze execution statistics before and after index changes are implemented. One major challenge encountered in validation is the inherent noise in execution statistics due to concurrent query execution in an uncontrolled production setting.

[0041] To overcome this challenge, logical execution metrics, such as CPU time consumed or logical bytes read can be analyzed. These metrics represent plan quality and have smaller variance than physical metrics such as query duration or physical I / O. If logical metrics improve due to an index, physical metrics typically improve. In some examples, only queries that have been executed before and after the index change and that caused a plan change due to the index change are analyzed. That is, if an index is created, the new plan after creation should reference the index, and if the index is discarded, the old plan before discarding should reference the index. In addition, for each query plan, the query store may track the number of executions, the mean, and the standard deviation of each metric. Assuming that the measurement variance follows a normal distribution, the above statistics and the Welch t-test can be used to determine the statistical significance of the change in the metric (improvement or regression), comparing the state after the index change to the state before the change.

[0042] If a significant regression is detected, the system can automatically revert the change, i.e., drop the index if it was created, or recreate it if it was dropped. The recovery trigger can be set to a conservative setting, where a significant regression of any statement that consumes a significant score of database resources may trigger a recovery. In the absence of explicit application knowledge or user input, this approach attempts to minimize disruption, but may also reduce the overall improvement of other statements that may benefit from the index, which will now be restored because the index caused a statement to regress. An alternative setting measures the overall improvement of all statements affected by the index, and only reverts if there is a regression at an aggregate level. The approach may significantly regress one or more statements if the improvement to other statements offsets the regression.

[0043] In some examples, database optimization changes can be tested before being implemented on live data. At 340, a clone database can be created from the database used to generate the data optimization operation. In some examples, the experiment may be similar to A / B testing used in random experiments, but applied to the context of a database.

[0044] Databases can exhibit tremendous diversity in terms of schema, queries, data size, and data distribution. Therefore, to experiment with multiple index recommenders and measure the quality in terms of the recommender's execution cost, the same set of databases can be used to generate recommendations, implement them, and compare the execution costs before and after implementation. Performing this experiment on the primary database replica that serves application traffic is risky and unacceptable. Even using secondary replicas is not feasible because some database engines require the replicas to be physically identical.

[0045] In some examples, a clone database is used as a B instance of a database. The B instance is a clone of the database that may not be visible to external clients and that starts from a snapshot of the database. The B instance may be located on a different physical server within the compliance boundary of the database engine, have an independent set of resources and different security credentials, and may also use different database server binaries.

[0046] At 350, the optimized recommendations are performed on the clone databases. In some examples, each recommender has its own B instance. In these examples, the optimized recommendations of one recommender are performed on its corresponding clone database. This allows the recommendations from different recommenders to be compared with each other.

[0047] At 360, the clone database receives database operations from the original database. For example, the clone database may receive a branch of the table data stream (TDS) traffic from the master copy (referred to as the A instance in this context), which is replayed on the B instance. At 370, database operations are performed on the database and the clone database. The B instance can independently execute the TDS stream, allowing reorganization operations, etc. The failure of the B instance does not affect the ability of the A instance to proceed normally. Therefore, the B instance is a best-effort clone and is potentially different from the A instance.

[0048] Creating a B instance is one small step in the experiment. Another step is to identify suitable candidate databases for the experiment, generate recommendations, implement them, collect execution statistics, generate reports comparing the status with and without the recommendations, and perform the custom steps required for the specific experiment. In one example, the databases with the most recommendations or the greatest potential for improvement are selected as candidate databases. In one example, the top 3%, 5%, 10%, etc., can be selected as candidate databases for testing. To scale these experimental steps to hundreds or thousands of databases in different geographic regions, Figure 2 The framework in can be used. Experiment control 210 ensures that the workflow steps of the experiment are executed.

[0049] The performance of the clone database may be compared to the performance of the real-time database. At 380, the performance of the clone database is verified as an improvement compared to the performance of the real-time database. As described above, the performance may be based on a specific statement or an aggregate statement. In some examples, once the performance improvement is verified, the database recommendation can be implemented on the real-time database. If an improvement is not found, the database recommendation can be ignored. In some examples, a particular index may be identified as regressing the performance of one or more queries. When this occurs, the command to create the index may be removed from the recommendation. The modified recommendation can then be executed so that the index for the regressed query is not created.

[0050] In some cases, customers may want more control over how and when index recommendations are implemented, such as implementing recommendations as quickly as possible, only during periods of low activity, on a pre-specified schedule, or only after successful completion of an experiment. Customers may also want to control how resources are shared between index creation and concurrent transactions. In some examples, indexes are implemented that benefit multiple databases of a customer.

[0051] Figure 4It is an example computing device that can be used in conjunction with the technology described herein. In an alternative embodiment, computing device 400 can be operated as a stand-alone device or can be connected (for example, networked) to other computing devices. In a networked deployment, computing device 400 can operate with the capabilities of a server communication device, a client communication device, or both in a server-client network environment. In one example, computing device 400 can be a peer-to-peer computing device in a peer-to-peer (P2P) (or other distributed) network environment. Computing device 400 can be a personal computer (PC), a tablet PC, a set-top box (STB), a personal digital assistant (PDA), a mobile phone, a smart phone, a network device, a network router, a switch or a bridge, or any computing device capable of executing instructions (sequentially or otherwise), which specify the actions to be taken by the computing device. In addition, although only a single computing device is shown, the term "computing device" should also be considered to include any set of computing devices that individually or jointly execute a set (or multiple sets) of instructions to execute any one or more instructions of the method discussed herein, such as cloud computing, software as a service (SaaS), and other computer cluster configurations. The computing device may implement an OCR system, an aligner, a tokenizer, a clusterer, a table extractor, and a table combiner, and perform Figure 3 method.

[0052] The computing device 400 may include a hardware processor 402 (e.g., a central processing unit (CPU), a graphics processing unit (GPU), a hardware processor core, or any combination thereof), a main memory 404, and a static memory 406, some or all of which may communicate with each other via a link (e.g., a bus) 408. The computing device 400 may also include a display unit 410, an input device 412 (e.g., a keyboard), and a user interface (UI) navigation device 414 (e.g., a mouse). In an example, the display unit 410, the input device 412, and the UI navigation device 414 may be a touch screen display. In an example, the input device 412 may include a touch screen, a microphone, a camera (e.g., a panoramic or high-resolution camera), a physical keyboard, a trackball, or other input device.

[0053] The computing device 400 may additionally include a storage device (e.g., a drive unit) 416, a signal generating device 418 (e.g., a speaker, a projection device, or any other type of information output device), a network interface device 420, and one or more sensors, such as a global positioning system (GPS) sensor, a compass, an accelerometer, a motion detector, or other sensors. The computing device 400 may include an input / output controller, such as a serial (e.g., a universal serial bus (USB), parallel or other wired or wireless (e.g., infrared (IR), near field communication (NFC), etc.)) to communicate or control the connection of one or more peripheral devices (e.g., a printer, a card reader, etc.) via one or more input / output ports.

[0054] The storage device 416 may include a computer-readable (or machine-readable) storage medium 422 on which is stored one or more sets of data structures or instructions 424 (e.g., software) that embody or utilize any one or more of the techniques or functionality described herein. In one example, at least a portion of the software may include an operating system and / or one or more applications (or apps) that implement one or more of the functionality described herein. The instructions 424 may also reside completely or at least partially within the main memory 404, within the static memory 406, and / or within the hardware processor 402 during execution by the computing device 400. In an example, one or any combination of the hardware processor 402, the main memory 404, the static memory 406, or the storage device 416 may constitute a computing device (or machine) readable medium.

[0055] Although computer-readable storage medium 422 is illustrated as a single medium, “computer-readable storage medium” or “machine-readable storage medium” may include a single medium or multiple media (e.g., a centralized or distributed database, and / or associated caches and servers) configured to store one or more instructions 424.

[0056] In one example, a computer-readable storage medium or machine-readable storage medium may include a computer-readable storage medium capable of storing, encoding, or carrying instructions executed by a computing device 400 and causing the computing device 400 to perform any one or more of the techniques of the present disclosure, or capable of storing, encoding, or carrying data structures used by or associated with such instructions. Non-limiting computer-readable storage medium examples may include solid-state memory and optical and magnetic media. Specific examples of computer-readable storage media may include: non-volatile memory, such as semiconductor memory devices (e.g., electrically programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM)) and flash memory devices; disks, such as built-in hard disks and removable disks; magneto-optical disks; random access memory (RAM); and optical media disks. Computer-readable storage media are non-transitory because the storage media do not contain transient propagating signals.

[0057] The instructions 424 may also be transmitted or received using a transmission medium via the network interface device 420 over a communication network 426 using any of a variety of transmission protocols (e.g., frame relay, Internet Protocol (IP), transmission control protocol (TCP), user datagram protocol (UDP), hypertext transfer protocol (HTTP), etc.). Example communication networks may include a local area network (LAN), a wide area network (WAN), a packet data network (e.g., the Internet), a mobile telephone network (e.g., a cellular network), a plain old telephone (POTS) network, and a wireless data network (e.g., a wireless network known as a wireless network). The Institute of Electrical and Electronics Engineers (IEEE) 802.3 series of standards, known as IEEE 802.16 family of standards), IEEE 802.15.4 family of standards, Long Term Evolution (LTE) family of standards, Universal Mobile Telecommunications System (UMTS) family of standards, point-to-point (P2P) networks, etc. The network interface device 420 may use a transmission protocol to transmit data using transient propagation signals.

[0058] In one example, the network interface device 420 may include one or more physical jacks (e.g., Ethernet, coaxial or telephone jacks) or one or more antennas to connect to the communication network 426. In one example, the network interface device 420 may include one or more wireless modems, such as a Bluetooth modem, a Wi-Fi modem, or one or more modems or transceivers operating under any communication standard mentioned herein. In an example, the network interface device 420 may include multiple antennas to use at least one of single input multiple output (SIMO), multiple input multiple output (MIMO) or multiple input single output (MISO) technology for wireless communication. In some examples, the network interface device 420 may use multi-user MIMO technology for wireless communication. In an example, the transmission medium may include any intangible medium capable of storing, encoding or carrying instructions executed by the computing device 400, and includes digital or analog communication signals or similar communication media to facilitate the communication of such software.

[0059] Any computer executable instructions for implementing the disclosed techniques and any data created and used during the implementation of the disclosed embodiments may be stored on one or more computer readable storage media. The computer executable instructions may be, for example, a dedicated software application or part of a software application accessed or downloaded through a web browser or other software application (such as a remote computing application). For example, such software may be executed on a single local computer (e.g., any suitable commercially available computer) or in a network environment (e.g., via the Internet, a wide area network, a local area network, a client-server network (such as a cloud computing network) or other such network) using one or more network computers.

[0060] Example

[0061] Example 1 is a method for reconfiguring a database, the method comprising: selecting a workload including multiple previously executed database operations from previously executed database operations on the database; determining the total resource consumption of the previously executed database operations; determining the total resource consumption of the workload; verifying that the total resource consumption of the workload is greater than a predetermined threshold of the total resource consumption of the previously executed database operations; using the workload to determine an optimization operation for the database; creating a clone database of the database; performing the optimization operation on the clone database; receiving a database operation for the database; performing the database operation on the database and the clone database; and verifying that the performance of the clone database is improved compared to the performance of the database based on the execution of the database operation on the database and the clone database.

[0062] In Example 2, the subject matter of Example 1 includes performing an optimization operation on the database based on verifying the performance of the cloned database.

[0063] In Example 3, the subject matter according to Examples 1-2 includes determining that performance of the clone database is not improved for at least one of the optimization operations; removing at least one of the optimization operations from the optimization operations; and resuming at least one of the optimization operations on the clone database.

[0064] In Example 4, the subject matter of Examples 1-3 includes, wherein the resource consumption includes central processing unit time.

[0065] In Example 5, the subject matter according to Example 4 includes that the predetermined threshold is 80%.

[0066] In Example 6, the subject matter according to Examples 1-5 includes, wherein the optimization operation includes creating an index.

[0067] In Example 7, the subject matter according to Examples 1-6 includes rewriting a previously executed database optimization operation among the previously executed database operations, wherein the workload includes the rewritten database operation.

[0068] In Example 8, the subject matter according to Example 7 includes, wherein rewriting one of the previously executed database operations includes rewriting a bulk insert operation as an insert operation.

[0069] In Example 9, the subject matter according to Examples 1-8 includes modifying one of the previously executed database operations, wherein the workload includes the modified database operation.

[0070] In Example 10, the subject matter according to Example 9 includes, wherein modifying one of the previously executed database operations includes: retrieving metadata of a stored procedure, wherein one of the previously executed database operations uses the stored procedure; and replacing the stored procedure used by one of the previously executed database operations with the metadata.

[0071] Example 11 is a system for reconfiguring a database, the system comprising: an electronic processor configured to: select a workload including multiple previously executed database operations from previously executed database operations on the database; determine the total resource consumption of the previously executed database operations; determine the total resource consumption of the workload; verify that the total resource consumption of the workload is greater than a predetermined threshold of the total resource consumption of the previously executed database operations; use the workload to determine an optimization operation for the database; create a clone database of the database; perform the optimization operation on the clone database; receive a database operation for the database; perform the database operation on the database and the clone database; and based on the execution of the database operation on the database and the clone database, verify that the performance of the clone database is improved compared to the performance of the database.

[0072] In Example 12, the subject matter of Example 11 includes, wherein the electronic processor is further configured to: perform an optimization operation on the database based on verifying the performance of the clone database.

[0073] In Example 13, the subject matter according to Examples 11-12 includes, wherein the electronic processor is further configured to: determine that the performance of the clone database is not improved for at least one of the optimization operations; remove at least one of the optimization operations from the optimization operations; and resume at least one of the optimization operations on the clone database.

[0074] In Example 14, the subject matter of Examples 11-13 includes, wherein the electronic processor is further configured: wherein the resource consumption includes central processing unit time.

[0075] In Example 15, the subject matter according to Example 14 includes that the predetermined threshold is 80%.

[0076] In Example 16, the subject matter according to Examples 11-15 includes, wherein the optimization operation includes creating an index.

[0077] In Example 17, the subject matter of Examples 11-16 includes, wherein the electronic processor is further configured to: rewrite one of the previously executed database operations, wherein the workload includes the rewritten database operation.

[0078] Example 18 is a non-transitory computer-readable storage medium storing computer-executable instructions for database reconfiguration, the stored instructions including: instructions for selecting a workload including multiple previously executed database operations from previously executed database operations on a database; instructions for determining the total resource consumption of the previously executed database operations; instructions for determining the total resource consumption of the workload; instructions for verifying that the total resource consumption of the workload is greater than a predetermined threshold of the total resource consumption of the previously executed database operations; instructions for using the workload to determine optimized operations for the database; instructions for creating a clone database of the database; instructions for performing optimized operations on the clone database; instructions for receiving database operations for the database; instructions for performing database operations on the database and the clone database; and instructions for verifying that performance of the clone database is improved compared to performance of the database based on execution of the database operations on the database and the clone database.

[0079] In Example 19, the subject matter according to Example 18 includes, wherein the instructions further include instructions for performing an optimization operation on the database based on verifying the performance of the clone database.

[0080] In Example 20, the subject matter according to Examples 18-19 includes, wherein the instructions further include: instructions for determining that the performance of the clone database is not improved for at least one of the optimization operations; instructions for removing at least one of the optimization operations from the optimization operations; and instructions for resuming at least one of the optimization operations on the clone database.

[0081] In Example 21, the subject matter according to Examples 1-20 includes, wherein the optimization operation includes dropping the index.

[0082] Example 22 is at least one machine-readable medium comprising instructions that, when executed by a processing circuit, cause the processing circuit to perform operations to implement any of Examples 1-21.

[0083] Example 23 is an apparatus comprising components for implementing any of Examples 1-21.

[0084] Example 24 is a system implementing any of Examples 1-21.

[0085] Example 25 is a method of implementing any of Examples 1-21.

[0086] The above description is intended to be illustrative and not restrictive. For example, the above examples (or one or more aspects thereof) may be used in combination with other examples. Other embodiments may be used, such as those of ordinary skill in the art after reading the above description. In addition, the appended claims are hereby incorporated into the detailed description, and the claims themselves exist as separate embodiments. The scope of the embodiments disclosed herein will be determined with reference to the appended claims and the full scope of equivalents given by these claims.

Claims

1. A computer-implemented method for calibrating a database, the method comprising: Selecting, from database operations previously executed on the database, a workload including a plurality of the previously executed database operations; determining a total computing resource consumption of the previously executed database operations; determining a total computing resource consumption of the workload; verifying that the total computing resource consumption of the workload is greater than a predetermined threshold of the total computing resource consumption of the previously executed database operations; determining an optimized operation for the database using the workload; Creating a clone database of the database; performing the optimization operation on the clone database to adjust the clone database; receiving a database operation for the database; performing the database operation on the database and the adjusted clone database; determining computing resource consumption of performing the database operation on the database and the tuned clone database; as well as Based on the determined computing resources consumed by execution of the database operations on the database and the tuned clone database, verifying that performance of the tuned clone database is improved compared to performance of the database.

2. The method according to claim 1, further comprising: The optimization operation is performed on the database based on verifying the performance of the tuned clone database.

3. The method according to claim 1, further comprising: determining that performance of the tuned clone database is not improved for at least one of the optimization operations; removing the at least one optimization operation from the optimization operations; as well as The at least one of the optimization operations on the tuned clone database is resumed. The method of claim 1 , wherein the resource consumption is expressed as central processing unit time. The method according to claim 1 , wherein the optimization operation comprises creating an index.

6. The method according to claim 1, further comprising: A previously executed database operation of the previously executed database operations is rewritten, wherein the workload includes the rewritten database operation.

7. The method according to claim 1, further comprising: A previously executed database operation of the previously executed database operations is modified, wherein the workload includes the modified database operation.

8. The method of claim 7, wherein modifying one of the previously executed database operations comprises: retrieving metadata for a stored procedure, wherein the one of the previously executed database operations used the stored procedure; as well as The stored procedure used in the one of the previously executed database operations is replaced with the metadata.

9. The method of claim 1 , wherein using the workload to determine an optimized operation for the database comprises: The workload is executed using a lower priority lock than the priority lock used with the concurrent user workload.

10. The method of claim 1, wherein using the workload to determine an optimized operation for the database comprises: determining a first set of optimization operations using a first recommender; determining a second set of optimization operations using a second recommender; The first set of optimization operations or the second set of optimization operations is selected based on user preference.

11. A system for calibrating a database, the system comprising: An electronic processor configured to: Selecting, from database operations previously executed on the database, a workload including a plurality of the previously executed database operations; determining a total computing resource consumption of the previously executed database operations; determining a total computing resource consumption of the workload; verifying that the total computing resource consumption of the workload is greater than a predetermined threshold of the total computing resource consumption of the previously executed database operations; determining an optimized operation for the database using the workload; Creating a clone database of the database; performing the optimization operation on the clone database to adjust the clone database; receiving a database operation for the database; performing the database operation on the database and the adjusted clone database; determining computing resource consumption of performing the database operation on the database and the tuned clone database; as well as Based on the determined computing resources consumed by execution of the database operations on the database and the tuned clone database, verifying that performance of the clone database is improved compared to performance of the database.

12. The system of claim 11, wherein the electronic processor is further configured to perform the optimization operation on the database based on verifying the performance of the tuned clone database.

13. The system of claim 11, wherein the electronic processor is further configured to: determining that performance of the tuned clone database is not improved for at least one of the optimization operations; removing the at least one optimization operation from the optimization operations; and The at least one of the optimization operations on the tuned clone database is resumed.

14. The system of claim 11, wherein the resource consumption is expressed as central processing unit time.

15. The system of claim 14, wherein the predetermined threshold is 80%.

16. The system of claim 11, wherein the optimization operation comprises creating an index.

17. The system of claim 11, wherein the electronic processor is further configured to rewrite one of the previously executed database operations, wherein the workload includes the rewritten database operation.

18. A non-transitory computer-readable storage medium storing computer-executable instructions for calibrating a database, the stored instructions comprising: instructions for selecting, from database operations previously executed on the database, a workload comprising a plurality of the previously executed database operations; Instructions for determining total computing resource consumption of said previously executed database operations; instructions for determining total computing resource consumption of the workload; instructions for verifying that the total computing resource consumption of the workload is greater than a predetermined threshold of the total computing resource consumption of the previously executed database operations; determining instructions for optimized operation of the database using the workload; Instructions for creating a clone database of the database; executing the optimization operation on the clone database to adjust instructions of the clone database; receiving an instruction for a database operation on the database; Instructions for executing the database operation on the database and the adjusted clone database; Instructions for determining computing resource consumption of performing the database operation on the database and the tuned clone database; as well as Instructions for verifying that performance of the clone database is improved compared to performance of the database based on the determined computing resources consumed by execution of the database operations on the database and the tuned clone database.

19. The non-transitory computer-readable storage medium of claim 18, wherein the instructions further comprise: Based on verifying the performance of the tuned clone database, instructions for performing the optimization operation on the database are executed.

20. The non-transitory computer-readable storage medium of claim 18, wherein the instructions further comprise: Instructions for determining that performance of the clone database tuned is not improved for at least one of the optimization operations; removing instructions of the at least one optimization operation among the optimization operations from the optimization operations; as well as Instructions of the at least one of the optimization operations on the tuned clone database are restored.