Observe and troubleshoot Cloud SQL with AI assistance Stay organized with collections Save and categorize content based on your preferences.
Preview
This feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of theService Specific Terms. You can process personal data for this feature as outlined in theCloud Data Processing Addendum, subject to the obligations and restrictions described in the agreement under which you access Google Cloud. Pre-GA features are available "as is" and might have limited support. For more information, see thelaunch stage descriptions.
This document describes how you can use AI assistance to help you observe and troubleshootyour Cloud SQL resources. You canuse the AI-assisted troubleshooting tools of Cloud SQLandGemini Cloud Assist toimprove query performance andmonitor system performance.
As an early-stage technology, Gemini for Google Cloud products can generate output that seems plausible but is factually incorrect. We recommend that you validate all output from Gemini for Google Cloud products before you use it. For more information, seeGemini for Google Cloud and responsible AI.
Limitations
The following limitations apply to AI-assisted troubleshooting in Cloud SQL:
- For the best results, wait 24 hours after youenable AI-assisted troubleshootingin the Google Cloud console to let Cloud SQL build a baselineof the average performance of your instance, database, and queries.
- AI-assisted troubleshooting isn't supported for the following Cloud SQL configurations:
- Cloud SQL Enterprise edition instances
- Instances that use theold network architecture for Cloud SQL
- Instances inside aVPC Service Controls perimeter
- Instances enabled withAccess Transparency
- Read replica instances
Before you begin
- Ensure that Gemini Cloud Assist is set up for your Google Cloud user account and project.
After you set up Gemini Cloud Assist,you might need to wait five minutes to let the service propagatebefore you can enable AI-assisted troubleshootingin Cloud SQL.
- Ensure that your instance is aCloud SQL Enterprise Plus edition instance.
- Ensure that your Cloud SQL instance is using thenew network architecture.
- Enablequery insights for Cloud SQL Enterprise Plus edition.
Required roles and permissions
To get the permissions that you need to use AI-assisted troubleshooting, ask your administrator to grant you theDatabase insights viewer (roles/databaseinsights.viewer
) IAM role on the project that hosts the Cloud SQL instance. For more information about granting roles, seeManage access to projects, folders, and organizations.
This predefined role contains the permissions required to use AI-assisted troubleshooting. To see the exact permissions that are required, expand theRequired permissions section:
Required permissions
The following permissions are required to use AI-assisted troubleshooting:
databaseinsights.performanceIssues.detect
databaseinsights.performanceIssues.investigate
You might also be able to get these permissions withcustom roles or otherpredefined roles.
Enable AI-assisted troubleshooting
When you enable AI-assisted troubleshooting for your Cloud SQL instance,Cloud SQL can analyze the performance of your databases and detectanomalies in the execution of your queries. When Cloud SQL detectsanomalies in query performance or identifies high systemload, AI-assisted troubleshooting helps you analyze the situation with evidenceand provides recommendations.
To enable AI-assisted troubleshootingfor your Cloud SQL instance, do the following:
In the Google Cloud console, go to theCloud SQL Instances page.
- To open theOverview page of an instance, click the instance name.
- In theConfiguration tile, clickEdit configuration.
- In theCustomize your instance section, expandQuery insights.
- If not already selected, selectEnable Query insights.
- If not already selected, selectEnable Enterprise Plus features.
- SelectEnable AI-assisted troubleshooting.
- ClickSave.
If you enable query insights for Cloud SQL Enterprise Plus edition, then your instance requires a restart. If you enable AI-assisted troubleshooting only, then your instance doesn't require a restart. For more information about enabling query insights for Cloud SQL Enterprise Plus edition, seeUse query insights to improve query performance.
Open Gemini Cloud Assist
To use Gemini Cloud Assist with Cloud SQL,do the following:
In the Google Cloud console, go to theCloud SQL Instances page.
- To open theOverview page of an instance, click the instance name.
- In the navigation pane, selectQuery insights.
- To open theCloud Assist panel, clicksparkOpen or close Gemini AI chat.
- In theCloud Assist panel, enter a prompt that describes the information that you're interested in.
- After you enter the prompt, clicksendSend prompt. Gemini returns a response to your prompt based on information from the last hour.
Improve query performance
Use AI assistance to troubleshoot individual slow queries in Cloud SQLin using theQuery insights dashboard.For more information, seeTroubleshoot slow queries with AI assistance.
You can also use Gemini Cloud Assist to enter prompts to helpyou improve the performance of your queries. Gemini Cloud Assistanswers questions for the selected Cloud SQL instance and database.
Examples of query performance prompts
Prompt | Type of response |
---|---|
What are the top queries by latency in my database? |
|
What is the slowest query in this database instance? | Guidance on how to identify the slowest query by latency. |
Monitor system performance
You can use AI assistance to analyze database load in Cloud SQL from theOverview page or theQuery insights dashboard.For more information, seeTroubleshoot high database load with AI assistance.
You can also use Gemini Cloud Assist to enter prompts to gatherinformation about your system performance. Gemini Cloud Assistanswers questions for the selected Cloud SQL instance.
Examples of system performance prompts
Prompt | Type of response |
---|---|
How many error log entries are there for this database instance in the last 7 days? | Summary of log entries grouped by their severity type.Gemini scopes the response by the time range filterselected in the instance performance chart. |
What was the CPU utilization for this database instance around 2 PM today? | Metrics results in percentage range for CPU utilization within the time interval. |
Get index recommendations
Note: You don't need to enable AI-assisted troubleshooting to obtain indexrecommendations.You can obtain index recommendations from Cloud SQL in query insights.For more information about obtaining index recommendations, seeUse index advisor.
In addition, using Gemini Cloud Assist, you can get moreinformation about how to use indexes in your databases.Gemini Cloud Assist answers questions for theselected Cloud SQL instance.
Examples of index recommendation prompts
Prompt | Type of response |
---|---|
Show index recommendations for queries run in the last 7 days. | Guidance on the types of queries that can benefit from an index. |
Monitor active queries
Note: You don't need to enable AI-assisted troubleshooting to monitoractive queries.Use theQuery insights dashboard to monitor active queries, and if necessary,terminate long-running processes.For more information, seeMonitor active queries.
In addition, using Gemini Cloud Assist, you can enter promptsto find out more information about queries that cause high latency or CPU load.Gemini Cloud Assist answers questions for the selectedCloud SQL instance.
Examples of active query prompts
Prompt | Type of response |
---|---|
What are the top queries currently running in my database? | Guidance on how to find the longest running and most resource-intensive queries. |
What's next
- Learn how towrite better prompts.
- Learn how to use theGemini Cloud Assist panel.
- ReadUse Gemini for AI assistance and development
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-15 UTC.