Il consigliere per le istanze Cloud SQL inattive ti aiuta
a rilevare le istanze che potrebbero essere inattive e ti fornisce
approfondimenti e consigli per aiutarti a ridurre i costi. Questa pagina descrive come funziona questo sistema di suggerimenti e come utilizzarlo.
Come funziona
Il motore per suggerimenti istanze Cloud SQL inattive analizza le metriche di utilizzo delle istanze principali più vecchie di 30 giorni. Per ogni istanza, il sistema di raccomandazione
prende in considerazione i valori di determinate metriche
in un periodo di osservazione che copre gli ultimi 30 giorni. Il motore per suggerimenti non
analizza le repliche di lettura.
Se il livello di attività nel periodo di osservazione è inferiore a una determinata soglia, il sistema di suggerimenti stima che l'istanza sia inattiva. I suggerimenti vengono generati ogni 24 ore per l'arresto di queste istanze.
Prezzi
Il motore per suggerimenti istanze Cloud SQL inattive si trova nel livello di prezzo Standard di Recommender.
Prima di iniziare
Prima di poter visualizzare consigli e approfondimenti, procedi nel seguente modo:
Per ottenere le autorizzazioni per visualizzare e utilizzare approfondimenti e consigli,
assicurati di disporre dei ruoli richiesti.
Tasks
Ruoli
Visualizza i suggerimenti
Uno di questi ruoli: recommender.cloudsqlViewer o
cloudsql.viewer.
Applica consigli
Uno di questi ruoli: recommender.cloudsqlAdmin, cloudsql.editor
o cloudsql.admin.
GET https://recommender.googleapis.com/v1beta1/projects/PROJECT-ID/locations/LOCATION/recommenders/google.cloudsql.instance.RECOMMENDER/recommendations
Sostituisci quanto segue:
PROJECT_ID: il tuo ID progetto.
LOCATION: una regione, ad esempio us-central1.
RECOMMENDER: l'ID del motore per suggerimenti come IdleRecommender.
Se il sistema di suggerimenti rileva istanze inattive, le elenca in una
tabella. Ogni riga mostra il nome dell'istanza, un breve consiglio, la posizione e la data dell'ultimo aggiornamento.
Visualizzare approfondimenti e consigli dettagliati
Puoi visualizzare approfondimenti e suggerimenti dettagliati sulle istanze inattive utilizzando la console Google Cloud , gcloud o l'API Recommender.
Console
Per visualizzare gli approfondimenti su un'istanza inattiva utilizzando la consoleGoogle Cloud , fai clic sul pulsante dei suggerimenti nell'elenco delle istanze.
gcloud
Per visualizzare approfondimenti e suggerimenti dettagliati sulle istanze inattive utilizzando gcloud, esegui il comando
gcloud recommender insights list come segue:
gcloud recommender insights list \
--project=PROJECT_ID \
--location=LOCATION \
--insight-type=google.cloudsql.instance.INSIGHT_TYPE
Sostituisci quanto segue:
PROJECT_ID: il tuo ID progetto.
LOCATION: una regione, ad esempio us-central1.
INSIGHT_TYPE: l'ID del tipo di insight come ActivityInsight.
API
Per visualizzare approfondimenti e suggerimenti dettagliati sulle istanze inattive utilizzando l'API Recommendations, chiama il metodo insights.list nel seguente modo:
GET https://recommender.googleapis.com/v1beta1/projects/PROJECT-ID/locations/LOCATION/insightTypes/google.cloudsql.instance.INSIGHT_TYPE/insights
Sostituisci quanto segue:
PROJECT_ID: il tuo ID progetto.
LOCATION: una regione, ad esempio us-central1.
INSIGHT_TYPE: l'ID del tipo di insight come ActivityInsight.
Viene visualizzato un riquadro che mostra approfondimenti sull'istanza inattiva. Vengono fornite le seguenti categorie di informazioni, insieme ad alcuni grafici di supporto.
Campi
Descrizioni e metriche correlate
Utilizzo disco (variazione nei byte)
Utilizzo dei dati in byte. Campionamento eseguito ogni 60 secondi.
Riguarda database/disk/bytes_used.
Utilizzo massimo CPU
L'utilizzo massimo della CPU in percentuale.
Riguarda database/cpu/utilization.
Utilizzo massimo memoria
L'utilizzo massimo della memoria in percentuale.
Riguarda database/memory/utilization.
Numero massimo operazioni di lettura disco
Il numero massimo di operazioni di lettura.
Riguarda database/disk/read_ops_count.
Numero massimo operazioni di scrittura disco
Il numero massimo di operazioni di scrittura.
Riguarda database/disk/write_ops_count.
Date di inizio e fine dell'osservazione
Le date di inizio e fine del periodo di osservazione di 30 giorni.
La seguente tabella elenca l'approfondimento e il consiglio che il sistema di suggerimenti per le istanze inattive di Cloud SQL potrebbe generare per aiutarti a ridurre i costi. I sottotipi
sono visibili in gcloud e nei risultati dell'API.
Insight
Consiglio
L'istanza ha mostrato bassi livelli di attività
durante il periodo di osservazione.
Sottotipo: LOW_ACTIVITY
Esegui un'indagine per verificare se l'istanza può
essere arrestata per ridurre i costi.
Sottotipo: SHUTDOWN_INSTANCE
Applica consigli
Valuta attentamente i consigli e procedi in uno dei seguenti modi:
Per esaminare il consiglio, fai clic su Visualizza istanza.
Nella parte superiore della pagina viene visualizzato un banner con un consiglio.
Potresti scoprire che l'istanza è intenzionalmente inattiva e non devi arrestarla. Se è inattiva inavvertitamente, puoi arrestarla
ed eliminarla. L'arresto di un'istanza sospende i costi dell'istanza. I dati dell'istanza non sono interessati
e continuano a essere applicati addebiti per lo spazio di archiviazione e gli indirizzi IP.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[],[],null,["# Identify idle Cloud SQL instances\n\n\u003cbr /\u003e\n\nMySQL \\| [PostgreSQL](/sql/docs/postgres/recommender-sql-idle \"View this page for the PostgreSQL database engine\") \\| [SQL Server](/sql/docs/sqlserver/recommender-sql-idle \"View this page for the SQL Server database engine\")\n\n\u003cbr /\u003e\n\nThe Cloud SQL idle instance [recommender](/recommender/docs/overview) helps\nyou detect instances that might be idle and provides you\ninsights and recommendations to help you reduce costs. This page describes how\nthis recommender works and how to use it.\n\nHow it works\n------------\n\nThe Cloud SQL idle instance recommender analyzes the usage metrics of primary\ninstances that are older than 30 days. For each instance, the recommender\nconsiders the values of certain [metrics](/monitoring/api/metrics_gcp_c#gcp-cloudsql)\nwithin an observation period spanning the last 30 days. The recommender does not\nanalyze read replicas.\n\nIf the activity level within the observation period is below a certain\nthreshold, the recommender estimates that the instance is idle. Recommendations are\ngenerated every 24 hours for shutting down such instances.\n| **Warning:** It's highly recommended that you evaluate the insights and in-context charts. Consult with the appropriate team to determine whether the flagged instance is inadvertently idle and can be deleted.\n\nPricing\n-------\n\nThe Cloud SQL idle instance recommender is in the *Standard* [Recommender pricing tier](/recommender/pricing).\n\nBefore you begin\n----------------\n\nBefore you can view recommendations and insights, do the following:\n\n- To get the permissions to view and work with insights and recommendations, ensure that you have the required [roles](/sql/docs/mysql/project-access-control#roles).\n\n For more information about roles, see [understanding roles](/iam/docs/understanding-roles) and [granting IAM permissions](/iam/docs/granting-changing-revoking-access).\n-\n\n\n Enable the Recommender API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=recommender.googleapis.com)\n\nList idle Cloud SQL instance recommendations\n--------------------------------------------\n\nYou can list idle instance recommendations by\nusing the Google Cloud console, `gcloud`, or the Recommender API. \n\n### Console\n\nTo list recommendations about idle instances by using the\nGoogle Cloud console, follow these steps:\n\n1. Go to the **Cloud SQL Instances** page.\n\n [Go to Cloud SQL Instances](https://console.cloud.google.com/sql/instances)\n2. Click **View all** on the idle instance recommendations banner.\n\nAlternatively, follow these steps:\n\n1. Go to the **Recommendation Hub**.\n\n [Go to the Recommendation Hub](https://console.cloud.google.com/home/recommendations/)\n\n For more information, see\n [Getting started with Recommendation Hub](/recommender/docs/recommendation-hub/identify-configuration-problems).\n2. In the **Reduce Cloud SQL instance cost** card, click **View all**.\n\n3. Click the **Shut down instance** tab.\n\n### gcloud\n\nTo list recommendations about idle instances by using `gcloud`, run the\n[`gcloud recommender recommendations list`](/sdk/gcloud/reference/recommender/recommendations/list)\ncommand as follows: \n\n```\ngcloud recommender recommendations list \\\n--project=PROJECT_ID \\\n--location=LOCATION \\\n--recommender=google.cloudsql.instance.RECOMMENDER\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: A region, such as `us-central1`.\n- \u003cvar translate=\"no\"\u003eRECOMMENDER\u003c/var\u003e: The ID of the recommender as `IdleRecommender`.\n\n### API\n\nTo list recommendations about idle instances by using the\n[Recommendations API](/recommender/docs/using-api), call the\n[`recommendations.list`](/recommender/docs/reference/rest/v1beta1/projects.locations.recommenders.recommendations/list)\nmethod as follows. \n\n```\nGET https://recommender.googleapis.com/v1beta1/projects/PROJECT-ID/locations/LOCATION/recommenders/google.cloudsql.instance.RECOMMENDER/recommendations\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: A region, such as `us-central1`.\n- \u003cvar translate=\"no\"\u003eRECOMMENDER\u003c/var\u003e: The ID of the recommender as `IdleRecommender`.\n\nIf the recommender detects idle instances, it lists them in a\ntable. Each row shows the instance name, a brief recommendation, the location,\nand the last refresh date.\n\nView insights and detailed recommendations\n------------------------------------------\n\nYou can view insights and detailed recommendations about idle instances by\nusing the Google Cloud console, `gcloud`, or the Recommender API. \n\n### Console\n\nTo view insights about an idle instance by using the\nGoogle Cloud console, click the recommendation button in the list of instances.\n\n### gcloud\n\nTo view insights and detailed recommendations about idle instances by using `gcloud`, run the\n[`gcloud recommender insights list`](/sdk/gcloud/reference/recommender/insights/list)\ncommand as follows: \n\n```\ngcloud recommender insights list \\\n--project=PROJECT_ID \\\n--location=LOCATION \\\n--insight-type=google.cloudsql.instance.INSIGHT_TYPE\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: A region, such as `us-central1`.\n- \u003cvar translate=\"no\"\u003eINSIGHT_TYPE\u003c/var\u003e: The ID of the insight type as `ActivityInsight`.\n\n### API\n\nTo view insights and detailed recommendations about idle instances by using the\n[Recommendations API](/recommender/docs/using-api), call the\n[`insights.list`](/recommender/docs/reference/rest/v1beta1/projects.locations.insightTypes.insights/list)\nmethod as follows: \n\n```\nGET https://recommender.googleapis.com/v1beta1/projects/PROJECT-ID/locations/LOCATION/insightTypes/google.cloudsql.instance.INSIGHT_TYPE/insights\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: A region, such as `us-central1`.\n- \u003cvar translate=\"no\"\u003eINSIGHT_TYPE\u003c/var\u003e: The ID of the insight type as `ActivityInsight`.\n\nA panel appears showing insights about the idle instance. The following\ncategories of information are provided along with some supporting charts.\n\nThe following table lists the insight and recommendation that the Cloud SQL\nidle instance recommender might generate to help you reduce costs. The subtypes\nare visible in the `gcloud` and API results.\n\nApply recommendations\n---------------------\n\nEvaluate the recommendations carefully and do any of the following:\n\n- To examine the recommendation, click **View instance**.\n\n A banner appears at the top of the page providing a recommendation.\n\n You might find that the instance is intentionally idle and you don't need to shut\n it down. If it's inadvertently idle, you can [stop](/sql/docs/mysql/start-stop-restart-instance#stop)\n and [delete](/sql/docs/mysql/delete-instance) the instance. Stopping an\n instance suspends instance charges. The instance data is unaffected,\n and charges for storage and IP addresses continue to apply.\n\n Exercise caution when [stopping](/sql/docs/mysql/start-stop-restart-instance#stop)\n or [deleting](/sql/docs/mysql/delete-instance) an instance. To avoid\n the loss of data, [create a backup](/sql/docs/mysql/backup-recovery/backing-up#on-demand) first.\n- To dismiss the recommendation so that it's de-emphasized and appears dimmed,\n click **Dismiss**.\n\n- To close the panel without applying or dismissing the recommendation, click\n **Cancel**.\n\nYou can also [export these recommendations to BigQuery](/recommender/docs/bq-export/export-recommendations-to-bq)\nand examine them by using [Looker Studio](/bigquery/docs/visualize-looker-studio) or [Looker](/bigquery/docs/looker).\n\nWhat's next\n-----------\n\n- [Monitor disk availability](/sql/docs/mysql/using-ood-recommender)\n- [Reduce overprovisioned Cloud SQL instances](/sql/docs/mysql/recommender-sql-overprovisioned)\n- [Blog: Maximize your Cloud ROI](https://cloud.google.com/blog/products/management-tools/active-assist-comes-to-google-cloud)\n- [Blog: Do more with less](https://cloud.google.com/blog/products/databases/reduce-cloud-sql-costs-with-optimizations-by-active-assist)\n- [Google Cloud recommenders](/recommender/docs/recommenders)"]]