Reconfigurer les paramètres des tables temporaires
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
MySQL | PostgreSQL | SQL Server
Cette page explique comment gérer le nombre de tables temporaires. Cet outil de recommandation est appelé Reconfigurer les paramètres des tables temporaires.
Cet outil de recommandation analyse chaque jour le nombre de tables temporaires créées sur le disque par rapport au nombre total de tables temporaires. Si le nombre de tables temporaires créées sur le disque dépasse 20 % du nombre total de tables, cet outil de recommandation vous recommande d'effectuer l'une des opérations suivantes :
Augmenter la valeur de l'option tmp_table_size, de l'option max_heap_table_size ou des deux.
Si les valeurs de max_heap_tmp_table_size et tmp_table_size ne sont pas identiques, augmenter la valeur la plus faible pour qu'elle corresponde à la valeur la plus élevée.
Si les valeurs de max_heap_tmp_table_size et tmp_table_size sont identiques, les augmenter toutes les deux pour obtenir une valeur plus élevée.
Pour savoir comment augmenter la valeur de tmp_table_size, consultez la section concernant tmp_table_size.
Pour obtenir les autorisations permettant d'afficher et d'utiliser les insights et les recommandations, assurez-vous de disposer des rôles IAM (Identity and Access Management) requis.
Dans la bannière Améliorez l'état de l'instance en analysant les problèmes et en agissant sur la base des recommandations, cliquez sur Développer les détails.
GET https://recommender.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/recommenders/google.cloudsql.instance.PerformanceRecommender/recommendations
Remplacez les éléments suivants :
PROJECT_ID : ID de votre projet.
LOCATION : région où se trouvent vos instances, par exemple us-central1.
Afficher les insights et les recommandations détaillées
Pour afficher les insights et les recommandations détaillées, procédez comme suit :
Console
Effectuez l'une des opérations suivantes :
Sur la page Recommandations de performances, cliquez sur la fiche Recommandations de performances, puis sur Reconfigurer les paramètres des tables temporaires.
Le panneau de recommandations s'affiche. Il contient des insights et des recommandations détaillées pour l'instance.
Sur la page Instances, cliquez sur Reconfigurer les paramètres des tables temporaires. La liste n'affiche que les instances pour lesquelles la recommandation s'applique.
LOCATION : région où se trouvent vos instances, par exemple us-central1.
INSIGHT_SUBTYPE : définissez ce paramètre sur l'un des éléments suivants :
MYSQL_HIGH_NUMBER_OF_TMP_TABLE_ON_DISK_TMP_TABLE : affiche des insights sur le nombre total de tables temporaires présentes sur disque pour votre instance.
MYSQL_HIGH_NUMBER_OF_TMP_TABLE_ON_DISK_MAX_HEAP : affiche des insights sur le nombre total de tables temporaires créées par l'utilisateur présentes sur disque pour votre instance.
GET https://recommender.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/insightTypes/google.cloudsql.instance.PerformanceInsight/insights
Remplacez les éléments suivants :
PROJECT_ID : ID de votre projet.
LOCATION : région où se trouvent vos instances, par exemple us-central1.
Appliquer la recommandation
Pour mettre en œuvre cette recommandation, effectuez l'une des opérations suivantes :
Si les valeurs des options max_heap_tmp_table_size et tmp_table_size ne sont pas identiques, augmentez la valeur la plus faible pour qu'elle corresponde à la valeur la plus élevée.
Si les valeurs des options max_heap_tmp_table_size et tmp_table_size sont identiques, augmentez-les toutes les deux pour obtenir des valeurs plus élevées.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[],[],null,["# Reconfigure temporary table settings\n\n\u003cbr /\u003e\n\nMySQL \\| PostgreSQL \\| SQL Server\n\n\u003cbr /\u003e\n\n|\n| **Preview**\n|\n|\n| This feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| You can process personal data for this feature as outlined in the\n| [Cloud Data Processing\n| Addendum](/terms/data-processing-addendum), subject to the obligations and restrictions described in the agreement under\n| which you access Google Cloud.\n|\n| Pre-GA features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nThis page describes how to manage the number of temporary tables. This\n[recommender](/recommender/docs/recommenders) is called **Reconfigure temp table\nsettings**.\n\nEvery day, this recommender analyzes the number of temporary\ntables created on disk compared to the total number of temporary tables. If the\nnumber of temporary tables created on disk is more than 20% of the total\nnumber of tables, then this recommender advises you to do one of the following:\n\n- Increase the value of either the `tmp_table_size` flag or the\n `max_heap_table_size` flag, or both flags.\n\n- If the values for `max_heap_tmp_table_size` and `tmp_table_size` aren't equal,\n then increase the smaller value to match the larger value.\n\n- If the values for `max_heap_tmp_table_size` and `tmp_table_size` are the same,\n increase both of them to a larger value.\n\nFor more information on increasing the value of `tmp_table_size`, see\n[`tmp_table_size`](/sql/docs/mysql/flags#mysql-t).\n\nPricing\n-------\n\nThe **Reconfigure temp table settings** recommender is in the *Standard*\n[Recommender pricing tier](/recommender/pricing).\n\nBefore you begin\n----------------\n\n[Enable the Recommender API](/recommender/docs/enabling).\n\n### Required roles and permissions\n\nTo get the permissions to view and work with insights and recommendations,\nensure that you have the required [Identity and Access Management (IAM) roles](/sql/docs/mysql/project-access-control#roles).\n\nFor more information about IAM roles, see [IAM basic and predefined roles reference](/iam/docs/understanding-roles) and [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\u003cbr /\u003e\n\nList the recommendations\n------------------------\n\nTo list the recommendations, follow these steps: \n\n### Console\n\nTo list recommendations about instance performance, 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)\n\n1. On the **Improve instance health by investigating issues and acting on\n recommendations** banner, click **Expand Details** .\n\nAlternatively, follow these steps:\n\n1. Go to the **Recommendation Hub** . See also [Find and apply recommendations with the Recommendations](/recommender/docs/recommendation-hub/identify-configuration-problems).\n\n [Go to the Recommendation Hub](https://console.cloud.google.com/home/recommendations/)\n2. In the **All recommendations** card, click **Performance** .\n\n### gcloud\n\nRun the [`gcloud recommender recommendations list`](/sdk/gcloud/reference/recommender/recommendations/list) command as follows: \n\n```\ngcloud recommender recommendations list \\\n--project=PROJECT_ID \\\n--location=LOCATION \\\n--recommender=google.cloudsql.instance.PerformanceRecommender \\\n--filter=recommenderSubtype=MYSQL_RECONFIG_TMP_TABLES\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 where your instances are located, such as `us-central1`\n\n### API\n\nCall the [`recommendations.list`](/recommender/docs/reference/rest/v1/projects.locations.recommenders.recommendations/list) method as follows: \n\n```\nGET https://recommender.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/recommenders/google.cloudsql.instance.PerformanceRecommender/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 where your instances are located, such as `us-central1`\n\nView insights and detailed recommendations\n------------------------------------------\n\nTo view insights and detailed recommendations, follow these steps: \n\n### Console\n\nDo one of the following:\n\n- On the **Performance Recommendations** page, click the **Performance\n recommendations** card and then click **Reconfigure temp table settings**.\n The recommendation panel appears, which contains insights and detailed\n recommendations for the instance.\n\n- On the **Instances** page, click **Reconfigure temp table settings**. The\n list of instances displays only those instances for which the\n recommendation applies.\n\n### gcloud\n\nRun the [`gcloud recommender insights list`](/sdk/gcloud/reference/recommender/insights/list) command as follows: \n\n```\n\ngcloud recommender insights list \\\n--project=PROJECT_ID \\\n--location=LOCATION \\\n--insight-type=google.cloudsql.instance.PerformanceInsight \\\n--filter=insightSubtype=INSIGHT_SUBTYPE\n\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 where your instances are located, such as `us-central1`\n- \u003cvar translate=\"no\"\u003eINSIGHT_SUBTYPE\u003c/var\u003e: set this parameter to one of the following:\n - `MYSQL_HIGH_NUMBER_OF_TMP_TABLE_ON_DISK_TMP_TABLE`: display insights for the total number of temporary tables on disk for your instance\n - `MYSQL_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\n\n### API\n\nCall the [`insights.list`](/recommender/docs/reference/rest/v1/projects.locations.insightTypes.insights/list) method as follows: \n\n```\n\nGET https://recommender.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/insightTypes/google.cloudsql.instance.PerformanceInsight/insights\n\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 where your instances are located, such as `us-central1`\n\nApply the recommendation\n------------------------\n\nTo implement this recommendation, do one of the following:\n\n- If the values for the`max_heap_tmp_table_size` and `tmp_table_size` flags are\n not equal, then increase the smaller value to match the larger value.\n\n- If the values for the`max_heap_tmp_table_size` and `tmp_table_size` flags are\n the same, increase both of them to larger values.\n\n| **Note:** Increasing `tmp_table_size` and `max_heap_tmp_table_size` requires more memory. After increasing these flags, monitor the memory usage.\n\nWhat's next\n-----------\n\n- [Google Cloud recommenders](/recommender/docs/recommenders)"]]