How to use AI to optimize queries and automate resource management

By | 3 minute read | June 19, 2020

As companies progress on their Journey to AI, there is considerable focus on what needs to be available to build AI driven applications. The rungs of the AI ladder, which are best described as Collect, Organize, Analyze, Infuse, and Modernize are designed to strengthen a company’s use of AI. However, the individual impact of AI on each rung should not be overlooked. AI can be both the goal and the means of achieving that goal

Take the collect rung, which represents hybrid data management, as an example. A database should be built for AI with support for popular language use, natural language querying, graph, and blockchain. But it should also be powered by AI to optimize data management for greater efficiency and performance. The eBook, “Db2 – The AI Database” covers eight technologies that make a database built for AI and powered by AI. Two “powered by AI” technologies, Adaptive workload management and resource optimization as well as machine learning query optimization are covered in greater detail below.

Adaptive workload management and resource optimization

Adaptive workload management was created to more intelligently allocate data resources across workloads either automatically or by providing an alert based on the business’s preference. Machine learning is an integral part of this process, monitoring expected and actual runtimes so that predictions for future workloads can be made and resources can be adjusted accordingly. If it is likely that an issue will occur, adaptive workload management can notify users of the finding or automatically take steps to correct the problem.

This is in contrast to previous techniques for allocating resource allocation where a pre-determined limit for workload number or size was set by users. These limits would then need to be monitored and regularly adjusted manually in an attempt to keep at top efficiency. IBM testing has found the better utilization possible with adaptive workload management to result in database performance improvements up to 30 percent.

This is partially due to the fact that it takes the previously highly manual and labor-intensive process of tuning and helps automate it. DBAs can use more of their time on value-additive activities rather than maintenance. It also helps avoid under-utilization of assets and performance issues or failures that may occur due to human error.

Machine learning query optimization

Additional optimization can be gained by applying machine learning to how queries are run. Traditionally, cost-based optimizers have been used. They worked well to recommend the fastest execution strategy in some cases, but weren’t great at understanding recent database changes and had no way to learn from experience. It would suggest the same strategy even if it hadn’t worked optimally on the previous occasion.

Machine learning query optimization changes this by learning from actual query performance and iterating on the suggestion it makes for which path the query should take. In this way, it mimics neural network patterns to learn from experience.

For example, a cost optimizer looking at four tables may suggest joining two pairs of tables together and then joining the results of those joins together. Machine learning query optimization could learn that this isn’t optimal and suggest joining two tables, then a third to the result, followed by a fourth to the result of that. IBM Internal testing has found that machine learning query optimization has resulted in some queries being completed 8-10 times faster.

In addition, as with adaptive workload management, the time that would have been spent by a DBA to monitor performance and make corrections can be put towards things that provide additional value.

Acquiring the AI needed to optimize data management

Companies looking to infuse AI throughout their organization, or those simply looking to optimize their information architecture, need to start with data management. IBM Db2 is a database built for AI, with capabilities powered by AI, that enable businesses to do both.

Adaptive workload management and machine learning query optimization are both core components of IBM’s data management strategy anchored by IBM Db2, which is available on premises, in the cloud and on IBM Cloud Pak for Data, which is built on Red Hat OpenShift Container Platform.

To learn more about technologies IBM uses to deliver data management that’s both powered by AI and built for AI read our latest eBook, “Db2 – The AI Database.” It has more information on adaptive workload management, machine learning query optimization, and six additional features positioned to help you succeed on the Journey to AI.

Read the AI Database eBook

Got Questions? Ask our Experts!

Schedule a free one-on-one consultation with our experienced data professionals and distinguished engineers who have helped thousands of clients build winning data management strategies.