What’s new with Cloud SQL for MySQL: Vector search, Gemini support, and more

Cloud SQL for MySQL offers the robust performance, scalability, and reliability businesses need for a wide range of applications. Whether managing complex game data or powering smart home devices, companies like Chess.com and Nest are already leveraging Cloud SQL for MySQL to drive innovation and enhance user experiences, providing a solid foundation for data-driven solutions. With the growing demand of AI capabilities, organizations are looking to leverage AI for their business needs while using the database that already supports their applications. 

To help companies transform their business, we’ve recently announced several new features for Cloud SQL for MySQL, available in Preview, that help companies power their database and applications with AI. We now offer integrated support for vector embedding search to help you build innovative generative AI applications and AI-assistive tools that simplify database management and take performance to the next level with Gemini. Let’s dig in to these new features!

1. Use Vector Search to build generative AI applications and integrate with MySQL

Cloud SQL for MySQL now offers storage and similarity search of vector embeddings, so you can use generative AI in your existing applications. It now provides K-nearest-neighbor (KNN) and approximate-nearest-neighbor (ANN) search between embeddings, all within the MySQL engine. 

LangChain integration for generating vector embeddings

Embedding your data as vectors allows AI systems to interact with it more meaningfully. When embedded as vectors, information is stored efficiently while preserving complexities. This enables AI applications to systematically compare unique data to find similarities. 

LangChain is a popular open-source framework for building applications using large language models (LLMs). The Cloud SQL team built a Vector LangChain package to help with processing data to generate vector embeddings and connect it with your MySQL instance. The integration offers a vector store, document loader, and chat message history.

We have a guide for using vector embeddings in MySQL with LangChain and an end-to-end example on how to generate embeddings of data such as chat histories or large documents, store the embeddings in MySQL, and also search them. 

Power generative AI applications with Vector Search

1 vectordemo-1

Store vector embeddings and query vector distance in MySQL, demo via Cloud SQL Studio.

After storing your embedded data on Cloud SQL for MySQL, computing the vector distance between two embeddings lets you determine how similar two embeddings are. As dimensions and the quantity of data increase, calculating distance between vectors becomes computationally expensive and eventually infeasible. Approximate-nearest-neighbor (ANN) search is used to search for similar vectors in a scalable, accurate way when absolute distance calculation is not an option.

2 vector_nearest-2

Create vector indexes and perform ANN search with the NEAREST function, demo via Cloud SQL Studio.

In addition, Cloud SQL now supports storage and built-in ANN search of vector embeddings in MySQL, powered by Google’s ScaNN library. This eliminates the need for a separate vector-store database, making it easier to build generative AI applications when managing data with Cloud SQL for MySQL.

2. Gemini for optimizing, managing, and debugging your MySQL database

Gemini is now available throughout the database journey. Gemini in Databases helps you manage your fleet of databases across their full lifecycle, from migration to setting up the right security and compliance guardrails to troubleshooting performance issues. Cloud SQL for MySQL has a set of MySQL specific capabilities that help you monitor and analyze database-specific performance and anticipate problems before they cause impact to your applications.

Increase query efficiency with Index Advisor

You can also optimize your MySQL workloads with AI-recommended indexes. Index Advisor identifies queries that contribute to database inefficiency and recommends new indexes to improve them within the Query Insights dashboard. By constantly assessing and identifying sub-optimal queries, Index Advisor can help you notice performance issues before they negatively impact your business. 

After analyzing your workload, Index Advisor shows how to speed up your slow queries by recommending the column(s) to add indexes on, along with an estimate of the index storage size and impact on performance. It makes the optimization process even simpler by providing the exact queries you need to create the recommended index. Get started with Index Advisor by enabling its flag and viewing your query insights.

3 indexadvisor-3

View index recommendations for inefficient queries and the queries you need to create them.

Debug and prevent performance issues with Active Queries

The Query Insights dashboard now offers real-time analysis of active queries on your instance. It provides an overview of the state of all connections as well as a comprehensive report of the top queries currently running on your database. This report includes useful metrics to identify costly transactions, such as the number of rows locked and transaction duration. Active Query’s analysis clarifies what queries are running and their cost, saving you debugging time and effort. 

Alongside active query analysis, you can terminate queries or connections when needed. A centralized dashboard streamlines the process of identifying expensive transactions and terminating them into one, simple step. The query management tools introduced with Active Queries lets you easily identify the source of performance issues and get a birds-eye view of the traffic on your instance to anticipate potential problems. 

Start by viewing your current active queries with these steps.

4 activequeries-4

Analyze traffic and terminate connections with Active Queries.

Monitor and improve database health with MySQL Recommender

With an extensive array of flags and configurations to manage, maintaining the optimal settings on your MySQL instance can be a challenge. This becomes even more difficult when database traffic fluctuates, causing constantly-changing database needs. MySQL Recommender recommends configuration changes to improve performance, strengthen security, and protect data. It also provides an explanation of its recommendation and alternatives to keep the instance in a healthy state when applicable.

MySQL Recommender monitors many database health indicators and settings, serving as a Gemini-powered MySQL expert. For example, it will detect when you are performing a high number of joins without indexes, have a high number of open tables, or are in danger of reaching the maximum number of open connections. MySQL Recommender helps our users diagnose database issues or prevent them by monitoring and maintaining instance health. 

After opting-in to Gemini in Databases, the Recommender will be enabled automatically and you can begin tuning your MySQL configurations.

5 recommender-5

Recommender provides a one-stop solution for identifying and resolving database configuration issues

How to get started

Learn more about how businesses like Manhattan Associates and Songkick are leveraging the benefits of Cloud SQL for MySQL to transform their business.

Start powering your Cloud SQL for MySQL applications with AI with vector search and Gemini in Databases.

To start optimizing your database with Index Advisor, Active Queries, Recommender, and additional features like Database Center and code generation in Studio, check out our guide to getting started with Gemini in Databases.  

Follow our docs on vector search to build generative AI applications on Cloud SQL for MySQL.