This page describes how to use stored embeddings to generate indexes and query
embeddings using ScaNN
, IVF
, IVFFlat
, and HNSW
indexes with AlloyDB for PostgreSQL.
For more information about storing embedding, see
Store vector embeddings.
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.
What's next
- An example embedding workflow
- Tune vector query performance
- Vector index metrics
- Learn how to build a smart shopping assistant with AlloyDB, pgvector, and model endpoint management.