Ativar e desativar embeddings de vetor na sua instância
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
MySQL | PostgreSQL | SQL Server
Nesta seção, descrevemos como configurar sua instância do Cloud SQL para permitir o armazenamento, a indexação e a consulta de embeddings de vetor.
As instâncias do Cloud SQL Enterprise e do Cloud SQL Enterprise Plus são compatíveis com embeddings de vetor. Todas as versões do MySQL 8.0.36 ou mais recentes são compatíveis.
Antes de começar
Verifique se você tem os papéis Administrador do Cloud SQL e Leitor do Compute na
sua conta de usuário.
INSTANCE_NAME: o nome da instância em que você quer ativar o suporte a embeddings de vetor.
FLAGS: configure a seguinte flag do MySQL na sua instância:
cloudsql_vector: defina essa flag como on para ativar o suporte a armazenamento de embeddings de vetor e pesquisa de similaridade de vetor. Essa flag fica desativada por
padrão. Quando você configura a flag, o comando fica assim:
A flag cloudsql_vector é estática. Depois de atualizar a instância com a flag (ativando ou desativando), ela será reiniciada automaticamente para que as mudanças de configuração entrem em vigor.
Antes de desativar os embeddings de vetor na sua instância, é preciso
remover explicitamente todos os índices de vetor nela. Para saber como encontrar uma lista de índices de vetor na instância, consulte Monitorar índices de vetor.
Desativar o suporte a embeddings de vetor impede que você crie novas colunas de embeddings de vetor e índices de vetor. Ele também impede que você use a função approx_distance para pesquisas vetoriais. Para desativar o suporte a embeddings de vetor, defina a flag cloudsql_vector como off. Depois de configurar essa flag estática, a instância é reiniciada automaticamente para que a mudança na configuração entre em vigor.
Para desativar o suporte a embeddings de vetor, defina a flag cloudsql_vector como
off.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-09-04 UTC."],[],[],null,["# Enable and disable vector embeddings on your instance\n\n\u003cbr /\u003e\n\nMySQL \\| PostgreSQL \\| SQL Server\n\n\u003cbr /\u003e\n\n| To use the GA version of vector search, the instance maintenance version should be version `MYSQL_8_0_version.R20241208.01_00` or newer, where version is the minor version number. For information about how to upgrade your instance to a newer version that supports GA vector embeddings, see [Self-service maintenance](/sql/docs/mysql/self-service-maintenance). \n|\n| For information about the syntax and behavior of vector embeddings for the Public Preview version of this feature, see [Work with vector embeddings (Preview)](/sql/docs/mysql/work-with-vectors-preview).\n\nThis section describes how to configure your Cloud SQL instance to\nsupport the storage, indexing, and querying of vector embeddings.\n\nBoth Cloud SQL Enterprise edition and Cloud SQL\nEnterprise Plus edition instances support vector embeddings. All versions of\nMySQL 8.0.36+ are supported.\n\nBefore you begin\n----------------\n\nMake sure you have the Cloud SQL Admin and Compute Viewer roles on\nyour user account.\n\nFor more information, see\n[Roles and permissions](/sql/docs/mysql/roles-and-permissions).\n\nEnable the database flag for vector embeddings\n----------------------------------------------\n\nTo turn on support for vector embeddings, you must enable the MySQL database\nflags. \n\n gcloud sql instances patch \u003cvar translate=\"no\"\u003eINSTANCE_NAME\u003c/var\u003e \\\n --database-flags=\u003cvar translate=\"no\"\u003eFLAGS\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eINSTANCE_NAME\u003c/var\u003e: the name of the instance you want to enable vector embedding support on.\n- \u003cvar translate=\"no\"\u003eFLAGS\u003c/var\u003e: configure the following MySQL flag on your instance:\n\n - `cloudsql_vector`: set this flag to `on` to enable vector embedding\n storage and vector similarity search support. This flag is off by\n default. When you configure the flag, your command looks similar to the\n following:\n\n gcloud sql instances patch my-instance \\\n --database-flags=cloudsql_vector=on\n\n The `cloudsql_vector` flag is static. After you update the instance with\n the flag (by turning it on or off), your instance restarts automatically\n in order for the configuration changes to take effect.\n\nFor more information about how to configure database flags for MySQL, see\n[Configure database flags](/sql/docs/mysql/flags).\n\nDisable vector embeddings\n-------------------------\n\nBefore you disable vector embeddings on your instance, you must\nexplicitly drop all vector indexes on the instance. To learn how to find a list\nof vector indexes on the instance, see\n[Monitor vector indexes](/sql/docs/mysql/create-manage-vector-indexes#monitor_vector_indexes).\n\nDisabling vector embeddings support prevents you from creating new vector\nembedding columns and vector indexes. It also prevents you from using the\n`approx_distance` function for vector searches. To turn off support for vector\nembeddings, set the `cloudsql_vector` flag to `off`. After you configure this\nstatic flag, the instance restarts automatically for the configuration change to\ntake effect.\n\nTo disable support for vector embeddings, set the `cloudsql_vector` flag to\n`off`.\n\nFor example: \n\n gcloud sql instances patch \u003cvar translate=\"no\"\u003eINSTANCE_NAME\u003c/var\u003e \\\n --database-flags=cloudsql_vector=off\n\nReplace \u003cvar translate=\"no\"\u003eINSTANCE_NAME\u003c/var\u003e with the name of the instance on which you're\nturning off vector embedding support.\n\nWhat's next\n-----------\n\n- Read the [overview about vector search on Cloud SQL](/sql/docs/mysql/vector-search).\n- Learn how to [generate vector embeddings](/sql/docs/mysql/generate-manage-vector-embeddings#generate_vector_embeddings_based_on_row_data).\n- Learn how to [create vector indexes](/sql/docs/mysql/create-manage-vector-indexes).\n- Learn how to [perform searches on vector embeddings](/sql/docs/mysql/search-filter-vector-embeddings)."]]