This page describes how to manage the number of temporary tables. This recommender is called Reconfigure temp table settings.
Every day, this recommender analyzes the number of temporary tables created on disk compared to the total number of temporary tables. If the number of temporary tables created on disk is more than 20% of the total number of tables, then this recommender advises you to do one of the following:
Increase the value of either the
tmp_table_size
flag or themax_heap_table_size
flag, or both flags.If the values for
max_heap_tmp_table_size
andtmp_table_size
aren't equal, then increase the smaller value to match the larger value.If the values for
max_heap_tmp_table_size
andtmp_table_size
are the same, increase both of them to a larger value.
For more information on increasing the value of tmp_table_size
, see
tmp_table_size
.
Pricing
The Reconfigure temp table settings recommender is in the Standard Recommender pricing tier.
Before you begin
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
|
List the recommendations
To list the recommendations, follow these steps:
Console
To list recommendations about instance performance, follow these steps:
- Go to the Cloud SQL Instances page.
- On the Improve instance health by investigating issues and acting on recommendations banner, click Expand Details .
Alternatively, follow these steps:
Go to the Recommendation Hub. See also Find and apply recommendations with the Recommendations.
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_RECONFIG_TMP_TABLES
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 Reconfigure temp table settings. The recommendation panel appears, which contains insights and detailed recommendations for the instance.
On the Instances page, click Reconfigure temp table 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=INSIGHT_SUBTYPE
Replace the following:
- PROJECT_ID: your project ID
- LOCATION: a region where your instances are located, such as
us-central1
- INSIGHT_SUBTYPE: set this parameter to one of the following:
MYSQL_HIGH_NUMBER_OF_TMP_TABLE_ON_DISK_TMP_TABLE
: display insights for the total number of temporary tables on disk for your instanceMYSQL_HIGH_NUMBER_OF_TMP_TABLE_ON_DISK_MAX_HEAP
: display insights for the total number of user-created temporary tables on disk for your instance
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 one of the following:
If the values for the
max_heap_tmp_table_size
andtmp_table_size
flags are not equal, then increase the smaller value to match the larger value.If the values for the
max_heap_tmp_table_size
andtmp_table_size
flags are the same, increase both of them to larger values.