On May 31, 2022, IBM released its latest and greatest model of the mainframe, the IBM z16. And there was a lot of good “stuff” that came with that announcement, so much so that other things announced the same day were a bit overshadowed… like Db2 13 for z/OS!
This is unfortunate for many reasons. First of all, it is the first new version of Db2 in a long time. IBM switched to a continuous delivery model with Db2 12 for z/OS, which has been generally available since 2016. And so it makes sense that there would be fewer new versions because new capabilities were regularly added to Db2 via function levels. Nevertheless, it would have been nice for IBM to make a big deal about Db2 13… at least for long-time users.
But there is also a lot of new functionality worth promoting and learning in this new version! Perhaps the biggest new capability in Db2 13 for z/OS is SQL Data Insights. This feature delivers new AI functions built right into Db2 and accessible using Db2 SQL queries. By combining deep learning in AI with the new IBM Z processor, SQL Data Insights enables users to write SQL-based semantic queries on their Db2 tables and views.
Let’s face it, though, there is a lot of noise “out there” about AI and machine learning and deep learning, but very little actually being delivered as a core function at the DBMS level. But SQL Data Insights is a built-in capability of Db2 delivered with the new release at no additional cost. Because it is part of Db2, there is no need to move data around (such as with ETL) before you can perform AI functions on it. The data lives on the mainframe, Db2 lives on the mainframe, and the AI delivered with SQL Data Insights is part of Db2!
SQL Data Insights should be helpful to organizations looking to uncover heretofore unknown relationships in their data. And because it uses built-in functions, you can use it anywhere you use SQL!
From a developer perspective, the basic functionality of SQL Data Insights is delivered via three new built-in functions:
The first function, AI_SIMILARITY, is used to compute score that can be used to compare comparing data for similarity. For example, you could specify a customer and ask Db2 to return other customers that are most similar to it; or most dissimilar. And that can be quite useful for organizations looking to improve their understanding of their market and customers. And this is just one use case. Any data stored in Db2 is fair game.
Another new function delivered with SQL Data Insights in AI_SEMANTIC_CLUSTER. This function computes a semantic clustering score of a member argument against a set of clustering arguments. For example, you could specify a set of customers and ask Db2 to return other customers that best belong to that set.
And finally, we have the AI_ANALOGY function, which computes an analogy score between two sets of values. This function works like an analogy: A:B as X:?. You can use analogy queries to determine whether a relationship between a pair of entities applies to a second pair of entities. For example, if a customer prefers certain products, can we find another customer with a similar preference perhaps for other products?
Keep in mind that SQL Data Insights is free with Db2 13, but it is also optional, so it must be installed before you can use it. Furthermore, before any of these AI functions can be used, it is necessary to first train an AI model by collecting key statistics and building metric scores for the functions to use. An embedded Apache Spark cluster is used for training the machine learning model during the AI query enablement process. If you have ever built such AI models you will know that the process can be lengthy and consume a lot of CPU resources. Fortunately, zIIPs can be used to build the models.
So, there will be some work to do before you can start using the AI capabilities of SQL Data Insights. The manuals use the term “enabling an AI query” and it is relatively easy to request a table or view to be made ready for use with the AI query functions. After the object has been added, you can further refine your request, choosing columns to include and exclude as needed, filtering out any values not needed, and then enabling the query. But as the enabling process involves training a machine learning model and loading the model into Db2, it can take some time before the data can be queried. But it can all be queried right there on the mainframe, where the data lives!
The Bottom Line
With SQL Data Insights and Db2 13 you can extend your queries into the realm of AI, which is exciting because it can help you gather heretofore undiscovered insight into your data.
Of course, this is a high-level overview of SQL Data Insights. Consult the Db2 documentation for details on requirements, installation, enabling queries, and the actual formulation of queries using these functions.