The stockpgvectorPostgreSQL
extensionextension is customized for AlloyDB, and referred to asvector.
It supports storing generated embeddings in a vector column. The extension also
adds support for scalar quantization feature to createIVFindexes. You can
also create anIVFFlatindex orHSNWindex that are available with stockpgvector.
For more information about storing vectors, seeStore vectors.
In addition to the customizedvectorextension, AlloyDB
includes thealloydb_scannextension that implements a highly efficient
nearest-neighbor index powered by theScaNN
algorithm.
You can tune your indexes for a balance between query-per-second (QPS) and recall
with your queries. For more information about tuning your indexes, seeTune
vector query performance.
Generate embeddings and text predictions
AlloyDB AI extends PostgreSQL syntax with two functions for
querying models using thegoogle_ml_integrationextension:
You can then apply these vector embeddings
as input topgvectorfunctions. This includes methods to compare and sort
samples of text according to their relative semantic distance.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eAlloyDB AI provides machine learning capabilities to your data through its integration with AlloyDB for PostgreSQL and AlloyDB Omni.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003evector\u003c/code\u003e extension, a customized version of \u003ccode\u003epgvector\u003c/code\u003e, allows storing embeddings in a vector column and supports scalar quantization for creating \u003ccode\u003eIVF\u003c/code\u003e indexes.\u003c/p\u003e\n"],["\u003cp\u003eAlloyDB's \u003ccode\u003ealloydb_scann\u003c/code\u003e extension, compatible with PostgreSQL 15, offers a highly efficient nearest-neighbor index utilizing the ScaNN algorithm.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egoogle_ml_integration\u003c/code\u003e extension offers \u003ccode\u003eInvoke predictions\u003c/code\u003e and \u003ccode\u003eGenerate embeddings\u003c/code\u003e functions to enable model querying and text translation into vectors.\u003c/p\u003e\n"],["\u003cp\u003eAlloyDB Omni can be configured to work with Vertex AI, enabling applications to leverage models from the Vertex AI Model Garden and use the \u003ccode\u003etext-embedding-005\u003c/code\u003e English models for generating embeddings.\u003c/p\u003e\n"]]],[],null,["Select a documentation version: Current (16.8.0)keyboard_arrow_down\n\n- [Current (16.8.0)](/alloydb/omni/current/docs/ai/overview-ai)\n- [16.8.0](/alloydb/omni/16.8.0/docs/ai/overview-ai)\n- [16.3.0](/alloydb/omni/16.3.0/docs/ai/overview-ai)\n- [15.12.0](/alloydb/omni/15.12.0/docs/ai/overview-ai)\n- [15.7.1](/alloydb/omni/15.7.1/docs/ai/overview-ai)\n- [15.7.0](/alloydb/omni/15.7.0/docs/ai/overview-ai)\n\n\u003cbr /\u003e\n\nAlloyDB AI is a suite of features included with AlloyDB for PostgreSQL and AlloyDB Omni that let you apply the semantic and predictive power of machine learning (ML) models to your data. This page provides an overview of the ML-powered AI functions that are available through AlloyDB.\n\n\u003cbr /\u003e\n\n| **Caution:** The `postgres_ann` extension is renamed to `alloydb_scann`. Before you upgrade to AlloyDB Omni version 15.7.0, you must drop any indexes created using the older `postgres_ann` version. Next, upgrade AlloyDB Omni, and then create the indexes again using the `alloydb_scann` extension. This applies only to AlloyDB Omni.\n\nStore, index, and query vectors\n\nThe stock [`pgvector` PostgreSQL\nextension](https://github.com/pgvector/pgvector?tab=readme-ov-file#indexing)\nextension is customized for AlloyDB, and referred to as `vector`.\nIt supports storing generated embeddings in a vector column. The extension also\nadds support for scalar quantization feature to create `IVF` indexes. You can\nalso create an `IVFFlat` index or `HSNW` index that are available with stock\n`pgvector`.\n\nFor more information about storing vectors, see [Store vectors](/alloydb/omni/current/docs/ai/store-embeddings).\n\nIn addition to the customized `vector` extension, AlloyDB\nincludes the `alloydb_scann` extension that implements a highly efficient\nnearest-neighbor index powered by the [ScaNN\nalgorithm](https://github.com/google-research/google-research/blob/master/scann/docs/algorithms.md).\n| **Note:** The `alloydb_scann` extension can be used with PostgreSQL 15 compatible databases.\n\nFor more information about creating indexes and querying vectors, see [Create\nindexes and query vectors](/alloydb/omni/current/docs/ai/store-index-query-vectors).\n\nTune your vector query performance\n\nYou can tune your indexes for a balance between query-per-second (QPS) and recall\nwith your queries. For more information about tuning your indexes, see [Tune\nvector query performance](/alloydb/omni/current/docs/ai/tune-indexes).\n\nGenerate embeddings and text predictions\n\nAlloyDB AI extends PostgreSQL syntax with two functions for\nquerying models using the `google_ml_integration` extension:\n\n- [Invoke predictions](/alloydb/omni/current/docs/ai/invoke-predictions) to call a model using SQL within a\n transaction.\n\n- [Generate embeddings](/alloydb/omni/current/docs/ai/work-with-embeddings) to have an LLM translate text\n prompts into numerical vectors.\n\n You can use the [`embedding()` function](/alloydb/omni/current/docs/ai/work-with-embeddings) to query Vertex AI\n models, while the [`google_ml.embedding()` function](/alloydb/omni/current/docs/ai/model-endpoint-overview) can be used to query registered\n Vertex AI, hosted, and third-party models.\n\n You can then apply these vector embeddings\n as input to `pgvector` functions. This includes methods to compare and sort\n samples of text according to their relative semantic distance.\n\n| **Note:** To generate embeddings for custom hosted or third-party AI models, see [Register and call remote AI models in\n| AlloyDB Omni](/alloydb/omni/current/docs/ai/model-endpoint-overview). This feature is available in [Preview](https://cloud.google.com/products?e=48754805#product-launch-stages).\n\nUse models in the cloud with Vertex AI\n\nYou can [configure AlloyDB Omni to work with\nVertex AI](/alloydb/omni/current/docs/install-with-alloydb-ai).\n\nThis gives your applications the following benefits:\n\n- Your applications can invoke predictions using any model stored in the [Vertex AI Model Garden](/model-garden) that they have\n access to.\n\n- Your applications can generate embeddings using [the\n `text-embedding` English models](/vertex-ai/docs/generative-ai/model-reference/text-embeddings)\n LLM.\n\nWhat's next\n\n- [Install AlloyDB Omni with AlloyDB AI](/alloydb/omni/current/docs/install-with-alloydb-ai).\n\n- [Create indexes and query vectors](/alloydb/omni/current/docs/ai/store-index-query-vectors)."]]