This document describes how you can use AI assistance to help you monitor and troubleshoot your AlloyDB for PostgreSQL resources. You can use the AI-assisted troubleshooting tools of AlloyDB and Gemini Cloud Assist to improve query performance and monitor system performance.
Limitations
The following limitations apply to AI-assisted troubleshooting in AlloyDB:
- AI-assisted troubleshooting offers valuable insights based on standard PostgreSQL configurations. AlloyDB's unique architecture, including its disaggregated storage, caching, columnar engine, and optimized background processes, means that certain checks and recommendations can differ from actual AlloyDB performance metrics. We recommend that you consider AI-assisted troubleshooting recommendations as starting points and refer to the AlloyDB documentation for definitive guidance.
- For the best results, wait 24 hours after you enable AI-assisted troubleshooting in the Google Cloud console to let AlloyDB build a baseline of the average performance of your instance, database, and queries.
- AI-assisted troubleshooting isn't supported for the following AlloyDB configurations:
- Instances inside a VPC Service Controls perimeter
- Instances enabled with Access Transparency
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 propagate before you can enable AI-assisted troubleshooting in AlloyDB.
Required roles and permissions
To get the permissions that
you need to use AI-assisted troubleshooting,
ask your administrator to grant you the
Database insights viewer (roles/databaseinsights.viewer
) IAM role on the project that hosts the AlloyDB instance.
For more information about granting roles, see Manage 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 the Required 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 with custom roles or other predefined roles.
Enable AI-assisted troubleshooting
When you enable AI-assisted troubleshooting for your AlloyDB instance, AlloyDB can analyze the performance of your databases and detect anomalies in the execution of your queries. When AlloyDB detects anomalies in query performance or identifies high system load, AI-assisted troubleshooting helps you analyze the situation with evidence and provides recommendations.
To enable AI-assisted troubleshooting for your AlloyDB instance, do the following:
In the Google Cloud console, go to the Clusters page.
From the list of clusters and instances, click an instance.
Click Query insights.
Click either Enable or Edit settings.
In the Edit query insights settings tab, select the Enable advanced query insights features for AlloyDB checkbox.
By default, this turns on the AI-assisted troubleshooting checkbox.
Click Save.
For more information about enabling advanced query insights, see Improve query performance using advanced query insights.
Open Gemini Cloud Assist
To use Gemini Cloud Assist with AlloyDB, do the following:
- In the Google Cloud console, go to the Clusters page. Go to Clusters
- From the list of clusters and instances, click an instance.
- Click Query insights.
- To open the Cloud Assist panel, click spark Open or close Gemini AI chat.
- In the Cloud Assist panel, enter a prompt that describes the information that you're interested in.
- After you enter the prompt, click send Send 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 AlloyDB in using the Query insights dashboard. For more information, see Troubleshoot slow queries with AI assistance.
You can also use Gemini Cloud Assist to enter prompts to help you improve the performance of your queries. Gemini Cloud Assist answers questions for the selected AlloyDB 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 AlloyDB from the Overview page or the Query insights dashboard. For more information, see Troubleshoot high database load with AI assistance.
You can also use Gemini Cloud Assist to enter prompts to gather information about your system performance. Gemini Cloud Assist answers questions for the selected AlloyDB 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 filter selected 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
You can obtain index recommendations from AlloyDB in query insights. For more information, see Index advisor overview.
In addition, using Gemini Cloud Assist, you can get more information about how to use indexes in your databases. Gemini Cloud Assist answers questions for the selected AlloyDB 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
Use the Query insights dashboard to monitor active queries, and if necessary, terminate long-running processes. For more information, see Monitor active queries.
In addition, using Gemini Cloud Assist, you can enter prompts to find out more information about queries that cause high latency or CPU load. Gemini Cloud Assist answers questions for the selected AlloyDB 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 to write better prompts.
- Learn how to use the Gemini Cloud Assist panel.
- Read Use Gemini for AI assistance and development