Create indexes or reconfigure join settings

This page describes how to manage the number of joins without indexes in your instance's join buffer. This recommender is called Create indexes or reconfigure join settings.

Every day, this recommender monitors the number of joins without indexes in the join buffer. The join buffer is a per-connection memory buffer used for storing data during join operations that cannot use indexes. If the aggregated number of joins without indexes is greater than 500 per hour, then it recommends to create an index or increase the value of join_buffer_size.

For more information on increasing the value of join_buffer_size, see Other memory consumption.

Pricing

The Create indexes or reconfigure join settings recommender is in the Standard Recommender pricing tier.

Before you begin

Enable the Recommender API.

Required roles and permissions

To get the permissions to view and work with insights and recommendations, ensure that you have the required Identity and Access Management (IAM) roles.

Task Role
View recommendations recommender.cloudsqlViewer or cloudsql.admin
Apply recommendations cloudsql.editor or cloudsql.admin
For more information about IAM roles, see IAM basic and predefined roles reference and Manage access to projects, folders, and organizations.

List the recommendations

To list the recommendations, follow these steps:

Console

To list recommendations about instance performance, follow these steps:

  1. Go to the Cloud SQL Instances page.

Go to Cloud SQL Instances

  1. On the Improve instance health by investigating issues and acting on recommendations banner, click Expand Details.

Alternatively, follow these steps:

  1. Go to the Recommendation Hub. See also Find and applyrecommendations with the Recommendations.

    Go to the Recommendation Hub

  2. In the All recommendations card, click Performance .

gcloud

Run the gcloud recommender recommendations list command as follows:

gcloud recommender recommendations list \
--project=PROJECT_ID \
--location=LOCATION \
--recommender=google.cloudsql.instance.PerformanceRecommender \
--filter=recommenderSubtype=MYSQL_CREATE_INDEX_OR_RECONFIG_JOIN_BUFFER

Replace the following:

  • PROJECT_ID: your project ID
  • LOCATION: a region where your instances are located, such as us-central1

API

Call the recommendations.list method as follows:

GET https://recommender.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/recommenders/google.cloudsql.instance.PerformanceRecommender/recommendations

Replace the following:

  • PROJECT_ID: your project ID
  • LOCATION: a region where your instances are located, such as us-central1

View insights and detailed recommendations

To view insights and detailed recommendations, follow these steps:

Console

Do one of the following:

  • On the Performance Recommendations page, click the Performance recommendations card and then click Create indexes or reconfigure join settings. The recommendation panel appears, which contains insights and detailed recommendations for the instance.

  • On the Instances page, click Create indexes or reconfigure join settings. The list of instances displays only those instances for which the recommendation applies.

gcloud

Run the gcloud recommender insights list command as follows:


gcloud recommender insights list \
--project=PROJECT_ID \
--location=LOCATION \
--insight-type=google.cloudsql.instance.PerformanceInsight \
--filter=insightSubtype=MYSQL_HIGH_JOINS_WITHOUT_INDEXES

Replace the following:

  • PROJECT_ID: your project ID
  • LOCATION: a region where your instances are located, such as us-central1

API

Call the insights.list method as follows:


GET https://recommender.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/insightTypes/google.cloudsql.instance.PerformanceInsight/insights

Replace the following:

  • PROJECT_ID: your project ID
  • LOCATION: a region where your instances are located, such as us-central1

Apply the recommendation

To implement this recommendation, do the following:

  • Create appropriate indexes in your instance to prevent a large number of joins without indexes.

  • If you are not able to create indexes for the joins, increase the value of join_buffer_size until the recommendation disappears. The join buffer can be increased by session or globally. We recommend that you increase the join buffer in the session where there are a large number of joins.

    For more information on increasing the value of join_buffer_size, see Other memory consumption.

What's next