Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
MySQL | PostgreSQL | SQL Server
Il motore per suggerimenti per i numeri elevati di tabelle in Cloud SQL ti aiuta a rilevare le istanze
il cui conteggio delle tabelle è troppo elevato e vicino al limite dello SLA. Fornisce poi consigli
su come ottimizzare queste istanze e migliorarne il rendimento.
Questa pagina descrive il funzionamento del suggeritore per un numero elevato di tabelle e come puoi utilizzarlo.
Come funziona
Se hai 50.000 o più tabelle di database su una singola istanza, l'istanza potrebbe non rispondere o non essere in grado di eseguire operazioni di manutenzione e non è coperta dallo SLA.
Il motore per suggerimenti per i numeri elevati di tabelle in Cloud SQL analizza le metriche per il numero
di tabelle in un'istanza Cloud SQL MySQL. Se il numero di tabelle è superiore o
uguale all'80% del limite dello SLA, che consente 50.000 tabelle, l'istanza viene considerata
con un numero elevato di tabelle.
Prezzi
Il motore per suggerimenti per i numeri elevati di tabelle aperte in Cloud SQL 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.
Elenco dei consigli per migliorare il rendimento dell'istanza
Puoi elencare i suggerimenti per migliorare le prestazioni delle istanze utilizzando la console Google Cloud , gcloud CLI o l'API Recommender.
I suggerimenti per migliorare il rendimento delle istanze vengono visualizzati solo se hai istanze che
si stanno avvicinando ai limiti delle soglie di rendimento.
Console
Per elencare i consigli sul rendimento dell'istanza utilizzando la console
Google Cloud , segui questi passaggi:
Nella scheda Migliora le prestazioni dell'istanza Cloud SQL, fai clic su Visualizza tutto.
Seleziona le istanze con il consiglio Gestisci un numero elevato di tabelle.
Interfaccia a riga di comando gcloud
Per elencare i consigli per migliorare il rendimento delle istanze utilizzando gcloud CLI, esegui il comando
gcloud recommender recommendations list come segue:
Per elencare i consigli per migliorare il rendimento dell'istanza utilizzando l'API Recommendations, chiama il metodo recommendations.list nel seguente modo:
GET https://recommender.googleapis.com/v1beta1/projects/PROJECT-ID/locations/LOCATION/recommenders/google.cloudsql.instance.PerformanceRecommender.MySqlHighNumberOfTablesBestPractice/recommendations
Sostituisci quanto segue:
PROJECT_ID: il tuo ID progetto.
LOCATION: una regione, ad esempio us-central1.
Se il sistema di suggerimenti rileva istanze con un numero elevato di tabelle, le elenca in una
tabella con altri consigli sul rendimento.
Ogni riga mostra l'ID istanza, un breve consiglio, il motore del database, la posizione e la data dell'ultimo aggiornamento.
Visualizzare approfondimenti e consigli dettagliati
Puoi visualizzare approfondimenti e suggerimenti dettagliati sulle istanze
con un numero elevato di tabelle utilizzando la console Google Cloud ,
gcloud CLI o l'API Recommender.
Console
Per visualizzare approfondimenti e consigli dettagliati sulle istanze che si avvicinano alla soglia di rendimento utilizzando la console Google Cloud , fai clic sul link del consiglio nell'elenco delle istanze.
Interfaccia a riga di comando gcloud
Per visualizzare approfondimenti e consigli dettagliati sulle istanze che si avvicinano alla soglia di rendimento utilizzando gcloud CLI, esegui il comando
gcloud recommender insights list come segue:
Per visualizzare approfondimenti e suggerimenti dettagliati sulle istanze che si avvicinano alla soglia di rendimento
utilizzando l'API Recommendations,
chiama il metodo insights.list come segue:
GET https://recommender.googleapis.com/v1beta1/projects/PROJECT-ID/locations/LOCATION/insightTypes/google.cloudsql.instance.PerformanceRecommender.MySqlHighNumberOfTables/insights
Sostituisci quanto segue:
PROJECT_ID: il tuo ID progetto.
LOCATION: una regione, ad esempio us-central1.
La tabella seguente elenca l'approfondimento e il suggerimento generati dal motore per suggerimenti per i numeri elevati di tabelle aperte in Cloud SQL per aiutarti a migliorare il rendimento.
I sottotipi sono visibili nei risultati dell'API e in gcloud CLI.
Insight
Consiglio
Il numero di tabelle su questa istanza è superiore o uguale all'80% del limite dello SLA, che corrisponde a 50.000 tabelle.
Sottotipo: MYSQL_HIGH_NUMBER_OF_TABLES
Migliora le prestazioni dell'istanza Cloud SQL riducendo il numero di tabelle.
Sottotipo: MYSQL_HIGH_NUMBER_OF_TABLES_BEST_PRACTICE
Applica consigli
Valuta attentamente i consigli e procedi in uno dei seguenti modi:
Per ignorare il consiglio in modo che venga messo in secondo piano e visualizzato in grigio,
fai clic su Ignora.
Per chiudere il riquadro senza applicare o ignorare il consiglio, fai clic su
Annulla.
Ottimizzare il rendimento dell'istanza
Modifica l'istanza per aumentare il numero di vCPU
ad almeno 32 core e la dimensione della memoria ad almeno 200 GB.
In questo modo, il limite delle tabelle dell'istanza viene aumentato da 50.000 a 500.000.
Elimina le tabelle non necessarie:
DROP TABLE TABLE_NAME;
Sostituisci quanto segue:
TABLE_NAME: il nome della tabella che intendi eliminare.
Riduci il numero di tabelle per istanza dividendo il database in più istanze per mantenere il numero di tabelle in ciascuna istanza entro i limiti consigliati.
Se non puoi ridurre immediatamente il numero di tabelle, puoi ridurre la probabilità
che la tua istanza sia interessata dall'elevato numero di tabelle
impostando il flag innodb_file_per_table su OFF. Per disattivare il valore del
flag innodb_file_per_table, consulta Configurare un flag di database.
Tuttavia, questa impostazione non ripristina la conformità dell'istanza allo SLA.
Consulta queste linee guida operative.
[[["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,["# Manage high number of tables\n\n\u003cbr /\u003e\n\nMySQL \\| PostgreSQL \\| SQL Server\n\n\u003cbr /\u003e\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| 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\nThe Cloud SQL high-number-of-tables [recommender](/recommender/docs/overview) helps you detect instances\nwhose table count is too high and close to the SLA limit. It then provides recommendations\non how to optimize such instances and improve instance performance.\n\nThis page describes how the high-number-of-tables recommender works and how\nyou can use it.\n\nHow it works\n------------\n\nIf you have 50,000 or more database tables on a single instance, it could result\nin the instance becoming unresponsive or unable to perform maintenance operations,\nand the instance is not covered by the SLA.\n\nThe Cloud SQL high-number-of-tables recommender analyzes metrics for the number\nof tables on a Cloud SQL MySQL instance. If the number of tables is larger than or\nequal to 80% of the SLA limit, which allows for 50,000 tables, the instance is considered\nto have a high number of tables.\n| **Note:** Recommendations are generated daily.\n\nPricing\n-------\n\nThe Cloud SQL high-number-of-open-tables 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 Improve Instance Performance recommendations\n-------------------------------------------------\n\nYou can list the Improve Instance Performance recommendations by\nusing the Google Cloud console, [gcloud CLI](/sdk/gcloud), or the Recommender API.\n\nThe improve instance performance recommendations are shown only if you have instances that\nare nearing performance threshold limits. \n\n### Console\n\nTo list recommendations about instance performance 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 Manage high number of tables recommendations banner.\n\nAlternatively, follow these steps:\n\n1. Go to the **Recommendation Hub** . See also [Getting started with Recommendation Hub](/recommender/docs/recommendation-hub/identify-configuration-problems).\n\n [Go to the Recommendation Hub](https://console.cloud.google.com/home/recommendations/)\n2. In the **Improve Cloud SQL Instance Performance** card, click **View all**.\n\n3. Select the instances with **Manage high number of tables** recommendation.\n\n### gcloud CLI\n\nTo list Improve Instance Performance recommendations by using `gcloud CLI`, 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.PerformanceRecommender \\\n--filter=recommenderSubtype=MYSQL_HIGH_NUMBER_OF_TABLES_BEST_PRACTICE\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\n### API\n\nTo list Improve Instance Performance recommendations 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.PerformanceRecommender.MySqlHighNumberOfTablesBestPractice/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\nIf the recommender detects instances with high number of tables, it lists them in a\ntable with other performance recommendations.\nEach row shows the instance ID, a brief recommendation, database engine, the location, and the last refresh date.\n\nView insights and detailed recommendations\n------------------------------------------\n\nYou can view insights and detailed recommendations about instances\nthat have a high number of tables by using the Google Cloud console,\n`gcloud CLI`, or the Recommender API. \n\n### Console\n\nTo view insights and detailed recommendations about instances that are close to the performance threshold by using the Google Cloud console, click the recommendation\nlink in the list of instances.\n\n### gcloud CLI\n\nTo view insights and detailed recommendations about instances that are close to the performance threshold by using `gcloud CLI`, 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.PerformanceInsight \\\n--filter=insightSubtype=MYSQL_HIGH_NUMBER_OF_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, such as `us-central1`.\n\n### API\n\nTo view insights and detailed recommendations about instances that are close to the performance threshold\nby using the [Recommendations API](/recommender/docs/using-api),\ncall the [`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.PerformanceRecommender.MySqlHighNumberOfTables/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\nThe following table lists the insight and recommendation that the Cloud SQL\nhigh-number-of-open-tables recommender generates to help you improve performance.\nThe subtypes are visible in the `gcloud CLI` and API results.\n\nApply recommendations\n---------------------\n\nEvaluate the recommendations carefully and do any of the following:\n\n- To examine the instance, click **View instance** . See [Optimize the performance of your instance](#optimize-performance)\n and follow the recommendations.\n\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\n### Optimize the performance of your instance\n\n- [Edit](/sql/docs/mysql/edit-instance) your instance to increase the number of vCPUs\n to at least 32 cores and the memory size to at least 200 GB.\n This increases the instance's [table limit](/sql/docs/mysql/quotas#table_limit) from 50,000 to 500,000.\n\n | **Caution:** This operation can lead to an increase in cost. Additionally, it triggers a restart, which can cause downtime on the instance.\n- Drop unnecessary tables:\n\n ```\n DROP TABLE TABLE_NAME; \n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eTABLE_NAME\u003c/var\u003e: Name of the table you intend to drop.\n- Reduce the number of tables per instance by splitting the database across multiple instances to keep the number of tables in each\n instance within the recommended limits.\n\n- If you cannot immediately reduce the number of tables, you can reduce the likelihood\n of your instance being impacted by the high table\n count by setting the `innodb_file_per_table` flag to OFF. To turn off the value of\n the `innodb_file_per_table` flag, see [Configure a database flag](/sql/docs/mysql/flags?hl=en#config).\n However, this setting does not bring the instance back into SLA compliance.\n See these [operational guidelines](/sql/docs/mysql/operational-guidelines?hl=en#tables).\n\n- Use a general tablespace to create tables or move existing tables to a general tablespace.\n To learn more, see [MySQL documentation on general tablespaces](https://dev.mysql.com/doc/refman/8.0/en/general-tablespaces.html).\n\nWhat's next\n-----------\n\n- [Increase the table open cache size](/sql/docs/mysql/recommender-high-number-of-open-tables)\n- [Monitor disk availability](/sql/docs/mysql/using-ood-recommender)\n- [Identify idle Cloud SQL instances](/sql/docs/mysql/recommender-sql-idle)\n- [Reduce overprovisioned Cloud SQL instances](/sql/docs/mysql/recommender-sql-overprovisioned)\n- Explore [Google Cloud recommenders](/recommender/docs/recommenders)"]]