This document shows you how to use stored embeddings to generate indexes and query embeddings. For more information about storing embedding, see Store vector embeddings.
You can create ScaNN
, IVF
, IVFFlat
, and HNSW
indexes with AlloyDB.
Before you begin
Before you can start creating indexes, you must complete the following prerequisites.
Embedding vectors are added to a table in your AlloyDB database.
The
vector
extension version0.5.0
or later that is based onpgvector
, extended by Google for AlloyDB is installed.CREATE EXTENSION IF NOT EXISTS vector;
To generate
ScaNN
indexes, install thealloydb_scann
extension in addition to thevector
extension.CREATE EXTENSION IF NOT EXISTS alloydb_scann;
Create an index
You can create one of the following index types for tables in your database.