Use the AlloyDB for PostgreSQL index advisor with query insights
Stay organized with collections
Save and categorize content based on your preferences.
This page describes how you can use the AlloyDB for PostgreSQL index advisor with
query insights.
You can use the index advisor with query insights to view index advisor
recommendations and create recommended indexes to improve query performance.
To learn more about the index advisor, see
Index advisor overview.
To learn how to use the index advisor to view and query recommendations
as a table, or to request an on-demand analysis and report, see
Use the index advisor.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-26 UTC."],[[["\u003cp\u003eThis page outlines how to use the AlloyDB for PostgreSQL index advisor in conjunction with query insights to optimize query performance by viewing and implementing index recommendations.\u003c/p\u003e\n"],["\u003cp\u003eYou can manage index advisor recommendations by enabling or disabling them and adjusting the refresh frequency within the Query Insights settings of your AlloyDB cluster.\u003c/p\u003e\n"],["\u003cp\u003eThe index advisor provides insights such as performance impact, tables impacted, estimated storage needed, and number of impacted queries for each recommendation, which are all located in the \u003cstrong\u003eQueries\u003c/strong\u003e section of the \u003cstrong\u003eTop dimensions by database load\u003c/strong\u003e table.\u003c/p\u003e\n"],["\u003cp\u003eYou can directly copy and execute the \u003ccode\u003eCREATE INDEX\u003c/code\u003e commands generated by the index advisor to create the recommended indexes, which will be found after clicking \u003cstrong\u003eCreate Indexes\u003c/strong\u003e for a given query.\u003c/p\u003e\n"],["\u003cp\u003eAccessing the index advisor recommendations and editing its settings requires specific permissions, such as the Basic viewer or Database Insights viewer roles, that can be granted by an administrator.\u003c/p\u003e\n"]]],[],null,["# Use the AlloyDB for PostgreSQL index advisor with query insights\n\nThis page describes how you can use the AlloyDB for PostgreSQL index advisor with\nquery insights.\n\nYou can use the index advisor with query insights to view index advisor\nrecommendations and create recommended indexes to improve query performance.\nTo learn more about the index advisor, see\n[Index advisor overview](/alloydb/docs/index-advisor-overview).\n\nYou can use Gemini Cloud Assist to help you monitor and troubleshoot\nyour AlloyDB resources. For more information, see\n[Monitor and troubleshoot with Gemini assistance](/alloydb/docs/monitor-troubleshoot-with-gemini).\n\nTo learn how to use the index advisor to view and query recommendations\nas a table, or to request an on-demand analysis and report, see\n[Use the index advisor](/alloydb/docs/use-index-advisor).\n\nBefore you begin\n----------------\n\nTo access the query insights dashboard,\n[enable access to AlloyDB in your\nGoogle Cloud project](/alloydb/docs/project-enable-access).\n\n### Required roles\n\nTo use the AlloyDB index advisor, you need permissions to do the\nfollowing:\n\n- To access index recommendations, you need permissions to access the AlloyDB query insights dashboard.\n- To edit the index advisor settings, you need permissions to update AlloyDB instances.\n\nTo get these permissions, ask your administrator to grant you one of the\nfollowing roles:\n\n- Basic viewer (`roles/viewer`)\n- Database Insights viewer (`roles/databaseinsights.viewer`)\n\nFor more information about granting roles, see\n[Manage access](/iam/docs/granting-changing-revoking-access).\n\nDisable index advisor recommendations\n-------------------------------------\n\nTo disable index advisor recommendations, follow these steps:\n\n1. In the Google Cloud console, go to the **Clusters** page.\n\n [Go to Clusters](https://console.cloud.google.com/alloydb/clusters)\n2. From the list of clusters and instances, click an instance.\n\n3. Click **Query Insights**.\n\n4. Click **Edit settings**.\n\n5. Disable the index advisor recommendations by deselecting **Enable\n recommendations**. Index advisor recommendations are enabled by default.\n\nChange the refresh frequency for index advisor recommendations\n--------------------------------------------------------------\n\nTo change the refresh frequency, follow these steps:\n\n1. In the Google Cloud console, go to the **Clusters** page.\n\n [Go to Clusters](https://console.cloud.google.com/alloydb/clusters)\n2. From the list of clusters and instances, click an instance.\n\n3. Click **Query insights**.\n\n4. Click **Edit settings**.\n\n5. Increase or decrease the refresh frequency for index advisor\n recommendations. The default refresh frequency is every 24 hours.\n\nView and filter the index advisor recommendations\n-------------------------------------------------\n\n1. In the Google Cloud console, go to the **Clusters** page.\n\n [Go to Clusters](https://console.cloud.google.com/alloydb/clusters)\n2. From the list of clusters and instances, click an instance.\n\n3. Click **Query insights** . The index advisor recommendations are displayed in\n the **Recommendations** column of the **Top dimensions by database load**\n table.\n\n4. (Optional) To view only queries with CREATE INDEX recommendations, add a\n filter for **Recommendation: Create Indexes**.\n\nView recommendations for a query\n--------------------------------\n\nTo view details of index recommendations for a specific query, follow these\nsteps:\n\n1. In the Google Cloud console, go to the **Clusters** page.\n\n [Go to Clusters](https://console.cloud.google.com/alloydb/clusters)\n2. From the list of clusters and instances, click an instance.\n\n3. Click **Query insights**.\n\n4. In the **Top dimensions by database load** table, click **Queries**.\n\n5. To learn recommendation details about a query, do one of the following:\n\n - Click a query to learn more about recommendations for the selected query, including the following information:\n - **Performance impact** (high, medium, and low): The estimated query speed after all recommended indexes are created.\n - **Recommendations**: Create index recommendations.\n - **Tables impacted**: The number of tables that will be impacted when indexes are created.\n - **Additional estimated storage needed**: The estimated storage size needed to create all the recommended indexes.\n - **Number of impacted queries**: The total number of queries in the workload impacted by the index recommendations. An index may benefit multiple queries.\n - Click **Create Indexes** for a specific query to learn detailed recommendations about creating indexes to improve query performance.\n\nView impacted queries\n---------------------\n\n1. In the Google Cloud console, go to the **Clusters** page.\n\n [Go to Clusters](https://console.cloud.google.com/alloydb/clusters)\n2. From the list of clusters and instances, click an instance.\n\n3. Click **Query insights**.\n\n4. In the **Top dimensions by database load** table, click **Queries**.\n\n5. Click **Create indexes** for a specific query.\n\n6. Click **Show impacted queries**.\n\n7. Click a query to learn details about the impacted query.\n\nCreate recommended indexes\n--------------------------\n\n1. In the Google Cloud console, go to the **Clusters** page.\n\n [Go to Clusters](https://console.cloud.google.com/alloydb/clusters)\n2. From the list of clusters and instances, click an instance.\n\n3. Click **Query insights**.\n\n4. In the **Top dimensions by database load** table, click **Queries**.\n\n5. Click **Create Indexes** for a specific query.\n\n6. Click **Copy all index commands**. The CREATE INDEX commands are copied\n to your clipboard.\n\n7. Connect to the primary instance on the command line.\n\n8. To create the recommended indexes, run the commands that were copied to\n your clipboard, for example:\n\n ```sql\n CREATE INDEX ON \"public\".\"demo_order\" (\"customer_id\");\n ```\n\nWhat's next\n-----------\n\n- Learn how to [use the index advisor](/alloydb/docs/use-index-advisor) to view and query recommendations as a table, or to request an on-demand analysis and report.\n- Learn how [AlloyDB helps make smart indexes](https://cloud.google.com/blog/products/databases/how-the-alloydb-index-advisor-helps-make-smart-indexes)."]]