Learning-based workload resource optimization for database management systems
The self-learning DBMS uses machine learning to predict resource requirements by clustering query vectors into templates, addressing the limitations of current DBMS systems in workload resource estimation and enhancing adaptability.
Patent Information
- Application Number
- JP2023521553
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2020-10-15
- Filing Date
- 2021-09-24
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2041-09-24
AI Technical Summary
Current database management systems (DBMS) struggle to accurately predict resource requirements for workloads due to relying on generalized heuristics that consider only low-level query features, failing to account for nuanced factors in concurrent processing and requiring ongoing manual maintenance.
A self-learning DBMS with a cognitive model that uses machine learning to analyze high-level features of workloads, predicting resource requirements through a top-down approach by clustering query vectors into templates and associating them with resource histograms, allowing for more accurate and adaptive resource estimation.
The system provides more accurate resource predictions for entire workloads, reducing the need for manual maintenance and improving flexibility in handling changes to the DBMS environment.
Smart Images

Figure 0007744722000001 
Figure 0007744722000002 
Figure 0007744722000003
Abstract
Description
[Technical Field]
[0001] The present invention relates generally to database-management systems (DBMS), and more particularly to predicting or estimating resource requirements resulting from the execution of database queries. [Background technology]
[0002] The current workload of a DBMS is the set of data access requests (e.g., Structured Query Language (SQL) queries) that attempt to analyze or modify the contents of the database that the DBMS is currently processing. DBMS workloads can require very different amounts and types of resources. Each workload requires a particular combination and amount of computer memory, CPU cycles, I / O bandwidth, secondary storage, and other resources.
[0003] A DBMS operates more efficiently if it can accurately predict the type and amount of resources required to process each workload statement. Because workload queries or other types of data access requests do not explicitly specify the resources they will consume, known DBMSs can, at best, only infer resource requirements by applying generalized static heuristics to each query.
[0004] Such rules generally consider only the express language of each query statement, leading the DBMS to extract low-level features from each workload statement and apply a specific resource estimation model to each analyzed feature. For example, a rule might be tailored to predict the resources required to process SQL GROUP BY predicates. Upon receiving a query containing a GROUP BY predicate, the DBMS analyzes the query to identify dozens of database operations required to process the query's GROUP BY function. The DBMS then applies a separate estimation model to analyze each combination of extracted low-level feature and resource type and estimates the resource requirements incurred by processing that feature. The DBMS then predicts the total demand of the GROUP BY predicate by aggregating the resource consumption estimates for each low-level feature. This process is repeated for each resource-intensive operation or predicate in the query to estimate the resource requirements for the entire query. Summary of the Invention
[0005] Embodiments of the present invention include systems, methods, and computer program products for a self-learning database management system (DBMS), including an expert workload manager component and a training subsystem that uses machine learning techniques to train cognitive models that estimate resource requirements across batches of queries or other types of data access requests. In a first class of "training mode" embodiments, a training subsystem of a DBMS submits training data to a workload management model that identifies the amount and type of resources previously used by the DBMS in processing previous data access requests. The system identifies various high-level features of each request, such as tokens parsed from the request text and metrics and compile-time operations referenced by execution plans generated by the DBMS's query optimization component. The system packages the high-level features of each request as a query vector, and the vectors are clustered into mutually exclusive subsets (or "templates") of similar vectors. The subsystem organizes the data access requests into batched workloads, each of which is associated with a histogram representing the distribution of templates associated with the batch of data access requests that make up the workload. Because the training data identifies the amount and type of resources incurred by previous executions of each request, in some embodiments, the histogram is also associated with a set of resource requirements that specify the amount and type of resources needed to process the histogram's corresponding workload.
[0006] In other embodiments, each workload is associated with multiple histograms, and in such embodiments, the set of resource requirements associated with each histogram specifies the amount of only one of the types of resources needed to process the histogram's corresponding workload.
[0007] In either case, this knowledge is formatted into a machine learning corpus (such as a triple-store data structure that represents the concepts, rules, and dependencies that make up the artificial intelligence's "knowledge" as a set of 3-tuple vectors) and used to train the model. In production, if a fully trained model receives a histogram representing the distribution of templates associated with all requests in a production workload, it will be able to predict the total cost of running the entire production workload depending solely on the received histogram.
[0008] In a second class of “production mode” embodiments, the production DBMS applies the knowledge derived by the training mode embodiments, along with the learned model, to estimate the resources required to execute a batch of received data access requests. The DBMS associates each received request with a query vector that is assigned to one of the previously generated templates, in a manner similar to that performed during training mode. The DBMS builds a set of increasingly resource-intensive candidate workloads by adding each received request to the trained model. As in the training phase, each candidate workload is associated with a histogram that identifies the template distribution among the statements that make up the workload. As each new candidate workload is generated, the DBMS sends the workload's corresponding one or more histograms to the trained model. In response, the model predicts the workload's resource requirements based on previous training. This process continues until the candidate workload's requirements are too large to be met with currently available resources. The next largest workload is then deemed the largest workload that can be executed with the available resources, and that workload is forwarded to the DBMS's query execution engine for further processing.
[0009] According to one aspect of the present invention, there is provided a training subsystem for a database management system (DBMS) that includes a processor, a memory coupled to the processor, and a computer-readable hardware storage device coupled to the processor.The storage device includes program code configured to be executed by the processor via the memory to implement a method for self-learning binned resource optimization for database management systems, the method including: the training subsystem receiving training data including a set of training statements, each of which requests access to a database managed by the DBMS, and a record of the type and amount of resources required by the DBMS to execute each statement in the set of training statements; the subsystem generating a set of query vectors, each of which identifies high-level features of a corresponding statement in the training statements; the subsystem assigning the set of query vectors to a set of templates, each vector in the set of query vectors being assigned to one template in the set of templates, each template in the set of templates being populated with query vectors that have a mathematical similarity to one another that exceeds a threshold similarity; and the subsystem generating the training data including a set of training statements, each of which requests access to a database managed by the DBMS, and a record of the type and amount of resources required by the DBMS to execute each statement in the set of training statements. and dividing a set of statements into a set of training workloads, each workload of the training workloads associated with a corresponding histogram, each bin of each corresponding histogram uniquely corresponding to one template of the set of templates, and each bin of a first corresponding histogram identifying a number of statements in the corresponding workload of the first corresponding histogram that are associated with each template of the set of templates; the subsystem associating each corresponding histogram with a set of resources previously consumed by execution of each training statement of the training workload corresponding to the histogram; the subsystem adding knowledge inferred from the training data to a training corpus usable for training a machine learning model; and the subsystem training a cognitive model of a workload management component of the DBMS to predict resource requirements of batched data access requests, the training including submitting the training corpus to the cognitive model.
[0010] According to another aspect, the present invention provides a method for self-learning binned resource optimization for a database management system, the method comprising: a training subsystem of a database management system (DBMS) receiving training data including a set of training statements each requesting access to a database managed by the DBMS and a record of the type and amount of resources required by the DBMS to execute each statement in the set of training statements; the subsystem generating a set of query vectors each identifying high-level features of a corresponding statement in the training statements; the subsystem assigning the set of query vectors to a set of templates, each vector in the set of query vectors being assigned to one template in the set of templates, each template in the set of templates being populated with query vectors that have a mathematical similarity to each other that exceeds a threshold similarity; and the subsystem dividing the set of training statements into a set of training workloads, the training workloads being populated with query vectors that have a mathematical similarity to each other that exceeds a threshold similarity. each workload of a load is associated with a corresponding histogram, each bin of each corresponding histogram uniquely corresponding to one template of the set of templates, and each bin of a first corresponding histogram identifies a number of statements in the corresponding workload of the first corresponding histogram that are associated with each template of the set of templates; the subsystem associates each corresponding histogram with a set of resources previously consumed by execution of each training statement of the training workload corresponding to the histogram; the subsystem adds knowledge inferred from the training data to a training corpus that can be used to train a machine learning model; and the subsystem trains a cognitive model of a workload management component of the DBMS to predict resource requirements of batched data access requests, the training including submitting the training corpus to the cognitive model.
[0011] According to another aspect of the present invention, there is provided a computer program product for self-learning binned resource optimization for a database management system (DBMS), the computer program product including a computer-readable storage medium embodied with program instructions executable by a processor to cause the processor to perform a method for self-learning binned resource optimization for a database management system, the method comprising: a training subsystem of a database management system (DBMS) receiving training data including a set of training statements each requesting access to a database managed by the DBMS and a record of the type and amount of resources required by the DBMS to execute each statement in the set of training statements; the subsystem generating a set of query vectors each identifying high-level features of a corresponding statement in the training statements; and the subsystem assigning the set of query vectors to a set of templates, wherein each vector in the set of query vectors is assigned to one template in the set of templates. wherein each template in the set of templates is populated with a query vector that has a mathematical similarity to each other that exceeds a threshold similarity; the subsystem divides the set of training statements into a set of training workloads, each workload in the training workloads being associated with a corresponding histogram, each bin of each corresponding histogram uniquely corresponding to one template in the set of templates, and each bin of a first corresponding histogram identifying a number of statements in the corresponding workload of the first corresponding histogram that are associated with each template in the set of templates; the subsystem associates each corresponding histogram with a set of resources previously consumed by execution of each training statement in the histogram's corresponding training workload; the subsystem adds knowledge inferred from the training data to a training corpus that can be used to train a machine learning model; andtraining a cognitive model of a workload management component of the DBMS to predict resource requirements of batched data access requests, the training including submitting the training corpus to the cognitive model;
[0012] According to another aspect of the present invention, there is provided a database management system (DBMS) including a processor, a memory coupled to the processor, and a computer-readable hardware storage device coupled to the processor, the storage device including program code configured to be executed by the processor via the memory to implement a method for self-learning binned resource optimization for a database management system, the method including: receiving, by the DBMS, a set of production statements each requesting access to a database managed by the DBMS and a cognitive model trained to predict resource requirements for batched data access requests; generating, by the DBMS, a set of query vectors, each vector in the set of query vectors identifying a high-level feature of a corresponding statement in the set of production statements, and each element of a particular vector in the set of query vectors identifying a distinct high-level feature of a corresponding statement in the set of production statements; and converting each vector in the set of query vectors into a query vector of the cognitive model. the DBMS iteratively generates a final production workload, wherein in each iteration, the DBMS adds a next statement selected from the set of production statements to the candidate production workload, the next statement not having been previously added to the candidate production workload; the DBMS attempts to associate the candidate production workload with a candidate histogram, wherein each bin of the candidate histogram identifies the total number of statements in the candidate production workload that are associated with a template from the set of model templates that is uniquely assigned to that bin; and if the DBMS is able to associate the candidate production workload with the candidate histogram, the DBMS executes the candidate production workload by:predicting, in response to training of the cognitive model, that executing a workload characterized by a corresponding histogram will require the same amount and type of resources as the cognitive model identified in response to its training; if the DBMS determines that executing the candidate production workload will require more resources than are currently available, the DBMS removing the most recently added statement from the candidate production workload and considering the resulting workload as the final production workload; if the DBMS determines that executing the candidate production workload will not require more resources than are currently available, the DBMS continuing with a next iteration to generate a final production workload; and the DBMS transferring the final production workload to a query execution engine of the DBMS for execution by the DBMS.
[0013] According to another aspect of the present invention, there is provided a method comprising: a production database management (DBMS) system receiving a set of production statements each requesting access to a database managed by the DBMS and a cognitive model trained to predict resource requirements for batched data access requests; the DBMS generating a set of query vectors, each vector in the set of query vectors identifying a high-level feature of a corresponding statement in the set of production statements and each element of a particular vector in the set of query vectors identifying a distinct high-level feature of a corresponding statement in the set of production statements; the DBMS assigning each vector in the set of query vectors to a corresponding template in a set of model templates maintained by a clustering model of the cognitive model; and the DBMS iteratively generating a final production workload, each iteration comprising the DBMS selecting a next state feature from the set of production statements. adding a next statement to a candidate production workload, where the next statement has not been previously added to the candidate production workload; the DBMS attempting to associate the candidate production workload with a candidate histogram, where each bin of the candidate histogram identifies a total number of statements in the candidate production workload that are associated with a template uniquely assigned to that bin from the set of model templates; if the DBMS is able to associate the candidate production workload with the candidate histogram, predicting, in response to training of the cognitive model, that executing the candidate production workload will require the same amount and type of resources as the cognitive model, in response to its training, identified as being incurred by executing a workload characterized by the corresponding histogram; if the DBMS is able to derive a corresponding histogram,predicting that execution of any workload characterized by the corresponding histogram will require the same amount and type of resources as the cognitive model identified in response to its training; if the DBMS determines that execution of the candidate production workload will require more resources than are currently available, removing the most recently added statement from the candidate production workload and considering the resulting workload as the final production workload; if the DBMS determines that execution of the candidate production workload will not require more resources than are currently available, continuing with a next iteration of generating the final production workload; The DBMS forwards the final production workload to a query execution engine of the DBMS for execution by the DBMS. [Brief explanation of the drawings]
[0014] [Figure 1] FIG. 1 illustrates a cloud computing environment according to one embodiment of the present invention. [Figure 2] FIG. 2 illustrates abstraction model layers according to one embodiment of the present invention. [Figure 3] FIG. 1 illustrates the structure of a computer system and computer program code that can be used to implement a self-learning binned resource optimization method for a database management system according to an implementation of the present invention. [Figure 4] FIG. 1 illustrates the architecture of a self-learning workload management component and related components of a database management system according to an embodiment of the present invention. [Figure 5] 1 is a schematic flowchart illustrating a method for training a self-learning DBMS workload manager to perform binned resource optimization and then using the training results to optimize estimation of resource requirements in a production environment, according to an embodiment of the present invention. [Figure 6]1 is a flowchart illustrating steps for training a DBMS system with self-learning binned resource optimization according to an embodiment of the present invention. [Figure 7] 1 is a flowchart illustrating steps of a DBMS system with self-learning binned resource optimization according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE INVENTION
[0015] Known methods for estimating DBMS resource requirements employ relatively unsophisticated workload management mechanisms that require extracting low-level features from individual data access statements and associating each extracted feature with a corresponding set of requirements. These mechanisms do not consider more nuanced factors related to the concurrent processing of multiple statements in a workload, and they fail to provide the flexibility and robustness necessary to perform without maintenance by a human database administrator.
[0016] Known DBMS workload manager techniques also suffer from complexity and overhead issues resulting from the need to use separate resource consumption models to analyze each possible combination of low-level characteristics and resource types, and known implementations require ongoing monitoring and maintenance to manually modify these models when there are changes in the DBMS application, database schema, computing platform, or the general configuration or timing of the submitted workload.
[0017] Embodiments of the present invention provide methods, systems, and computer program products that improve workload management subsystems and techniques employed by known DBMSs. These improvements include a self-learning workload management function or component that includes a cognitive model trained to predict resource requirements at the workload level. Unlike existing DBMS workload managers that attempt to infer the requirements of one statement at a time, the present invention uses a top-down approach that estimates the resource requirements of an entire workload.
[0018] Top-down estimation models are generally simpler to implement than bottom-up models, which must analyze the resource requirements of all low-level query features. However, top-down models are generally less accurate because they have access to less information when generating resource estimates for individual query statements.
[0019] The present invention solves this problem by analyzing the resource requirements of an entire workload batch of query statements, rather than simply analyzing isolated queries. Because a workload may contain many heterogeneous data access statements competing for the use of various resources, the present embodiment estimates resource requirements according to certain high-level features that characterize the entire workload.
[0020] As used herein, the terms "data access request," "database access request," "data access request," "database query," "data access statement," and similar terms refer to instructions received by a DBMS that request additions, deletions, updates, and searches of data elements, indexes, and other content of a database, and are sometimes used interchangeably. While particular definitions of these terms may distinguish between "queries" and "statements," for example, when an SQL query is defined as being composed of multiple statements, such distinction is not relevant to the form or functionality of the invention. Depending on the implementer's preferences and technical considerations, various implementations may be configured to use the same procedures to process individual SQL statements, entire queries, or other types of data access requests.
[0021] These characteristics range from syntactic elements such as Structured Query Language (SQL) operators, to semantically meaningful identifiers such as table, column, and subschema aliases, to features of query execution plans generated by the DBMS's optimization module. In particular embodiments, at least some of these analysis steps are implemented as a distribution-regression learning problem that generates a vector data structure that can be submitted to a deep learning neural network or incorporated into a training machine learning corpus. In a production environment, an improved workload manager trained by the present top-down, batch-oriented methodology can more accurately determine whether adding a single query to an existing DBMS workload will overallocate limited resources.
[0022] Embodiments of the present invention also improve upon known DBMS workload management components by freeing the DBMS from having to extract and analyze every low-level feature of each query statement. The present embodiments do not require separate resource estimation models to analyze each type of low-level feature and query operator or predicate. And, because the present invention intelligently learns over time which resource consumption predictions are most accurate or provide the greatest performance gains, the present embodiments do not necessarily need to be manually reconfigured when there are changes in the database schema, the configuration of the application or computer platform, or the overall timing or composition of the workload submitted to the DBMS.
[0023] Although this disclosure includes detailed descriptions of cloud computing, it should be understood that implementation of the teachings described herein is not limited to cloud computing environments. Rather, embodiments of the present invention may be practiced in conjunction with any other type of computing environment now known or later developed.
[0024] Cloud computing is a service delivery model for enabling convenient, on-demand network access to a shared pool of configurable computing resources (e.g., networks, network bandwidth, servers, processing, memory, storage, applications, virtual machines, and services) that can be rapidly provisioned and released with minimal management effort or interaction with a service provider. This cloud model includes at least five characteristics, at least three service models, and at least four deployment models.
[0025] The characteristics are as follows: On-Demand Self-Service: Cloud consumers can unilaterally provision computing capacity, such as server time or network storage, automatically as needed, without the need for human interaction with the service provider. Broad network access: Computing power is available over the network and can be accessed through standard mechanisms, facilitating use by heterogeneous thin or thick client platforms (e.g., cell phones, laptops, PDAs). Resource Pooling: Computing resources from a provider are pooled and offered to multiple consumers using a multi-tenant model. Various physical and virtual resources are dynamically allocated and reallocated based on demand. Consumers generally have no control or knowledge of the exact location of the resources they are provided with, resulting in a sense of location independence. However, consumers may be able to determine location at a higher level of abstraction (e.g., country, state, data center). Rapid Elasticity: Computing capacity can be provisioned quickly and elastically, sometimes automatically, to instantly scale out and quickly release to instantly scale in. To the consumer, the computing power available for provisioning often appears unlimited, and can be purchased at any time and in any quantity. Metered Services: Cloud systems leverage measurement capabilities at a level of abstraction appropriate to the type of service (e.g., storage, processing, bandwidth, active user accounts) to automatically control and optimize resource usage. Resource usage can be monitored, controlled, and reported to provide transparency to both providers and consumers of utilized services.
[0026] The service model is as follows: Software as a Service (SaaS): The functionality offered to the consumer is the availability of a provider's applications running on a cloud infrastructure that can be accessed from a variety of client devices through a thin client interface such as a web browser (e.g., webmail). The consumer does not manage or control the underlying cloud infrastructure, including the network, servers, operating systems, storage, or even individual application functionality, except for limited user-specific application configuration settings. Platform as a Service (PaaS): The capability offered to consumers is to deploy applications they create or acquire using programming languages and tools supported by the provider onto a cloud infrastructure. The consumer does not manage or control the underlying cloud infrastructure, including the network, servers, operating systems, or storage, but does have control over the deployed applications and, in some cases, the configuration of their hosting environment. Infrastructure as a Service (IaaS): The functionality offered to consumers is the provisioning of processors, storage, networking, and other basic computing resources on which they can deploy and run any software, including operating systems and applications. The consumer does not manage or control the underlying cloud infrastructure, but has control over the operating system, storage, and deployed applications, and in some cases partial control over some network components (e.g., host firewalls).
[0027] The deployment model is as follows: Private Cloud: This cloud infrastructure is dedicated to a specific organization and can be managed by that organization or a third party, and can exist on-premise or off-premise. Community Cloud: This cloud infrastructure is shared by multiple organizations to support a specific community with common concerns (e.g., mission, security requirements, policies, and compliance). This cloud infrastructure can be managed by those organizations or a third party and can exist on-premises or off-premises. Public cloud: This cloud infrastructure is available to the general public or large industry organizations and is owned by an organization that sells cloud services. Hybrid cloud: This cloud infrastructure combines two or more cloud models (private, community, or public), each of which retains its inherent nuances but is bound by standards or specific technologies that enable data and application portability (e.g., cloud bursting for load balancing between clouds).
[0028] A cloud computing environment is a service-oriented environment that emphasizes statelessness, low coupling, modularity, and semantic interoperability. At the core of cloud computing is an infrastructure that includes a network of interconnected nodes.
[0029] FIG. 1 illustrates an exemplary cloud computing environment 50. As shown, the cloud computing environment 50 includes one or more cloud computing nodes 10, with which local computing devices used by cloud consumers (e.g., PDAs or cell phones 54A, desktop computers 54B, laptop computers 54C, or automobile computer systems 54N, or combinations thereof) can communicate. The nodes 10 can communicate with each other. The nodes 10 can be physically or virtually grouped (not shown) in one or more networks, such as the private, community, public, or hybrid clouds described above, or combinations thereof. This enables the cloud computing environment 50 to provide infrastructure, platform, or software as a service, or combinations thereof, for which cloud consumers are not required to maintain resources on their local computing devices. It should be understood that the types of computing devices 54A-N illustrated in FIG. 1 are exemplary only, and that the computing nodes 10 and the cloud computing environment 50 can communicate with any type of electronic device via any type of network or network-addressable connection (e.g., using a web browser), or both.
[0030] A set of functional abstraction layers provided by cloud computing environment 50 (FIG. 1) is now shown in FIG. 2. It should be understood in advance that the components, layers, and functions shown in FIG. 2 are merely exemplary, and embodiments of the present invention are not limited thereto. As shown, the following layers and corresponding functions are provided:
[0031] Hardware and software layer 60 includes hardware and software components. Examples of hardware components include mainframe 61, reduced instruction set computer (RISC) architecture-based server 62, server 63, blade server 64, storage device 65, and network and network components 66. In some embodiments, software components include network application server software 67 and database software 68.
[0032] The virtualization layer 70 provides an abstraction layer from which virtual entities such as virtual servers 71, virtual storage 72, virtual networks including virtual private networks 73, virtual applications and operating systems 74, and virtual clients 75 can be provided.
[0033] By way of example, the management layer 80 may provide the following functionality: Resource provisioning 81 enables dynamic procurement of computing and other resources utilized to execute tasks within the cloud computing environment. Metering and pricing 82 enables cost tracking as resources are utilized within the cloud computing environment and billing or invoicing for the consumption of these resources. By way of example, these resources may include application software licenses. Security enables identification and verification of cloud consumers and tasks, as well as protection for data and other resources. User portal 83 provides consumers and system administrators with access to the cloud computing environment. Service level management 84 enables allocation and management of cloud computing resources so that requested service levels are met. Service level agreement (SLA) planning and fulfillment 85 enables advance arrangement and procurement of anticipated future cloud computing resources required in accordance with SLAs.
[0034] The workload layer 90 provides examples of functionality that can be leveraged in a cloud computing environment. Examples of workloads and functionality that can be provided from this layer include mapping and navigation 91, software development and lifecycle management 92, virtual classroom instruction delivery 93, data analytics processing 94, transaction processing 95, and orchestration of optimized resource requirement estimation for batch workloads in database management systems.
[0035] The present invention may be a system, method, or computer program product, or combination thereof, integrated at any possible level of technical detail. The computer program product may include a computer-readable storage medium having stored thereon computer-readable program instructions for causing a processor to carry out aspects of the present invention.
[0036] A computer-readable storage medium may be a tangible device capable of retaining and storing instructions for use by an instruction execution device. The computer-readable storage medium may be, by way of example, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or a suitable combination thereof. More specific examples of computer-readable storage media include portable computer diskettes, hard disks, RAM, ROM, EPROM (or flash memory), SRAM, CD-ROMs, DVDs, memory sticks, floppy disks, mechanically encoded devices having instructions recorded on punch cards or ridge-in-groove structures, or the like, and suitable combinations thereof. As used herein, a computer-readable storage medium should not be construed as a transitory signal per se, such as an electric wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., light pulses passing through a fiber optic cable), or an electrical signal transmitted over a wire.
[0037] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computer / processing device. Alternatively, they can be downloaded to an external computer or external storage device via a network (e.g., the Internet, a LAN, a WAN, or a wireless network, or a combination thereof). The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, or edge servers, or a combination thereof. A network adapter card or network interface within each computer / processing device receives the computer-readable program instructions from the network and transfers the computer-readable program instructions to a computer-readable storage medium in the respective computer / processing device for storage.
[0038] The computer-readable program instructions for carrying out the operations of the present invention can be either assembler instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, configuration data for integrated circuits, or source or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk and C++, and procedural programming languages such as the "C" programming language and similar programming languages. The computer-readable program instructions can execute entirely on the user's computer as a stand-alone software package, partially on the user's computer, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter case, the remote computer may be connected to the user's computer via any type of network, including a LAN or WAN, or may be connected to an external computer (e.g., via the Internet using an Internet Service Provider). In some embodiments, electronic circuitry, including, for example, programmable logic circuits, field programmable gate arrays (FPGAs), programmable logic arrays (PLAs), can execute computer-readable program instructions by utilizing state information of the computer-readable program instructions to customize the electronic circuitry for carrying out aspects of the present invention.
[0039] Aspects of the present invention are described herein with reference to flowchart and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. Each block of the flowchart and / or block diagrams, and combinations of blocks in the flowchart and / or block diagrams, can be implemented by computer-readable program instructions.
[0040] These computer-readable program instructions can be provided to a processor of a computer or other programmable data processing apparatus to produce a machine, whereby the instructions, executed by the processor of such computer or other programmable data processing apparatus, create means for performing the functions / acts identified in one or more blocks of the flowcharts and / or block diagrams. These computer-readable program instructions can also be stored on a computer-readable storage medium that can instruct a computer, programmable data processing apparatus, or other device, or combination thereof, to function in a particular manner. The computer-readable storage medium having instructions stored thereon thereby constitutes an article of manufacture including instructions for performing aspects of the functions / acts identified in one or more blocks of the flowcharts and / or block diagrams.
[0041] Computer-readable program instructions may also be loaded into a computer, other programmable device, or other device and a series of operational steps executed on the computer, other programmable device, or other device to create a computer-implemented process, whereby the instructions executing on the computer, other programmable device, or other device perform the functions / operations identified in one or more blocks in the flowcharts and / or block diagrams.
[0042] The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of instructions, including one or more executable instructions for performing specific logical functions. In some implementations, the functions shown in the blocks may be performed in an order different from that shown in the figures. For example, depending on the functionality involved, two blocks shown in succession may actually be accomplished as a single step, may be executed simultaneously or substantially simultaneously, may be executed in a partially or fully overlapping manner, or the blocks may even be executed in reverse order. Note that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs specific functions or operations or executes a combination of dedicated hardware and computer instructions.
[0043] 3 is a diagram illustrating the structure of a computer system and computer program code that can be used to implement a self-learning binned resource optimization method for a database management system according to an embodiment of the present invention. FIG. 3 references objects 301-315.
[0044] In FIG. 3, computer system 301 includes a processor 303 coupled to one or more hardware data storage devices 311 and one or more I / O devices 313 , 315 via one or more I / O interfaces 309 .
[0045] The hardware data storage devices 311 may include, but are not limited to, magnetic tape drives, fixed or removable hard disks, optical disks, mobile devices with storage, and solid-state random-access or read-only storage devices. The I / O devices may include, but are not limited to, input devices 313 such as keyboards, scanners, portable telecommunications devices, touch-sensitive displays, tablets, biometric readers, joysticks, trackballs, or computer mice, and output devices 315. The output devices 315 may include, but are not limited to, printers, plotters, tablets, mobile phones, displays, or sound-generating devices. The data storage devices 311, input devices 313, and output devices 315 may be located locally or at remote sites connected to the I / O interface 309 via a network interface.
[0046] The processor 303 may also be connected to one or more memory devices 305. The memory devices 305 may include, but are not limited to, dynamic RAM (DRAM), static RAM (SRAM), programmable read-only memory (PROM), field programmable gate arrays (FPGA), SD memory cards, SIM cards, or other types of memory devices.
[0047] At least one memory device 305 includes stored computer program code 307. The computer program code 307 is a computer program including computer-executable instructions. The stored computer program code includes a program implementing a method for self-learning binned resource optimization for a database management system according to an embodiment of the present invention. The computer program code may also implement other embodiments described herein, including the methods illustrated in FIGS. 1-7. The data storage device 311 may store the computer program code 307. The computer program code 307 stored in the storage device 311 is configured to be executed by the processor 303 via the memory device 305. The processor 303 executes the stored computer program code 307.
[0048] In some embodiments, rather than being stored and accessed from a hard drive, optical disk, or other writable, rewritable, or removable hardware data storage device 311, the stored computer program code 307 may be stored on a static, non-removable, read-only storage medium such as a read-only memory (ROM) device 305 and may be accessed by the processor 303 directly from such static, non-removable, read-only medium 305. Similarly, in some embodiments, the stored computer program code 307 may be stored as computer-readable firmware and may be accessed by the processor 303 directly from such firmware rather than from a more dynamic or removable hardware data storage device 311 such as a hard drive or optical disk.
[0049] Thus, the present invention discloses a computer infrastructure supporting and process for integrating, hosting, maintaining, and deploying computer readable code onto computer system 301, where the code in combination with computer system 301 is capable of executing a self-learning binned resource optimization method for a database management system.
[0050] Any of the components of the present invention may be created, integrated, hosted, maintained, deployed, managed, processed, supported, etc. by a service provider offering to facilitate a self-learning binned resource optimization method for database management systems. Accordingly, the present invention discloses a process for deploying or integrating a computing infrastructure, comprising integrating computer-readable code into a computer system 301, wherein the code in combination with the computer system 301 is capable of executing a self-learning binned resource optimization method for database management systems.
[0051] One or more data storage devices 311 (or one or more additional memory devices not shown in FIG. 3) may be used as computer-readable hardware storage devices implementing computer-readable programs and / or storing other data, where the computer-readable programs include stored computer program code 307. In general, the computer program product (or article of manufacture) of computer system 301 may include computer-readable hardware storage devices.
[0052] In embodiments involving components of a networked computing infrastructure, a cloud computing environment, a client-server architecture, or other type of distributed platform, the functionality of the invention may be implemented solely on the client or user device, solely on a remote server, or as a service of the cloud computing platform, or may be split between local and remote components.
[0053] The program code 307 for the self-learning binned resource optimization method for a DBMS may be deployed by manually loading the program code 307 directly onto the client, server, and proxy computers (not shown) by loading the program code 307 onto a computer-readable storage medium (e.g., computer data storage device 311). Alternatively, the program code 307 may be automatically or semi-automatically deployed onto the computer system 301 by transmitting the program code 307 to a central server (e.g., the computer system 301) or a group of central servers. The program code 307 may then be downloaded to the client computers (not shown) that execute the program code 307.
[0054] Alternatively, the program code 307 may be sent directly to the client computer by email, and then the program code 307 may be isolated to a directory on the client computer by email options that select the program to isolate the program code 307 to a directory, or may be loaded into a directory on the client computer.
[0055] Another method is to send the program code 307 directly to a directory on the hard drive of the client computer. If a proxy server is configured, the process selects the proxy server code, determines which computer to place the proxy server code on, sends the proxy server code, and installs the proxy server code on the proxy computer. The program code 307 is then sent to the proxy server and stored on the proxy server.
[0056] In one embodiment, program code 307 for a self-learning binned resource optimization method for a DBMS is integrated into the client, server, and network environment by coexisting with software applications (not shown), operating systems (not shown), and network operating system software (not shown) and installing it on the clients and servers in the environment in which the program code 307 functions.
[0057] As described above, the first step in integrating the code contained in program code 307 is to identify any software (including network operating systems (not shown)) on the clients and servers on which program code 307 is deployed that is required by or works in conjunction with program code 307. This identified software includes network operating systems, which include software that enhances the base operating system by adding networking capabilities. Next, the software applications and version numbers are identified and compared to a list of software applications and correct version numbers that have been tested to work with program code 307. Software applications that are not found or do not match the correct version numbers are upgraded to the correct version.
[0058] Program instructions that pass parameters from program code 307 to software applications are checked to ensure that their parameter list matches the parameter list required by program code 107. Conversely, parameters passed from software applications to program code 107 are checked to ensure that they match the parameters required by program code 107. Client and server operating systems, including network operating systems, are identified and compared to a list of operating systems, version numbers, and network software programs that have been tested to work with program code 107. Any operating system, version number, or network software program that does not match an entry in the list of tested operating systems and version numbers is upgraded to the level in the list on the client computer and upgraded to the level in the list on the server computer.
[0059] After verifying that the software deploying program code 307 has been tested to work with program code 107 and is at the correct version level, integration is completed by installing program code 307 on clients and servers.
[0060] Embodiments of the present invention may be implemented as a method executed by a processor in a computer system, as a computer program product, as a computer system, or as a process or service executed by a processor to support a computer infrastructure.
[0061] 4 is a diagram illustrating the architecture of a self-learning workload management component and related components of a DBMS according to an embodiment of the present invention. FIG. 4 shows items 410-470 and 4000-4001.
[0062] In the embodiment of FIG. 4, the self-learning workload management component 410 of the DBMS 4000 is trained by the machine learning training subsystem 4001 to more accurately predict the resource requirements of received data access requests by organizing and processing these requests as a batched workload.
[0063] The diagram shows a subset of the components of DBMS4000. The improved workload manager 410 relies on machine learning models 460 trained according to embodiments of the present invention to predict resource requirements for production workloads submitted to the DBMS 4000. In some embodiments, a separate machine learning model 460 is used to predict requirements for one (or another suitable subset) of all possible resource types or classes. In such cases, each model 460 is independently trained to predict the production workload's requirements for the particular model's associated resources by repeating the method of FIGS. 4-5 , and the total resource requirements for the production workload are derived by aggregating the requirements identified by each model 460. Query optimizer 420 generates execution plans for received SQL queries and other types of data access requests, as is known in the art. The resource prediction pipeline 430 transfers the resource prediction rules, concepts, reasoning, and other training and artificial intelligence knowledge constructed by the resource requirements estimation model 460 trained by the training system 4001 to the workload manager 410. Query execution engine 440 manages the execution by the DBMS of each statement of the production DBMS workload assembled by workload manager 410, as is known in the art.
[0064] A machine learning training system 4001 employing artificial intelligence, cognitive computing, or machine learning methods trains a self-learning model 460 that predicts resource requirements for submitted DBMS workloads. The training system 4001 includes the following components: The machine learning training pipeline 450 receives raw training data from the DBMS 4000 in the form of query logs that identify the types and amounts of resources required to process data access requests previously submitted to the DBMS. The machine learning model 460 is trained by the training system 4001 to predict the resource requirements of incoming DBMS statements batched into a workload. The inference pipeline 470 interfaces with components that perform various pre-processing steps, dictionary generation, and general modeling operations (described in subsequent figures), and transfers the resulting artificial intelligence inferences, concepts, and rules from the machine learning model 460 to the production DBMS 4000.
[0065] Some embodiments may include architectures that vary slightly from that of Figure 4, dividing the functionality of one particular component into multiple components, or combining the functionality of two or more components into a single component. For example, training system 4001 may, in some implementations, be an internal component of DBMS 4000, or both DBMS 4000 and training system 4001 may be components of a single, larger system.
[0066] As will be described in more detail in subsequent figures, embodiments of the present invention may be deployed on the platform of FIG. 4 to perform steps that follow the following general procedure. i) In the training phase, resource requirement estimation model 460 is trained to estimate the resource requirements of various workloads processed by DBMS 4000. In this phase, training system 4001 first receives a raw training data set, such as logs of data access requests or other types of production workloads previously submitted to DBMS 4000 or a similar DBMS. In some embodiments, this data is received from DBMS 4000 via training pipeline 450. The raw training data also describes the types and amounts of resources required by DBMS 4000 to process each logged request. ii) The training system 4001 processes the training data to generate a training corpus formatted according to known standards or conventions used by machine learning applications. In some embodiments, such a corpus is formatted as a class of triple store data structures known in the art for use in machine learning training. Such a corpus represents the knowledge received and generated by the training system as a type of data structure known in the art of machine learning for representing training knowledge. The training system 4001 then uses the machine learning corpus to train a resource requirements estimation model 460 for predicting resource requirements for batched workloads. iii) The rules, inferences, concepts, relationships, and other elements of artificial intelligence knowledge comprised by the learned model 460 are passed to the workload manager 410 of the DBMS 4000 via the inference pipeline 470 and resource prediction pipeline 430 of the training system 4001. In some embodiments, the entire model is passed to the DBMS 4000. iv) Improved workload manager 410 uses the latest knowledge or models received from training system 4001 to estimate the resource requirements of the production workload assembled from data access requests submitted to DBMS 4000 according to the execution plan generated by query optimizer 420. Workload manager 410 then uses this knowledge to ensure that the production workload does not require an allocation of more resources than are currently available to DBMS 4000, and also to ensure that the DBMS utilizes the available resources in an optimal manner. Both of these improvements help maximize the throughput and performance of the DBMS.
[0067] Figure 5 is a schematic flow chart illustrating a method for training a self-learning DBMS workload manager to perform binned resource optimization and then using the training results to optimize resource requirement estimates in a production environment, according to an embodiment of the present invention. Figure 5 includes steps 500-590, which are described in more detail in subsequent figures, and which can be performed by embodiments such as those shown in Figures 1-4.
[0068] At step 500, training system 4001 receives a training dataset that includes or consists of logs of SQL DBMS queries or other types of data access requests. Depending on the implementation, each request may be a single statement or may consist of multiple statements. In some embodiments, this dataset is generated by a component of production DBMS 4000, for example, as a query log. In addition to including the actual text or other representation of past data access requests, the dataset also identifies the type and amount of resources consumed by DBMS 4000 to process each request.
[0069] In step 510, the training system 4001 pre-processes each statement in the received training data set. As explained in more detail in Figure 6, this pre-processing includes normalization and standardization operations that reduce the complexity of subsequent steps of the present invention.
[0070] In step 520, the training system 4001 performs high-level feature-engineering tasks on the preprocessed training statements. As explained in more detail in Figure 6, these tasks involve generating a dictionary of keywords parsed from the training statements, identifying for each statement the high-level compile-time features specified by the query execution plan generated by the DBMS optimizer module 420, and generating a set of query vectors each representing this information for the corresponding training statement.
[0071] In step 530, the training system 4001 organizes the query vectors into "template" clusters. Each template consists of a subset of query vectors that are deemed to have similarity above a predefined similarity threshold. To determine which query vectors are similar enough to be assigned to the same template, the implementer can choose any known similarity quantification mechanism, such as a known clustering algorithm. This step is described in more detail in FIG. 6. In certain embodiments, each query vector is assigned to only one template.
[0072] Numerous clustering and similarity determination procedures are known in the art, and depending on the implementer's preferences and technical constraints, an embodiment may employ a particular procedure selected from known mechanisms such as k-means clustering or the DBSCAN algorithm. The present invention is highly adaptable and can accommodate any clustering method or any other method known in the art for quantifying similarity between n-dimensional vectors.
[0073] As an example, certain known clustering algorithms are used to determine whether a subset of vectors are similar enough to be assigned to the same template. This determination involves plotting each n-element vector as a point in n-dimensional space and measuring the distance between its n-dimensional location and the centroid (or arithmetic mean) value of the template. The similarity of this vector to other vectors can then be derived according to the magnitude of this distance. In this example, all vectors associated with a distance less than a predetermined threshold are considered similar enough to be assigned to the same template.
[0074] At the end of step 530, the training system 4001 has generated templates of query vectors, each of which represents a subset of training or statements that share similar high-level characteristics. In some embodiments, the training system 4001 may generate additional templates reserved for production workloads that do not correspond to any of the previously generated templates.
[0075] In step 540, the training system 4001 generates a set of histograms, each describing the distribution of vectors in a particular workload of training queries. This procedure is explained in more detail in FIG. 6.
[0076] This "binning" process first randomly divides the training queries (or data access statements) into equal-sized subsets. Each subset represents a random "training workload" of DBMS queries or other types of data access requests that can be submitted to the DBMS 4000. Each training query is represented by exactly one template, but each template can represent multiple training queries, so each training workload is associated with a corresponding number of instances of each template. It is also possible for a training workload to be associated with zero instances of a particular template.
[0077] Each histogram includes a set of distinct bins, each bin uniquely associated with one of the templates generated in step 530. The value stored in a particular bin of a particular histogram identifies the number of instances of that particular bin's associated template that are associated with any of the queries that make up the particular histogram's corresponding workload.
[0078] As an example, system 4001 generates five templates T1, T2, T3, T4, and T5 in step 530. Thus, each histogram generated in step 540 will have five bins, one for each template. If the training workload selected in step 540 consists of three queries associated with templates T1, T5, and T1, respectively, each of the five bins of the workload's histogram will identify the number of queries in the workload associated with one of the templates. In this case, the five bins of the histogram are populated with the values T1=2, T2=0, T3=0, T4=0, and T5=1.
[0079] Each histogram is also associated with its own set of resource requirements, since each training query is known to have consumed a particular amount of resources. In certain embodiments, the resource requirements of a histogram are derived as the sum of the requirements of each query in the training workload associated with the histogram. In some embodiments, each histogram or template is associated with the requirements of only one type of resource. As a result, the resource requirements of a particular workload are associated with a set of training histograms of a single resource.
[0080] At step 550, the training system 4001 formats the information represented by at least a portion of the training workloads, histograms, resource requirements, and query vectors into a formally structured machine learning corpus. This corpus is not simply a body of unstructured or arbitrarily structured data. Rather, the corpus contains artificial intelligence knowledge formatted in a manner consistent with known knowledge-based data structures used in fields of artificial intelligence, such as expert systems and machine learning. In representative embodiments, this knowledge is formatted as a set of vector inputs suitable for submission to a deep learning neural network or as a triple store, which mathematically represents specialized resource requirement estimation knowledge as a set of rules, concepts, and relationships. The training system 4001 then uses the machine learning corpus to train a machine learning model 460 to associate a specific set of resource requirements with each workload represented by one of the histograms, using known machine learning methods.
[0081] In other embodiments, training system 4000 applies additional intelligence to the data structures and knowledge formed in steps 500-550 to infer and associate resource requirements with additional histograms not directly related to a particular training workload. These additional histograms may be intelligently derived, for example, if the model identifies patterns and relationships among particular high-level characteristics represented by the query vectors, particular types of resource requirements, or particular distributions of vectors associated with the training workload. The resulting additional histograms may be associated with resource requirements inferred or inferred from patterns or relationships identified in the training workload, even if these additional histograms do not exactly represent the particular training workload.
[0082] Steps 560-590 describe a stage or embodiment of the present invention in which production DBMS 4000 applies the knowledge and experience built into machine learning model 460 through the training procedure of steps 500-550. This application involves batching received production data access requests into production workloads, and then estimating the resource requirements of each production workload by relating the distribution of high-level features of each production workload to the knowledge of workload resource requirements learned in the training procedure. Further details of steps 560-590 are provided in subsequent figures.
[0083] In step 560, while operating in a production environment, DBMS 4000 receives a set of data access requests from a user or other computerized system. DBMS 4000 may already be processing other requests. Depending on implementation details, the data access requests may consist of any type of request known in the art, such as a database query in SQL format.
[0084] In step 570, the DBMS 4000 processes all or part of the received request set to generate a query vector for each processed request. This processing is performed in a similar manner to the processing in steps 510-520.
[0085] DBMS 4000 may use any known method to determine which requests to process, depending on the implementer's preferences. For example, if step 570 is performed each time a certain condition is met, DBMS 4000 may process all unprocessed queries received since the last time the condition was met. The condition may be set by a human administrator, manager, or programmer, or may be set and subsequently adjusted by any known automated means. Examples of such conditions include detecting that a certain amount of time has passed since the last execution of step 570, the arrival of a particular time or day of the week, detecting that the number of unprocessed queued queries has fallen below a threshold or that the number of received unqueued queries has exceeded a threshold, detecting that the availability of a particular combination of resources has exceeded a threshold, etc.
[0086] In other embodiments, DBMS 4000 may perform step 570 for a predetermined number of queries, selecting queries for processing depending on the chronological order in which the queries were submitted or received. In still other embodiments, a more sophisticated selection mechanism is used to determine which and how many queries to select for processing in step 570 depending on a combination of other factors, such as the characteristics of each query, the characteristics of each user or system submitting each query, or the characteristics of the particular data storage accessed by each query.
[0087] At the end of step 570, DBMS 4000 has generated a query vector for each data access request selected from the subset of previously received production data access requests.
[0088] In step 580, DBMS 4000 generates an optimal production workload by adding, one at a time, each processed query or other type of data access request to the existing workload of DBMS 4000. Similar to the method for selecting which incoming data access requests to process in step 570, the order in which the processed requests are added to the workload may be selected by any means according to the implementer's preference. In some embodiments, this order is the chronological order in which the received requests were submitted or received.
[0089] As each query is added, DBMS 4000 uses the knowledge and experience gained by building machine learning model 460 during the training phase to build a histogram representing the distribution of templates among the queries in the current workload. DBMS 4000 then estimates the resource requirements of the workload according to the resources associated with the newly identified histogram.
[0090] DBMS 4000 repeats this iterative procedure until the workload requires a greater amount of resources than are available. It then removes the most recently added statement from the workload. The resulting workload is then considered to be the maximum workload that DBMS 4000 can process without requiring unavailable resources.
[0091] In step 590, the DBMS 4000 adds the selected workload to a query-execution queue. Each data access request in the query-execution queue is processed by a DBMS component that accesses the database's data and indexes. These operations are managed, in some implementations, by the query execution engine 440 component of the DBMS 4000.
[0092] In some embodiments, the results of processing the selected workload are returned to the training system 4001 through the training pipeline 450. These results may include information such as the internal configuration of the selected workload, a histogram associated with the workload, a query vector associated with each access request of the workload, or a comparison of the resource requirements identified by the histogram with the actual amount of resources needed to process the selected workload.
[0093] Figure 6 is a flowchart illustrating steps for training a DBMS system with self-learning binned resource optimization according to an embodiment of the present invention. Figure 6 includes steps 600-680, which are detailed descriptions of steps 500-540 of Figure 5.
[0094] In step 600, the DBMS training system 4001 begins preprocessing the training queries (or other types of training data access statements) received in step 500 of Figure 5. One purpose of these preprocessing steps is to make each training statement conform to a common set of rules or standards. This conformance reduces the number of unique characteristics of each statement that are expressed as elements of a query vector. Because the complexity of an implementation increases with the size of the query vector, reducing the number of vector elements improves the efficiency of the implementation and reduces maintenance requirements.
[0095] This is especially true for embodiments in which resource prediction model 460 is a deep neural network to which histograms and their associated aggregate resource requirements, or other data structures derived by the embodiment, are submitted as inputs. Because the size of a deep neural network grows rapidly with the number of elements in its vector inputs, making the input vectors smaller can significantly reduce the complexity of the model.
[0096] In some embodiments, a first normalization step ensures that all statement text has a common case, such as upper-case or lower-case text. If the query language does not require statements to be case-sensitive, this step allows training system 4001 to avoid errors where, for example, the equivalent aliases "COL008" and "col008" are incorrectly considered to be different tokens.
[0097] In step 610, the training system 4001 replaces predicate constants in the training statements with markers to remove the constants from further analysis in subsequent steps. This step further reduces the complexity of the analysis because the exact value of the constants has little, if any, effect on the amount or type of resources required to process the statement. For example, replacing the constant "21" in the phrase "customer age < 21" with a marker prevents the exact value of the constant from being mistaken for a token element that could change the amount or type of resources required to execute the phrase.
[0098] In step 620, the training system 4001 continues preprocessing the training statements by removing other labels from each statement that do not affect the amount or type of resources required to execute the statement. These other labels include schema references and table aliases.
[0099] For example, because there is little (if any) difference between the amount or type of resources required to execute the query "SELECT * FROM CustomerTable C1 WHERE C1.MyColumn > 100" and the amount or type of resources required to execute the query "SELECT * FROM CustomerTable C2 WHERE C2.MyColumn > 100," training system 4001 does not distinguish between table aliases "C1" and "C2" when determining the resource requirements of these statements.
[0100] In step 630, the training statements preprocessed in steps 600-620 are tokenized in a manner similar to the tokenization steps used by known DBMS front-ends. This tokenization involves extracting syntactic keywords (e.g., the SQL predicate "JOIN") and semantic keywords (e.g., literal table names), and removing stop words, such as the SQL keywords "FROM" and "AND." As before, keywords are identified because they identify resource-intensive operations, while stop words are filtered out because they do not result in resource usage.
[0101] At the end of step 630, training system 4001 has accumulated a list of tokens extracted from the standardized training statements. This standardization reduces the number of tokens extracted by removing elements from the statements that do not significantly affect resource requirements and by resolving ambiguities and redundancies that could erroneously identify unnecessary additional tokens.
[0102] In step 640, the training system 4001 builds a data dictionary that lists the number of occurrences of each distinct token extracted from the training statements in step 630.
[0103] In step 650, the training system 4001 removes from the data dictionary any tokens that do not occur at least a minimum number of times. This determination is made by comparing the number of occurrences of each token with a predetermined minimum threshold. This threshold may be determined by any method according to the implementer's preference, such as a known method based on empirical observation of the effect of various threshold levels on the performance of the method of Figure 5, or through any method known DBMSs use to generate data dictionaries during normal operation.
[0104] In step 660, training system 4001 reviews the execution plans generated by query optimizer 420 (or a module providing similar functionality) when processing the training statements. In some embodiments, these execution plans are included in the training data set received in step 500. In other embodiments, DBMS 4000 or a module of training system 4001 generates the execution plans through known methods similar to those performed by DBMS query optimizer 420. The resulting execution plans, and the detailed steps for generating plans to direct the DBMS to most efficiently process data access requests, are known in the art of database management.
[0105] In this step, training system 4001 continues by extracting compile-time features from the execution plan of each training statement. It is known in the art that these high-level features, like the tokens extracted from the training statements in step 630, can incur significant resource consumption when the statements containing them are executed.
[0106] Examples of such high-level compile-time features, as known in the art, include operations and estimated metrics performed at query runtime, such as table scan or sort operations and cardinality estimation (e.g., estimating the number of rows in a database table that need to be traversed to perform an operation that searches the table or joins a column of the table with another column).
[0107] Other examples of high-level features that may be identified in various embodiments as significantly affecting the resource requirements of a statement include: -The maximum size of the sort heap available to the DBMS. - Number of aggregation operators in SQL queries, such as MAX(), AVG(), COUNT() - Number of aggregation operators in a SQL query that contains the SQL DISTINCT keyword - The number of rows in a table that must be scanned before or after any operation that can be performed - The number of threads available to a DBMS configured to multi-thread the execution of concurrent statements.
[0108] In step 670, the trained clustering model of the training system 4001 assembles a query vector for each statement. Each element of each query vector uniquely corresponds to one of the high-level features identified in steps 610-650, such as a distinct token parsed from the training statement or a compile-time operation or metric referenced by a query execution plan generated by the DBMS query optimizer component. Each element of the query vector associated with a particular data access statement associates with this particular data access statement the value of the high-level feature corresponding to that element.
[0109] At the end of step 670, each training statement is associated with a corresponding query vector that identifies high-level features, such as tokens or compile-time features, that characterize the statement. This vector does not identify low-level features associated with the corresponding training statement. Multiple training statements can be associated with the same template, but a statement cannot be associated with multiple templates.
[0110] In step 680, the clustering model of the training system 4001 organizes the query vectors into clusters known as templates, divides the training dataset into workload subsets, and associates each workload with a histogram that specifies the distribution of query vectors among the training statements of that workload.
[0111] In this step, as described above in step 540 of Figure 5, training system 4001 divides the training dataset into training workloads according to any criteria desired by the implementer. In the particular embodiments and examples described herein, statements or queries in the training dataset are randomly assigned to workloads that each contain the same number of statements or queries (excluding a remainder workload, which contains statements or queries that did not fit into any of the complete workloads).
[0112] The number of statements or queries in each training workload may also be selected by any means known in the art or preferred by the implementer. For example, in some embodiments, the size of the training workloads is selected to optimize performance of the method of Figure 6, in which the total number of workloads or the number of queries in each workload is empirically determined to achieve optimal performance.
[0113] The trained model 460 of the training system 4001 then characterizes each workload with a corresponding histogram. Each bin of the histogram identifies the number of queries or statements in the corresponding workload that are associated with a particular template. Because multiple queries or statements may be associated with the same template, each bin can contain either zero or positive values. Each histogram is also associated with a set of resource requirements, which are derived by adding the amount of resources that each training statement or query in the histogram's corresponding workload actually consumed when originally executed by the DBMS 4000.
[0114] Finally, the method of FIG. 6 uses the resulting histograms, query vectors, and resource consumption records to train an artificial intelligence model 460 (such as a deep neural network, a deep learning neural network, or another type of machine learning model or expert system) to predict resource requirements for a particular type of workload, as described in step 550 of FIG. 5.
[0115] Figure 7 is a flowchart illustrating steps in a DBMS system with self-learning binned resource optimization according to an embodiment of the present invention. Figure 6 includes steps 600-680, which are detailed explanations of steps 500-540 of Figure 5. Figure 7 includes steps 700-780, which are detailed explanations of steps 570-590 of Figure 5.
[0116] Figure 7 illustrates how the improved workload manager component 410 of DBMS 4000 estimates the resources required to execute a production query or other type of data access request using the machine learning model 460 trained by the method of Figure 6 and steps 500-550 of Figure 5. The method includes the following steps: -Splitting the incoming production queries into subsets of "production workloads." Associating each production workload with a corresponding histogram, where the corresponding histograms are structured in a manner similar to the training histograms derived by the methods of FIGS. - Using the knowledge gained by the model 460 during the training phase to infer the resource requirements of each production workload depending on the characteristics of the corresponding histogram.
[0117] In step 700, which occurs immediately after step 560 of Figure 5, DBMS 4000 begins processing the set of incoming production queries (or data access statements) received in step 560. This processing procedure is similar to steps 510-520 of Figure 5 and steps 610-670 of Figure 6, which training system 4001 performs on the training data set. At the end of step 700, DBMS 4000 will have generated production query vectors for at least a subset of the production queries or statements received in step 560.
[0118] In step 710, DBMS 400 associates each production query vector generated in step 700 with a template having similar form and function as that derived by training system 4001 during the training phase of Figures 5-6. This association may be performed by a clustering model developed and trained during the training phase, such as a model based on the k-means clustering algorithm.
[0119] In some embodiments, this process consists simply of selecting a template containing a vector that matches each of the production query vectors derived in step 700. If none of the production vectors can be matched to a template, some embodiments may use a similarity-quantizing algorithm to derive a template that identifies the best matching vector or a template that identifies vectors that are within a predefined tolerance level of similarity to the production vector. In other embodiments, production vectors for which no matching templates exist may simply be assigned to a reserved catch-all template, such as the template generated upon completion of step 530 of FIG. 5.
[0120] In step 720, the DBMS 4000 assembles an initial production workload that includes a subset of the production queries processed in steps 700-720. If the DBMS 4000 has not completed execution of all previously queued queries, this initial workload may include one or more pending queries or statements currently in the execution queue in addition to, or instead of, the subset of production queries, depending on the implementer's preferences. In some embodiments, if the DBMS 4000 is not currently executing any production queries, the initial workload is set to a single query (or a single statement, depending on implementation details) selected from the production queries processed in steps 700-720.
[0121] In step 730, DBMS 4000 derives histograms that identify the distribution of templates associated with the initial workloads. This step is performed by a procedure similar to that used by training system 4001 to generate training histograms for each training workload in step 540 of Figure 5.
[0122] Step 740 begins an iterative procedure of steps 740-770. This procedure is repeated until it is determined that the current candidate for the production workload requires more resources than are currently available to DBMS 4000.
[0123] In step 750, workload manager 410 (or another functional component of DBMS 4000) determines whether the current workload requires resources beyond those currently available to DBMS 4000. This determination is made by comparing the resource requirements associated with the most recently selected or derived histogram with the types and amounts of resources currently available to DBMS 4000.
[0124] If the system determines that the current workload does not require more resources than are available, the method of Figure 7 continues at step 770, where the next production query or statement is added to the current workload. As is conventional, this next query or statement may be selected by any means desired by the implementer, such as by selecting it according to the time sequence in which production queries or statements were submitted to or received by DBMS 4000.
[0125] DBMS 4000 repeats the previous steps to associate this updated workload with histograms that represent the distribution of templates associated with the production statements that the updated workload contains. In embodiments in which each template and histogram is associated with only a single type of resource, or only a suitable subset of resource types, the updated workload in this step will be associated with a set of histograms that collectively represent the distribution of templates associated with the aggregated resources of all types required to execute the updated workload. The newly derived histograms are derived by model 460 based on previous training. The updated workload is then associated with a set of specific resource requirements that are compared with the amount and type of resources currently available to DBMS 4000 during the next iteration of step 750.
[0126] The iterative procedure of steps 740-770 is then repeated. This process continues until the production workload requires more resources than DBMS 4000 currently has available. At that point, the system branches off from step 750 to step 760. In step 760, the most recently added production statement or query is removed from the current workload. A final production workload is then selected as the maximum workload that DBMS 4000 can execute using only the available resources. The iterative procedure of steps 740-770 then ends, and the method of FIG. 7 continues to step 780.
[0127] In step 780, DBMS 4000 executes the final production workload derived in step 760. This execution may be performed by means known in the art of database management. However, in certain embodiments, this execution procedure may be improved by eliminating steps that check the availability of resources required by the final production workload. Because the present invention ensures that only available resources are required to execute all queries, data access requests, or other types of statements contained in the workload, these steps may be eliminated at the implementer's discretion.
[0128] If any of the production statements processed in steps 700-710 have not yet been executed, steps 720-780 of Figure 7 are repeated using the next production workload selected from the remaining statements. As with the previous execution of these steps, DBMS 4000 generates a next candidate initial production workload, associates the candidate with one or more newly derived histograms derived by trained model 460 so as to be similar in form and function to the histograms generated by the methods of Figures 5 and 6, and continues adding statements to the workload until the workload requires more resources than DBMS 4000 has available.
[0129] The examples and embodiments of the present invention described herein are presented for illustrative purposes. They should not be construed as exhaustive, nor should they be construed as limiting the embodiments of the present invention to the examples and embodiments described herein. As will be apparent to those skilled in the art, many other modifications and variations to the present invention are possible without departing from these examples and embodiments. The terminology used herein has been selected to best explain the principles underlying these examples and embodiments, with the aim of describing the practical application and technical improvements of the present invention to known technology and products, as well as enabling those skilled in the art to better understand the examples and embodiments disclosed herein.
Claims
1. 1. A training subsystem for a database management system (DBMS) comprising: a processor; a memory coupled to the processor; and a computer-readable hardware storage device coupled to the processor, the storage device containing program code configured to be executed by the processor via the memory to implement a method for self-learning binned resource optimization for a database management system, the method comprising: receiving training data, by the training subsystem, including a set of training statements each requesting access to a database managed by the DBMS and a record of the type and amount of resources required by the DBMS to execute each statement in the set of training statements; the training subsystem generating a set of query vectors, each of which identifies a feature that characterizes a corresponding statement in the training statements; the training subsystem assigning the set of query vectors to a set of templates; each vector in the set of query vectors is assigned to one template in the set of templates; each template in the set of templates is populated with a query vector that has a mathematical similarity to each other that exceeds a threshold similarity; the training subsystem dividing the set of training statements into a set of training workloads; each workload in the training workloads is associated with a corresponding histogram; each bin of each corresponding histogram uniquely corresponds to one template from the set of templates; each bin of a first corresponding histogram identifies a number of statements in the corresponding workload of the first corresponding histogram that are associated with each template of the set of templates; the training subsystem associating each corresponding histogram with a set of resources previously consumed by execution of each training statement of the histogram's corresponding training workload; the training subsystem adding knowledge inferred from the training data, including the set of associated resources, to a training corpus that can be used to train a machine learning model; the training subsystem training a cognitive model of a workload management component of the DBMS to predict resource requirements of batched data access requests, the training including submitting the training corpus to the cognitive model; Subsystems, including:
2. The features characterizing the first one of the training statements are: an individual token in a set of candidate tokens parsable from the first statement; or individual compile-time characteristics of the first statement as identified by an execution plan generated by a DBMS optimizer component. The subsystem of claim 1 , comprising:
3. and further comprising preprocessing the first statement to identify each occurrence of a first token of the set of candidate tokens in the first statement, the preprocessing comprising: converting all text in the first statement to either uppercase or lowercase; replacing all constants in the predicate of the first statement with parameter markers; removing all schema references and table aliases from the text of the first statement; removing all stop words from the text of said first statement; Parsing a set of tokens from the first statement consisting of all syntactic and semantic keywords contained in the remaining text of the first statement; The subsystem of claim 2 , comprising:
4. constructing a data dictionary that identifies the number of occurrences of each token parsed from the remaining text of any one of the training statements; purging tokens from the data dictionary that are associated with a number of occurrences below a predefined threshold; defining the set of candidate tokens to be equivalent to all tokens remaining in the data dictionary after the elimination; The subsystem of claim 3 further comprising:
5. Training statements are randomly assigned to each training workload, No training statement is assigned to more than one training workload, Each training workload contains the same number of training statements. The subsystem of claim 1 .
6. generating an empty template that does not correspond to any statement in the set of training statements. The subsystem of claim 1 .
7. a first vector of the set of query vectors is assigned to a first template of the set of templates only if a clustering algorithm determines that the magnitude of the distance between the centroid point of the first template and a point located at coordinates defined by all elements of the first vector is less than a predefined threshold; The subsystem of claim 1 .
8. The clustering algorithm generates a clustering model that can intelligently cluster query vectors into templates, and the clustering algorithm includes a k-means clustering algorithm, an Elbow method, or a DBSCAN algorithm. The subsystem of claim 7.
9. each statement in the set of training statements is a data access request previously processed by the DBMS; The subsystem of claim 1 .
10. the cognitive model is a neural network; the training further includes training the neural network to predict types and amounts of production resources required by the DBMS to run a production workload; the production workload comprises a batch of production data access requests; the neural network predicts the type and amount of the production resources by drawing inferences from a histogram derived by the neural network relating the production workload to a distribution of production workload templates in the set of templates and to aggregate resource requirements associated with the production workload templates in the histogram; The subsystem of claim 1 .
11. the cognitive model is a deep learning neural network; The training corpus is a formally structured machine learning corpus that includes a triple store knowledge base that represents knowledge as a set of concepts, rules, and relationships formatted in a triple store data structure; the knowledge includes each statement in the set of training statements, each vector in the set of query vectors, each template in the set of templates, each corresponding histogram, or each set of consumed resources associated with a corresponding histogram; The subsystem of claim 1 .
12. 1. A method of self-learning binned resource optimization for a database management system, comprising: receiving training data from a training subsystem of a database management system (DBMS) including a set of training statements each requesting access to a database managed by the DBMS and a record of the type and amount of resources required by the DBMS to execute each statement in the set of training statements; the training subsystem generating a set of query vectors, each of which identifies a feature that characterizes a corresponding statement in the training statements; the training subsystem assigning the set of query vectors to a set of templates; each vector in the set of query vectors is assigned to one template in the set of templates; each template in the set of templates is populated with a query vector that has a mathematical similarity to each other that exceeds a threshold similarity; the training subsystem dividing the set of training statements into a set of training workloads; each workload in the training workloads is associated with a corresponding histogram; each bin of each corresponding histogram uniquely corresponds to one template from the set of templates; each bin of a first corresponding histogram identifies a number of statements in the corresponding workload of the first corresponding histogram that are associated with each template of the set of templates; the training subsystem associating each corresponding histogram with a set of resources previously consumed by execution of each training statement of the histogram's corresponding training workload; the training subsystem adding knowledge inferred from the training data, including the set of associated resources, to a training corpus that can be used to train a machine learning model; the training subsystem training a cognitive model of a workload management component of the DBMS to predict resource requirements of batched data access requests, the training including submitting the training corpus to the cognitive model; A method comprising:
13. The features characterizing the first one of the training statements are: an individual token in a set of candidate tokens parsable from the first statement; or individual compile-time features in the set of compile-time features of the first statement identified by an execution plan generated by a DBMS optimizer component.
13. The method of claim 12, comprising:
14. Training statements are randomly assigned to each training workload, No training statement is assigned to more than one training workload, Each training workload contains the same number of training statements. The method of claim 12.
15. providing at least one support service for at least one of creating, integrating, hosting, maintaining, and deploying computer-readable program code in a computer system, the computer-readable program code configured in combination with the computer system to perform the receiving, generating, allocating, dividing, associating, adding, and training; The method of claim 12.
16. 1. A computer program for self-learning binned resource optimization for a database management system (DBMS), the computer program being executable by a processor to cause the processor to perform a method for self-learning binned resource optimization for a database management system, the method comprising: receiving training data from a training subsystem of a database management system (DBMS) including a set of training statements each requesting access to a database managed by the DBMS and a record of the type and amount of resources required by the DBMS to execute each statement in the set of training statements; the training subsystem generating a set of query vectors, each of which identifies a feature that characterizes a corresponding statement in the training statements; the training subsystem assigning the set of query vectors to a set of templates; each vector in the set of query vectors is assigned to one template in the set of templates; each template in the set of templates is populated with a query vector that has a mathematical similarity to each other that exceeds a threshold similarity; the training subsystem dividing the set of training statements into a set of training workloads; each workload in the training workloads is associated with a corresponding histogram; each bin of each corresponding histogram uniquely corresponds to one template from the set of templates; each bin of a first corresponding histogram identifies a number of statements in the corresponding workload of the first corresponding histogram that are associated with each template of the set of templates; the training subsystem associating each corresponding histogram with a set of resources previously consumed by execution of each training statement of the histogram's corresponding training workload; the training subsystem adding knowledge inferred from the training data, including the set of associated resources, to a training corpus that can be used to train a machine learning model; the training subsystem training a cognitive model of a workload management component of the DBMS to predict resource requirements of batched data access requests, the training including submitting the training corpus to the cognitive model; a computer program comprising:
17. The features characterizing the first one of the training statements are: an individual token in a set of candidate tokens parsable from the first statement; or individual compile-time characteristics of the first statement as identified by an execution plan generated by a DBMS optimizer component; 17. The computer program of claim 16, comprising:
18. Training statements are randomly assigned to each training workload, No training statement is assigned to more than one training workload, 17. The computer program product of claim 16, wherein each training workload includes the same number of training statements.
19. 1. A database management (DBMS) system including a processor, a memory coupled to the processor, and a computer-readable hardware storage device coupled to the processor, the storage device including program code configured to be executed by the processor via the memory to implement a method for self-learning binned resource optimization for a database management system, the method comprising: receiving, by the DBMS, a set of production statements each requesting access to a database managed by the DBMS and a cognitive model trained to predict resource requirements for the batched data access requests; the DBMS generating a set of query vectors, each vector in the set of query vectors identifies a feature that characterizes a corresponding statement in the set of production statements; each element of a particular vector in the set of query vectors identifies a respective said characteristic of a corresponding statement in the set of production statements; the DBMS assigning each vector of the set of query vectors to a corresponding template of a set of model templates maintained by a clustering model of the cognitive model; the DBMS generating a final production workload iteratively, each iteration comprising: the DBMS adding a next statement selected from the set of production statements to a candidate production workload, the next statement not having been previously added to the candidate production workload; the DBMS attempts to associate the candidate production workload with a candidate histogram, each bin of the candidate histogram identifying the total number of statements in the candidate production workload that are associated with a template uniquely assigned to that bin in the set of model templates; if the candidate production workload can be associated with the candidate histogram, the DBMS predicts, in response to training of the cognitive model, that execution of the candidate production workload will require the same amount and type of resources as the cognitive model, in response to its training, identified as being incurred by executing a workload characterized by the corresponding histogram; if the DBMS determines that execution of the candidate production workload will require more resources than are currently available, the DBMS removing the most recently added statement from the candidate production workload and considering the resulting workload as the final production workload; if it is determined that execution of the candidate production workload does not require more resources than are currently available, the DBMS continues with the next iteration of generating the final production workload; the DBMS transferring the final production workload to a query execution engine of the DBMS for execution by the DBMS; DBMS, including:
20. If a corresponding histogram cannot be derived, the DBMS: identifying the candidate production workload, the most recently added statements, and the candidate histograms against the cognitive model; removing the most recently added statement from the candidate production workload; Continue with the next iteration to generate the final production workload, and 20. The DBMS of claim 19, further comprising:
21. each template in the set of model templates identifies a corresponding cluster of query vectors; The first vector is i) the centroid point of all vectors specified by a particular template in the set of model templates; ii) a point located at coordinates defined by said first vector 20. The DBMS of claim 19, wherein a particular template is assigned if the magnitude of the distance between
22. The first statement of the production statements is characterized by the following features: individual tokens parsable from the first statement; or individual compile-time characteristics of the first statement as identified by an execution plan generated by an optimizer component of the DBMS; 20. The DBMS of claim 19, comprising:
23. 20. The DBMS of claim 19, wherein the candidate production workload is initialized to a set of initial workload requests including at least one pending data access request queued for execution by the DBMS prior to a first iteration that generates a final production workload.
24. a production database management (DBMS) system receiving a set of production statements, each of which requests access to a database managed by the DBMS, and a cognitive model trained to predict resource requirements for the batched data access requests; the DBMS generating a set of query vectors, each vector in the set of query vectors identifies a feature that characterizes a corresponding statement in the set of production statements; each element of a particular vector in the set of query vectors identifies a respective said characteristic of a corresponding statement in the set of production statements; the DBMS assigning each vector of the set of query vectors to a corresponding template of a set of model templates maintained by a clustering model of the cognitive model; the DBMS generating a final production workload iteratively, each iteration comprising: the DBMS adding a next statement selected from the set of production statements to a candidate production workload, the next statement not having been previously added to the candidate production workload; the DBMS attempts to associate the candidate production workload with a candidate histogram, each bin of the candidate histogram identifying the total number of statements in the candidate production workload that are associated with a template uniquely assigned to that bin in the set of model templates; if the candidate production workload can be associated with the candidate histogram, the DBMS predicts, in response to training of the cognitive model, that execution of the candidate production workload will require the same amount and type of resources as the cognitive model, in response to its training, identified as being incurred by executing a workload characterized by the corresponding histogram; if a corresponding histogram can be derived, the DBMS predicts that execution of the candidate production workload will require the same amount and type of resources as the cognitive model identified as being incurred by executing a workload characterized by the corresponding histogram; if the DBMS determines that execution of the candidate production workload will require more resources than are currently available, the DBMS removing the most recently added statement from the candidate production workload and considering the resulting workload as the final production workload; if it is determined that execution of the candidate production workload does not require more resources than are currently available, the DBMS continues with the next iteration of generating the final production workload; the DBMS transferring the final production workload to a query execution engine of the DBMS for execution by the DBMS; A method comprising:
25. for each template in the set of model templates, identifying a corresponding template that includes a cluster of query vectors; The first vector is i) the centroid point of all vectors specified by a particular template in the set of model templates; ii) a point located at coordinates defined by said first vector 25. The method of claim 24, wherein a distance between a particular template and a particular object is assigned to the particular template if the magnitude of the distance between the particular object and the particular object is less than or equal to a predefined threshold.
Citation Information
Patent Citations
Managed Query Service
JP2019534496A
Using Machine Learning to Estimate Query Resource Consumption in MPPDB
US20180314735A1
Information Processing Method and Apparatus
US20190370235A1