이 페이지에서는 Spanner Vertex AI 통합에 대해 간략히 설명합니다. Spanner Vertex AI 통합은 GoogleSQL 및 PostgreSQL 데이터베이스에서 모두 작동합니다.
Spanner Vertex AI 통합을 사용하면 GoogleSQL 및 PostgreSQL 인터페이스를 통해 Vertex AI에서 호스팅되는 분류기 및 회귀 ML 모델에 액세스할 수 있습니다. 이를 통해 ML 예측 서빙 기능을 DQL/DML 쿼리를 사용하여 수행되는 일반적인 Spanner 데이터 액세스 작업과 원활하게 통합할 수 있습니다.
Spanner Vertex AI 통합의 이점
Spanner Vertex AI 통합을 사용하여 ML 예측을 생성하면 Spanner 데이터 액세스와 Vertex AI 예측 엔드포인트에 대한 액세스가 개별적으로 수행되는 방법에 비해 여러 가지 이점이 있습니다.
성과:
지연 시간 개선: Vertex AI 서비스와 통신하는 Spanner Vertex AI 통합은 Spanner의 클라이언트를 실행하는 컴퓨팅 노드와 Vertex AI 서비스 간의 추가적인 왕복을 없애줍니다.
처리량/동시 처리 향상: Spanner Vertex AI 통합은 Spanner의 분산형 쿼리 처리 인프라를 기반으로 실행되므로, 동시 로드가 높은 쿼리 실행을 지원합니다.
사용자 환경:
간단하고 일관되며 친숙한 단일 SQL 인터페이스를 사용하여 Spanner 확장 수준에서 데이터 변환 및 ML 서빙 시나리오를 모두 용이하게 하면 ML 진입 장벽이 낮아지고 훨씬 더 원활한 사용자 경험을 제공할 수 있습니다.
비용:
Spanner Vertex AI 통합은 Spanner 컴퓨팅 용량을 사용하여 ML 계산 및 SQL 쿼리 실행 결과를 병합합니다. 따라서 이에 대한 추가 컴퓨팅(예: Compute Engine 또는 Google Kubernetes Engine에서)을 프로비저닝할 필요가 없습니다.
Spanner Vertex AI 통합은 어떻게 작동하나요?
Spanner Vertex AI 통합은 ML 모델을 호스팅하지 않는 대신 Vertex AI 서비스 인프라를 사용합니다. Spanner Vertex AI 통합과 함께 사용하기 위해 Vertex AI를 사용하여 모델을 학습시킬 필요는 없지만 Vertex AI 엔드포인트에 배포해야 합니다.
이러한 함수를 사용하여 텍스트 임베딩을 생성하는 방법에 관한 자세한 내용은 텍스트 임베딩 가져오기를 참조하세요.
가격 책정
Spanner Vertex AI 통합과 함께 Spanner를 사용할 때 Spanner에서 추가 요금이 청구되지 않습니다.
그러나 이 기능과 관련하여 다른 요금이 발생할 가능성이 있습니다.
Vertex AI 온라인 예측에 대한 표준 요율을 지불합니다. 총 요금은 사용하는 모델 유형에 따라 다릅니다. 일부 모델 유형은 사용하는 머신 유형 및 노드 수에 따라 고정된 시간당 요금이 적용됩니다. 일부 모델 유형에는 통화당 요금이 있습니다. 후자는 명시적인 예측 할당량을 설정한 전용 프로젝트에 배포하는 것이 좋습니다.
Spanner와 Vertex AI 간의 데이터 전송에 표준 요금이 청구됩니다. 총 청구 금액은 쿼리를 실행하는 서버를 호스팅하는 리전과 호출된 엔드포인트를 호스팅하는 리전에 따라 다릅니다. 요금을 최소화하려면 Spanner 인스턴스와 동일한 리전에 Vertex AI 엔드포인트를 배포합니다. 다중 리전 인스턴스 구성 또는 여러 Vertex AI 엔드포인트를 사용하는 경우 동일한 대륙에 엔드포인트를 배포합니다.
Vertex AI 엔드포인트는 수신 트래픽을 처리하기에 충분한 용량을 프로비저닝해야 합니다.
지역별 서비스 중단을 방지하려면 Vertex AI 엔드포인트가 Spanner 데이터베이스와 가까운 별도의 리전을 사용해야 합니다.
Vertex AI 엔드포인트는 프로젝트별 예측 할당량 문제를 방지하기 위해 별도의 프로젝트를 사용해야 합니다.
중복 Vertex AI 엔드포인트 수는 SLA 및 Spanner 쿼리의 행 수에 따라 다릅니다.
Spanner SLA
Vertex AI SLA
행 1개
행 10개
행 100개
행 1000개
99.99%
99.9%
2
2
2
3
99.99%
99.5%
2
3
3
4
99.999%
99.9%
2
2
3
3
99.999%
99.5%
3
3
4
4
Vertex AI 엔드포인트는 정확히 동일한 모델을 호스팅하지 않아도 됩니다. 첫 번째 엔드포인트로 복잡하고 컴퓨팅 집약적인 기본 모델을 포함하도록 Spanner ML 모델을 구성하는 것이 좋습니다. 후속 장애 조치 엔드포인트는 컴퓨팅 집약도가 낮은 간소화된 모델을 가리켜서 확장성을 높이고 트래픽 급증에 대처할 수 있습니다.
제한사항
모델 입력 및 출력은 JSON 객체여야 합니다.
규정 준수
Assured Workloads는 Vertex AI Prediction API를 지원하지 않습니다. 리소스 사용량 제한 제약조건을 사용 설정하면 Vertex AI API가 사용 중지되고 그에 따라 Spanner Vertex AI 통합 기능도 사용 중지됩니다.
또한 프로덕션 데이터베이스에서 규정 준수가 적절히 구성되지 않은 비프로덕션 프로젝트의 Vertex AI 엔드포인트에 연결할 수 없도록 VPC 서비스 제어 경계를 만드는 것이 좋습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-11(UTC)"],[],[],null,["# Spanner Vertex AI integration overview\n\nThis page provides an overview of Spanner Vertex AI integration. Spanner Vertex AI integration works with both\nGoogleSQL and PostgreSQL databases.\n\nSpanner Vertex AI integration helps you to access classifier and regression ML models hosted on\n[Vertex AI](/vertex-ai) through the GoogleSQL and\nPostgreSQL interface. This\nhelps to seamlessly integrate ML predictions serving functionality with general\nSpanner data access operations performed using DQL/DML queries.\n\nBenefits of Spanner Vertex AI integration\n-----------------------------------------\n\nGenerating ML predictions using Spanner Vertex AI integration provides multiple benefits compared\nto the approach where Spanner data access and access to the Vertex AI\nprediction endpoint are performed separately:\n\n- Performance:\n - Better latency: Spanner Vertex AI integration talking to the Vertex AI service directly eliminates additional round-trips between a compute node running a Spanner's client and the Vertex AI service.\n - Better throughput/parallelism: Spanner Vertex AI integration runs on top of Spanner's distributed query processing infrastructure, which supports highly parallelizable query execution.\n- User experience:\n - Ability to use a single, simple, coherent, and familiar SQL interface to facilitate both data transformation and ML serving scenarios on Spanner level of scale lowers the ML entry barrier and allows for a much smoother user experience.\n- Costs:\n - Spanner Vertex AI integration uses Spanner [compute capacity](/spanner/docs/compute-capacity) to merge the results of ML computations and SQL query execution, which eliminates the need to provision an additional compute (for example, in Compute Engine or Google Kubernetes Engine) for that.\n\nHow does Spanner Vertex AI integration work?\n--------------------------------------------\n\nSpanner Vertex AI integration doesn't host ML models, but relies on the Vertex AI service\ninfrastructure instead. You don't need to train a model using Vertex AI\nto use it with Spanner Vertex AI integration, but you must deploy it to a Vertex AI endpoint.\n\nTo train models on data stored in Spanner, you can use the following:\n\n- [BigQuery Federated queries](/bigquery/docs/spanner-federated-queries) together\n with [BigQuery ML](/bigquery/docs/bqml-introduction).\n\n- [Dataflow](/dataflow) to export data from Spanner into CSV format\n and import the [CSV data source](/vertex-ai/docs/datasets/prepare-tabular#csv) into Vertex AI.\n\nSpanner Vertex AI integration extends the following functions for using ML models:\n\n- **Generate ML predictions** by calling a model using\n SQL on your Spanner data. You can use a model from the\n [Vertex AI Model Garden](/vertex-ai/docs/start/explore-models)\n or a model deployed to your [Vertex AI endpoint](/vertex-ai/docs/general/deployment).\n\n- **Generate text embeddings** to have an LLM translate\n text prompts into numbers. To\n learn more about embeddings, see [Get text embeddings](/vertex-ai/docs/generative-ai/embeddings/get-text-embeddings).\n\nUsing Spanner Vertex AI integration functions\n---------------------------------------------\n\nA model in Spanner Vertex AI integration can be used to generate predictions or text\nembeddings in your SQL code using the ML Predict functions. These functions\nare as follows: \n\n### GoogleSQL\n\n\nYou can use the following ML predict function for GoogleSQL:\n\n[`ML.PREDICT`](/spanner/docs/reference/standard-sql/ml-functions#mlpredict)\n\nYou need to register your model using the [`CREATE MODEL`](/spanner/docs/reference/standard-sql/data-definition-language#create_model)\nDDL statement before using it with the `ML.PREDICT` function.\n\nYou can also use `SAFE.ML.PREDICT` to return `null` instead of an error in\nyour predictions. This is helpful in cases when running large queries\nwhere some failed predictions are tolerable.\n\n### PostgreSQL\n\nYou can use the following ML predict function for PostgreSQL:\n\n[`spanner.ML_PREDICT_ROW`](/spanner/docs/reference/postgresql/functions-and-operators#ml)\n\nTo use the functions,\nyou can select a model from the\n[Vertex AI Model Garden](/vertex-ai/docs/start/explore-models)\nor use a model that you've deployed to Vertex AI.\n\nFor more information on how to deploy a model to an endpoint\nin Vertex AI, see\n[Deploy a model to an endpoint](/vertex-ai/docs/general/deployment).\n\nFor more information\non how to use these functions to generate an ML prediction,\nsee [Generate ML predictions using SQL](/spanner/docs/ml-tutorial).\n\nFor more information on how to use these functions to generate text embeddings,\nsee [Get text embeddings](/vertex-ai/docs/generative-ai/embeddings/get-text-embeddings).\n\nPricing\n-------\n\nThere are no additional charges from Spanner when you use it with Spanner Vertex AI integration.\nHowever, there are other potential charges associated with this feature:\n\n- You pay the [standard rates](/vertex-ai/pricing) for Vertex AI\n online prediction. The total charge depends on the model type you use. Some model\n types have a flat per hour rate, depending on the machine type and number of\n nodes that you use. Some model types have per call rates. We recommend you\n deploy the latter in a dedicated project where you have set explicit prediction\n quotas.\n\n- You pay the [standard rates](/spanner/pricing#network) for data transfer\n between Spanner and Vertex AI. The total charge depends on\n the region hosting the server that executes the query and the region hosting the\n called endpoint. To minimize charges, deploy your Vertex AI endpoints\n in the same region as your Spanner instance. When using multi-regional\n instance configurations or multiple Vertex AI endpoints, deploy your\n endpoints on the same continent.\n\nSLA\n---\n\nDue to [Vertex AI online prediction availability](/vertex-ai/sla) being\nlower, you must properly configure Spanner ML models to maintain\n[Spanner's high availability](/spanner/sla) while using Spanner Vertex AI integration:\n\n1. Spanner ML models must use multiple Vertex AI endpoints on the backend to enable failover.\n2. Vertex AI endpoints must conform to the [Vertex AI SLA](/vertex-ai/sla).\n3. Vertex AI endpoints must provision enough capacity to handle incoming traffic.\n4. Vertex AI endpoints must use separate regions close to the Spanner database to avoid regional outages.\n5. Vertex AI endpoints should use separate projects to avoid issues with per-project prediction quotas.\n\nThe number of redundant Vertex AI endpoints depends on their SLA, and\nthe number of rows in Spanner queries:\n\nVertex AI endpoints don't need to host exactly the same model. We\nrecommend that you configure the Spanner ML model to have a primary,\ncomplex and compute intensive model as its first endpoint. Subsequent failover\nendpoints can point to simplified models that are less compute intensive,\nscale better and can absorb traffic spikes.\n\nLimitations\n-----------\n\n- Model input and output must be a JSON object.\n\nCompliance\n----------\n\n[Assured Workloads](/assured-workloads/docs/overview) don't support the\nVertex AI Prediction API. Enabling a\n[restrict resource usage constraint](/assured-workloads/docs/restrict-resource-usage)\ndisables the Vertex AI API and effectively the Spanner Vertex AI integration feature.\n\nAdditionally, we recommend that you create a\n[VPC Service Controls perimeter](/assured-workloads/docs/configure-vpc-sc) to ensure your\nproduction databases cannot connect to Vertex AI endpoints in your\nnon-production projects that might not have the proper compliance configuration."]]