Identify idle Cloud SQL instances

MySQL  |  PostgreSQL  |  SQL Server

The Cloud SQL idle instancerecommender helpsyou detect instances that might be idle and provides youinsights and recommendations to help you reduce costs. This page describes howthis recommender works and how to use it.

How it works

The Cloud SQL idle instance recommender analyzes the usage metrics of primaryinstances that are older than 30 days. For each instance, the recommenderconsiders the values of certainmetricswithin an observation period spanning the last 30 days. The recommender does notanalyze read replicas.

If the activity level within the observation period is below a certainthreshold, the recommender estimates that the instance is idle. Recommendations aregenerated every 24 hours for shutting down such instances.

Warning: It's highly recommendedthat you evaluate the insights and in-context charts. Consult with theappropriate team to determine whether the flagged instance is inadvertently idleand can be deleted.

Pricing

The Cloud SQL idle instance recommender is in theStandardRecommender pricing tier.

Before you begin

Before you can view recommendations and insights, do the following:

  • To get the permissions to view and work with insights and recommendations,ensure that you have the requiredroles.
    TasksRoles
    View recommendations One of these roles:recommender.cloudsqlViewer orcloudsql.viewer.
    Apply recommendations One of these roles:recommender.cloudsqlAdmin,cloudsql.editor, orcloudsql.admin.
    For more information about roles, seeunderstanding roles andgranting IAM permissions.
  • Enable the Recommender API.

    Enable the API

List idle Cloud SQL instance recommendations

You can list idle instance recommendations byusing the Google Cloud console,gcloud, or the Recommender API.

Console

To list recommendations about idle instances by using theGoogle Cloud console, follow these steps:

  1. Go to theCloud SQL Instances page.

    Go to Cloud SQL Instances

  2. ClickView all on the idle instance recommendations banner.

Alternatively, follow these steps:

  1. Go to theRecommendation Hub.

    Go to the Recommendation Hub

    For more information, seeGetting started with Recommendation Hub.

  2. In theReduce Cloud SQL instance cost card, clickView all.

  3. Click theShut down instance tab.

gcloud

To list recommendations about idle instances by usinggcloud, run thegcloud recommender recommendations listcommand as follows:

gcloud recommender recommendations list \--project=PROJECT_ID \--location=LOCATION \--recommender=google.cloudsql.instance.RECOMMENDER

Replace the following:

  • PROJECT_ID: Your project ID.
  • LOCATION: A region, such asus-central1.
  • RECOMMENDER: The ID of the recommender asIdleRecommender.

API

To list recommendations about idle instances by using theRecommendations API, call therecommendations.listmethod as follows.

GET https://recommender.googleapis.com/v1beta1/projects/PROJECT-ID/locations/LOCATION/recommenders/google.cloudsql.instance.RECOMMENDER/recommendations

Replace the following:

  • PROJECT_ID: Your project ID.
  • LOCATION: A region, such asus-central1.
  • RECOMMENDER: The ID of the recommender asIdleRecommender.

If the recommender detects idle instances, it lists them in atable. Each row shows the instance name, a brief recommendation, the location,and the last refresh date.

View insights and detailed recommendations

You can view insights and detailed recommendations about idle instances byusing the Google Cloud console,gcloud, or the Recommender API.

Console

To view insights about an idle instance by using theGoogle Cloud console, click the recommendation button in the list of instances.

gcloud

To view insights and detailed recommendations about idle instances by usinggcloud, run thegcloud recommender insights listcommand as follows:

gcloud recommender insights list \--project=PROJECT_ID \--location=LOCATION \--insight-type=google.cloudsql.instance.INSIGHT_TYPE

Replace the following:

  • PROJECT_ID: Your project ID.
  • LOCATION: A region, such asus-central1.
  • INSIGHT_TYPE: The ID of the insight type asActivityInsight.

API

To view insights and detailed recommendations about idle instances by using theRecommendations API, call theinsights.listmethod as follows:

GET https://recommender.googleapis.com/v1beta1/projects/PROJECT-ID/locations/LOCATION/insightTypes/google.cloudsql.instance.INSIGHT_TYPE/insights

Replace the following:

  • PROJECT_ID: Your project ID.
  • LOCATION: A region, such asus-central1.
  • INSIGHT_TYPE: The ID of the insight type asActivityInsight.

A panel appears showing insights about the idle instance. The followingcategories of information are provided along with some supporting charts.

FieldsDescriptions and related metrics
Disk usage (bytes change)Data utilization in bytes. Sampled every 60 seconds.
Pertains todatabase/disk/bytes_used.
Max CPU utilizationThe maximum CPU utilization as a percentage.
Pertains todatabase/cpu/utilization.
Max memory utilizationThe maximum memory utilization as a percentage.
Pertains todatabase/memory/utilization.
Max disk read ops countThe maximum number of read operations.
Pertains todatabase/disk/read_ops_count.
Max disk write ops countThe maximum number of write operations.
Pertains todatabase/disk/write_ops_count.
Observation start and end datesThe start and end dates of the 30-day observation period.

The following table lists the insight and recommendation that the Cloud SQLidle instance recommender might generate to help you reduce costs. The subtypesare visible in thegcloud and API results.

InsightRecommendation
The instance has shown low levels of activity during the observation period.
Subtype:LOW_ACTIVITY
Investigate to check if the instance can be shut down to reduce costs.
Subtype:SHUTDOWN_INSTANCE

Apply recommendations

Evaluate the recommendations carefully and do any of the following:

  • To examine the recommendation, clickView instance.

    A banner appears at the top of the page providing a recommendation.

    You might find that the instance is intentionally idle and you don't need to shutit down. If it's inadvertently idle, you canstopanddelete the instance. Stopping aninstance suspends instance charges. The instance data is unaffected,and charges for storage and IP addresses continue to apply.

    Exercise caution whenstoppingordeleting an instance. To avoidthe loss of data,create a backup first.

  • To dismiss the recommendation so that it's de-emphasized and appears dimmed,clickDismiss.

  • To close the panel without applying or dismissing the recommendation, clickCancel.

You can alsoexport these recommendations to BigQueryand examine them by usingLooker Studio orLooker.

What's next

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-14 UTC.